diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-07-06 14:43:24 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-07-06 14:43:24 +0200 |
| commit | 04bd6c3d9e84645b320e888fa5c547e0b2b1be93 (patch) | |
| tree | b841cc3e24c7fbe98988948a7fdea53d2ca79a8f /pkg | |
| parent | 8c2335a205682fbbe311fb5ad4393419fd094a99 (diff) | |
pkg/instance: pass -os to execprog/fuzzer only for akaros
Only akaros needs OS, because the rest assume host OS.
But speciying OS for all OSes breaks patch testing on syzbot
because old execprog does not have os flag.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/instance/instance.go | 44 | ||||
| -rw-r--r-- | pkg/repro/repro.go | 13 |
2 files changed, 43 insertions, 14 deletions
diff --git a/pkg/instance/instance.go b/pkg/instance/instance.go index 78859727b..ff3240f52 100644 --- a/pkg/instance/instance.go +++ b/pkg/instance/instance.go @@ -265,8 +265,9 @@ func (inst *inst) testInstance() error { if err != nil { return &TestError{Title: fmt.Sprintf("failed to copy test binary to VM: %v", err)} } - cmd := fmt.Sprintf("%v -test -executor=%v -name=test -os=%v -arch=%v -manager=%v -cover=0 -sandbox=%v", - fuzzerBin, executorBin, inst.cfg.TargetOS, inst.cfg.TargetArch, fwdAddr, inst.cfg.Sandbox) + + cmd := FuzzerCmd(fuzzerBin, executorBin, "test", inst.cfg.TargetOS, inst.cfg.TargetArch, fwdAddr, + inst.cfg.Sandbox, 0, 0, false, false, true) outc, errc, err := inst.vm.Run(5*time.Minute, nil, cmd) if err != nil { return fmt.Errorf("failed to run binary in VM: %v", err) @@ -322,10 +323,8 @@ func (inst *inst) testRepro() error { if !opts.Fault { opts.FaultCall = -1 } - cmdSyz := fmt.Sprintf("%v -executor=%v -os=%v -arch=%v -procs=%v -sandbox=%v"+ - " -fault_call=%v -fault_nth=%v -repeat=0 -cover=0 %v", - execprogBin, executorBin, cfg.TargetOS, cfg.TargetArch, cfg.Procs, opts.Sandbox, - opts.FaultCall, opts.FaultNth, vmProgFile) + cmdSyz := ExecprogCmd(execprogBin, executorBin, cfg.TargetOS, cfg.TargetArch, opts.Sandbox, + true, true, true, cfg.Procs, opts.FaultCall, opts.FaultNth, vmProgFile) if err := inst.testProgram(cmdSyz, 7*time.Minute); err != nil { return err } @@ -363,3 +362,36 @@ func (inst *inst) testProgram(command string, testTime time.Duration) error { } return &CrashError{Report: rep} } + +func FuzzerCmd(fuzzer, executor, name, OS, arch, fwdAddr, sandbox string, procs, verbosity int, + cover, debug, test bool) string { + osArg := "" + if OS == "akaros" { + // Only akaros needs OS, because the rest assume host OS. + // But speciying OS for all OSes breaks patch testing on syzbot + // because old execprog does not have os flag. + osArg = " -os=" + OS + } + return fmt.Sprintf("%v -executor=%v -name=%v -arch=%v%v -manager=%v -sandbox=%v"+ + " -procs=%v -v=%d -cover=%v -debug=%v -test=%v", + fuzzer, executor, name, arch, osArg, fwdAddr, sandbox, + procs, verbosity, cover, debug, test) +} + +func ExecprogCmd(execprog, executor, OS, arch, sandbox string, repeat, threaded, collide bool, + procs, faultCall, faultNth int, progFile string) string { + repeatCount := 1 + if repeat { + repeatCount = 0 + } + osArg := "" + if OS == "akaros" { + osArg = " -os=" + OS + } + return fmt.Sprintf("%v -executor=%v -arch=%v%v -sandbox=%v"+ + " -procs=%v -repeat=%v -threaded=%v -collide=%v -cover=0"+ + " -fault_call=%v -fault_nth=%v %v", + execprog, executor, arch, osArg, sandbox, + procs, repeatCount, threaded, collide, + faultCall, faultNth, progFile) +} diff --git a/pkg/repro/repro.go b/pkg/repro/repro.go index 83eac9bde..4c3f8a93a 100644 --- a/pkg/repro/repro.go +++ b/pkg/repro/repro.go @@ -12,6 +12,7 @@ import ( "time" "github.com/google/syzkaller/pkg/csource" + instancePkg "github.com/google/syzkaller/pkg/instance" "github.com/google/syzkaller/pkg/log" "github.com/google/syzkaller/pkg/osutil" "github.com/google/syzkaller/pkg/report" @@ -525,10 +526,6 @@ func (ctx *context) testProgs(entries []*prog.LogEntry, duration time.Duration, return false, fmt.Errorf("failed to copy to VM: %v", err) } - repeat := 1 - if opts.Repeat { - repeat = 0 - } if !opts.Fault { opts.FaultCall = -1 } @@ -543,10 +540,10 @@ func (ctx *context) testProgs(entries []*prog.LogEntry, duration time.Duration, } program += "]" } - command := fmt.Sprintf("%v -executor=%v -os=%v -arch=%v -cover=0 -procs=%v -repeat=%v"+ - " -sandbox %v -threaded=%v -collide=%v %v", - inst.execprogBin, inst.executorBin, ctx.cfg.TargetOS, ctx.cfg.TargetArch, opts.Procs, repeat, - opts.Sandbox, opts.Threaded, opts.Collide, vmProgFile) + + command := instancePkg.ExecprogCmd(inst.execprogBin, inst.executorBin, + ctx.cfg.TargetOS, ctx.cfg.TargetArch, opts.Sandbox, opts.Repeat, + opts.Threaded, opts.Collide, opts.Procs, -1, -1, vmProgFile) ctx.reproLog(2, "testing program (duration=%v, %+v): %s", duration, opts, program) return ctx.testImpl(inst.Instance, command, duration) } |
