From 282e82b3010e362d6160ad2b137c13c74fc3fd12 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 21 May 2024 21:13:39 +0200 Subject: pkg/instance: use execprog to do basic instance testing When we accept new kernels for fuzzing we need more extensive testing, but syz-ci switched to using syz-manager for this purpose. Now instance testing is used only for bisection and patch testing, which does not need such extensive image testing (it may even harm). So just run a simple program as a testing. It also uses the same features as the target reproducer, so e.g. if the reproducer does not use wifi, we won't test it, which reduces changes of unrelated kernel bugs. --- pkg/instance/execprog.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'pkg/instance/execprog.go') diff --git a/pkg/instance/execprog.go b/pkg/instance/execprog.go index 4cc8dd1f5..6abf8fd9c 100644 --- a/pkg/instance/execprog.go +++ b/pkg/instance/execprog.go @@ -43,7 +43,7 @@ type RunResult struct { const ( // It's reasonable to expect that tools/syz-execprog should not normally // return a non-zero exit code. - syzExitConditions = vm.ExitTimeout | vm.ExitNormal + SyzExitConditions = vm.ExitTimeout | vm.ExitNormal binExitConditions = vm.ExitTimeout | vm.ExitNormal | vm.ExitError ) @@ -161,7 +161,7 @@ func (inst *ExecProgInstance) RunCProgRaw(src []byte, target *prog.Target, } func (inst *ExecProgInstance) RunSyzProgFile(progFile string, duration time.Duration, - opts csource.Options) (*RunResult, error) { + opts csource.Options, exitCondition vm.ExitCondition) (*RunResult, error) { vmProgFile, err := inst.VMInstance.Copy(progFile) if err != nil { return nil, &TestError{Title: fmt.Sprintf("failed to copy prog to VM: %v", err)} @@ -174,17 +174,17 @@ func (inst *ExecProgInstance) RunSyzProgFile(progFile string, duration time.Dura command := ExecprogCmd(inst.execprogBin, inst.executorBin, target.OS, target.Arch, opts.Sandbox, opts.SandboxArg, opts.Repeat, opts.Threaded, opts.Collide, opts.Procs, faultCall, opts.FaultNth, !inst.OldFlagsCompatMode, inst.mgrCfg.Timeouts.Slowdown, vmProgFile) - return inst.runCommand(command, duration, syzExitConditions) + return inst.runCommand(command, duration, exitCondition) } func (inst *ExecProgInstance) RunSyzProg(syzProg []byte, duration time.Duration, - opts csource.Options) (*RunResult, error) { + opts csource.Options, exitCondition vm.ExitCondition) (*RunResult, error) { progFile, err := osutil.WriteTempFile(syzProg) if err != nil { return nil, err } defer os.Remove(progFile) - return inst.RunSyzProgFile(progFile, duration, opts) + return inst.RunSyzProgFile(progFile, duration, opts, exitCondition) } func (inst *ExecProgInstance) Close() { -- cgit mrf-deployment