From 0f3a5454d62026ed8a7e9de75c82cf3861038349 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 29 Nov 2020 12:00:13 +0100 Subject: pkg/mgrconfig: remove Syz prefix from fields Everything in syzkaller is syz-something, it's pointless to add syz prefix to everything and unnecessary increases clutter. Remove the prefix. Also, rename ExecutorCmd in target to ExecutorBin to make it consistent with mgrconfig and ExecprogBin/FuzzerBin. --- pkg/instance/instance.go | 28 ++++++++++++++-------------- pkg/mgrconfig/load.go | 26 +++++++++++++------------- pkg/repro/repro.go | 10 +++++----- 3 files changed, 32 insertions(+), 32 deletions(-) (limited to 'pkg') diff --git a/pkg/instance/instance.go b/pkg/instance/instance.go index 5ca1c2b78..861d51e72 100644 --- a/pkg/instance/instance.go +++ b/pkg/instance/instance.go @@ -302,22 +302,22 @@ func (inst *inst) testInstance() error { return fmt.Errorf("failed to setup port forwarding: %v", err) } - fuzzerBin, err := inst.vm.Copy(inst.cfg.SyzFuzzerBin) + fuzzerBin, err := inst.vm.Copy(inst.cfg.FuzzerBin) if err != nil { return &TestError{Title: fmt.Sprintf("failed to copy test binary to VM: %v", err)} } - // If SyzExecutorCmd is provided, it means that syz-executor is already in - // the image, so no need to copy it. - executorCmd := inst.cfg.SysTarget.SyzExecutorCmd - if executorCmd == "" { - executorCmd, err = inst.vm.Copy(inst.cfg.SyzExecutorBin) + // If ExecutorBin is provided, it means that syz-executor is already in the image, + // so no need to copy it. + executorBin := inst.cfg.SysTarget.ExecutorBin + if executorBin == "" { + executorBin, err = inst.vm.Copy(inst.cfg.ExecutorBin) if err != nil { return &TestError{Title: fmt.Sprintf("failed to copy test binary to VM: %v", err)} } } - cmd := OldFuzzerCmd(fuzzerBin, executorCmd, targets.TestOS, inst.cfg.TargetOS, inst.cfg.TargetArch, fwdAddr, + cmd := OldFuzzerCmd(fuzzerBin, executorBin, targets.TestOS, inst.cfg.TargetOS, inst.cfg.TargetArch, fwdAddr, inst.cfg.Sandbox, 0, inst.cfg.Cover, true) outc, errc, err := inst.vm.Run(10*time.Minute, nil, cmd) if err != nil { @@ -345,15 +345,15 @@ func (inst *inst) testInstance() error { func (inst *inst) testRepro() error { cfg := inst.cfg if len(inst.reproSyz) > 0 { - execprogBin, err := inst.vm.Copy(cfg.SyzExecprogBin) + execprogBin, err := inst.vm.Copy(cfg.ExecprogBin) if err != nil { return &TestError{Title: fmt.Sprintf("failed to copy test binary to VM: %v", err)} } - // If SyzExecutorCmd is provided, it means that syz-executor is already in - // the image, so no need to copy it. - executorCmd := cfg.SysTarget.SyzExecutorCmd - if executorCmd == "" { - executorCmd, err = inst.vm.Copy(inst.cfg.SyzExecutorBin) + // If ExecutorBin is provided, it means that syz-executor is already in the image, + // so no need to copy it. + executorBin := cfg.SysTarget.ExecutorBin + if executorBin == "" { + executorBin, err = inst.vm.Copy(inst.cfg.ExecutorBin) if err != nil { return &TestError{Title: fmt.Sprintf("failed to copy test binary to VM: %v", err)} } @@ -380,7 +380,7 @@ func (inst *inst) testRepro() error { if !opts.Fault { opts.FaultCall = -1 } - cmdSyz := ExecprogCmd(execprogBin, executorCmd, cfg.TargetOS, cfg.TargetArch, opts.Sandbox, + 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 diff --git a/pkg/mgrconfig/load.go b/pkg/mgrconfig/load.go index d4756a0cd..14b98eb01 100644 --- a/pkg/mgrconfig/load.go +++ b/pkg/mgrconfig/load.go @@ -27,10 +27,10 @@ type Derived struct { TargetArch string TargetVMArch string - // Syzkaller binaries that we are going to use: - SyzFuzzerBin string - SyzExecprogBin string - SyzExecutorBin string + // Full paths to binaries we are going to use: + FuzzerBin string + ExecprogBin string + ExecutorBin string Syscalls []int } @@ -211,17 +211,17 @@ func (cfg *Config) completeBinaries() error { targetBin := func(name, arch string) string { return filepath.Join(cfg.Syzkaller, "bin", cfg.TargetOS+"_"+arch, name+exe) } - cfg.SyzFuzzerBin = targetBin("syz-fuzzer", cfg.TargetVMArch) - cfg.SyzExecprogBin = targetBin("syz-execprog", cfg.TargetVMArch) - cfg.SyzExecutorBin = targetBin("syz-executor", cfg.TargetArch) - if !osutil.IsExist(cfg.SyzFuzzerBin) { - return fmt.Errorf("bad config syzkaller param: can't find %v", cfg.SyzFuzzerBin) + cfg.FuzzerBin = targetBin("syz-fuzzer", cfg.TargetVMArch) + cfg.ExecprogBin = targetBin("syz-execprog", cfg.TargetVMArch) + cfg.ExecutorBin = targetBin("syz-executor", cfg.TargetArch) + if !osutil.IsExist(cfg.FuzzerBin) { + return fmt.Errorf("bad config syzkaller param: can't find %v", cfg.FuzzerBin) } - if !osutil.IsExist(cfg.SyzExecprogBin) { - return fmt.Errorf("bad config syzkaller param: can't find %v", cfg.SyzExecprogBin) + if !osutil.IsExist(cfg.ExecprogBin) { + return fmt.Errorf("bad config syzkaller param: can't find %v", cfg.ExecprogBin) } - if !osutil.IsExist(cfg.SyzExecutorBin) { - return fmt.Errorf("bad config syzkaller param: can't find %v", cfg.SyzExecutorBin) + if !osutil.IsExist(cfg.ExecutorBin) { + return fmt.Errorf("bad config syzkaller param: can't find %v", cfg.ExecutorBin) } return nil } diff --git a/pkg/repro/repro.go b/pkg/repro/repro.go index 930127901..ad0d7c4df 100644 --- a/pkg/repro/repro.go +++ b/pkg/repro/repro.go @@ -210,14 +210,14 @@ func (ctx *context) initInstance(cfg *mgrconfig.Config, vmPool *vm.Pool, vmIndex if err != nil { return nil, fmt.Errorf("failed to create VM: %v", err) } - execprogBin, err := vmInst.Copy(cfg.SyzExecprogBin) + execprogBin, err := vmInst.Copy(cfg.ExecprogBin) if err != nil { vmInst.Close() return nil, fmt.Errorf("failed to copy to VM: %v", err) } - executorCmd := ctx.target.SyzExecutorCmd - if executorCmd == "" { - executorCmd, err = vmInst.Copy(cfg.SyzExecutorBin) + executorBin := ctx.target.ExecutorBin + if executorBin == "" { + executorBin, err = vmInst.Copy(cfg.ExecutorBin) if err != nil { vmInst.Close() return nil, fmt.Errorf("failed to copy to VM: %v", err) @@ -227,7 +227,7 @@ func (ctx *context) initInstance(cfg *mgrconfig.Config, vmPool *vm.Pool, vmIndex Instance: vmInst, index: vmIndex, execprogBin: execprogBin, - executorBin: executorCmd, + executorBin: executorBin, }, nil } -- cgit mrf-deployment