aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-crush
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-11-25 09:17:50 +0100
committerDmitry Vyukov <dvyukov@google.com>2020-12-28 14:22:41 +0100
commitcbd0445ec3b0b184db66966d8a47e6b37d13692e (patch)
tree14ed47723c325ef1b388e4e732a70c0fed4fa101 /tools/syz-crush
parent2242f77fdc5a6c50bd8fa1021d2abc8b83e09e8d (diff)
all: make timeouts configurable
Add sys/targets.Timeouts struct that parametrizes timeouts throughout the system. The struct allows to control syscall/program/no output timeouts for OS/arch/VM/etc. See comment on the struct for more details.
Diffstat (limited to 'tools/syz-crush')
-rw-r--r--tools/syz-crush/crush.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/tools/syz-crush/crush.go b/tools/syz-crush/crush.go
index 004ebd3fa..5b2dcfffd 100644
--- a/tools/syz-crush/crush.go
+++ b/tools/syz-crush/crush.go
@@ -23,14 +23,13 @@ import (
"github.com/google/syzkaller/pkg/mgrconfig"
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/pkg/report"
- "github.com/google/syzkaller/prog"
"github.com/google/syzkaller/vm"
)
var (
flagConfig = flag.String("config", "", "manager configuration file")
flagDebug = flag.Bool("debug", false, "dump all VM output to console")
- flagRestartTime = flag.Duration("restart_time", time.Hour, "how long to run the test")
+ flagRestartTime = flag.Duration("restart_time", 0, "how long to run the test")
flagInfinite = flag.Bool("infinite", true, "by default test is run for ever, -infinite=false to stop on crash")
)
@@ -52,7 +51,9 @@ func main() {
if err != nil {
log.Fatal(err)
}
-
+ if *flagRestartTime == 0 {
+ *flagRestartTime *= cfg.Timeouts.VMRunningTime
+ }
if *flagInfinite {
log.Printf("running infinitely and restarting VM every %v", *flagRestartTime)
} else {
@@ -101,7 +102,7 @@ func main() {
for i := 0; i < vmPool.Count(); i++ {
go func(index int) {
for {
- runDone <- runInstance(cfg.Target, cfg, reporter, vmPool, index, *flagRestartTime, runType)
+ runDone <- runInstance(cfg, reporter, vmPool, index, *flagRestartTime, runType)
if atomic.LoadUint32(&shutdown) != 0 || !*flagInfinite {
// If this is the last worker then we can close the channel.
if atomic.AddUint32(&stoppedWorkers, 1) == uint32(vmPool.Count()) {
@@ -165,7 +166,7 @@ func storeCrash(cfg *mgrconfig.Config, rep *report.Report) {
}
}
-func runInstance(target *prog.Target, cfg *mgrconfig.Config, reporter report.Reporter,
+func runInstance(cfg *mgrconfig.Config, reporter report.Reporter,
vmPool *vm.Pool, index int, timeout time.Duration, runType FileType) *report.Report {
log.Printf("vm-%v: starting", index)
inst, err := vmPool.Create(index)
@@ -200,7 +201,7 @@ func runInstance(target *prog.Target, cfg *mgrconfig.Config, reporter report.Rep
}
cmd = instance.ExecprogCmd(execprogBin, executorBin, cfg.TargetOS, cfg.TargetArch, cfg.Sandbox,
- true, true, true, cfg.Procs, -1, -1, logFile)
+ true, true, true, cfg.Procs, -1, -1, true, cfg.Timeouts.Slowdown, logFile)
} else {
cmd = execprogBin
}