From 88e3a1226bc591d81c1fb98e83cb63cd4f341c6e Mon Sep 17 00:00:00 2001 From: Andrey Artemiev Date: Sat, 6 Aug 2022 05:17:33 -0700 Subject: pkg/csource, pkg/instance, pkg/ipc, pkg/mgrconfig, tools/syz-prog2c, syz-manager: introduce a new setting 'sandbox_arg' (#3263) --- tools/syz-prog2c/prog2c.go | 4 +++- tools/syz-runtest/runtest.go | 3 ++- tools/syz-testbuild/testbuild.go | 26 ++++++++++++++------------ 3 files changed, 19 insertions(+), 14 deletions(-) (limited to 'tools') diff --git a/tools/syz-prog2c/prog2c.go b/tools/syz-prog2c/prog2c.go index 7cea629f8..e7b1ae9b1 100644 --- a/tools/syz-prog2c/prog2c.go +++ b/tools/syz-prog2c/prog2c.go @@ -24,7 +24,8 @@ var ( flagRepeat = flag.Int("repeat", 1, "repeat program that many times (<=0 - infinitely)") flagProcs = flag.Int("procs", 1, "number of parallel processes") flagSlowdown = flag.Int("slowdown", 1, "execution slowdown caused by emulation/instrumentation") - flagSandbox = flag.String("sandbox", "", "sandbox to use (none, setuid, namespace)") + flagSandbox = flag.String("sandbox", "", "sandbox to use (none, setuid, namespace, android)") + flagSandboxArg = flag.Int("sandbox_arg", 0, "argument for executor to customize its behavior") flagProg = flag.String("prog", "", "file with program to convert (required)") flagHandleSegv = flag.Bool("segv", false, "catch and ignore SIGSEGV") flagUseTmpDir = flag.Bool("tmpdir", false, "create a temporary dir and execute inside it") @@ -76,6 +77,7 @@ func main() { Procs: *flagProcs, Slowdown: *flagSlowdown, Sandbox: *flagSandbox, + SandboxArg: *flagSandboxArg, Leak: *flagLeak, NetInjection: features["tun"].Enabled, NetDevices: features["net_dev"].Enabled, diff --git a/tools/syz-runtest/runtest.go b/tools/syz-runtest/runtest.go index 621c3e958..3bf05c8b0 100644 --- a/tools/syz-runtest/runtest.go +++ b/tools/syz-runtest/runtest.go @@ -188,7 +188,8 @@ func (mgr *Manager) boot(name string, index int) (*report.Report, error) { Test: false, Runtest: true, Optional: &instance.OptionalFuzzerArgs{ - Slowdown: mgr.cfg.Timeouts.Slowdown, + Slowdown: mgr.cfg.Timeouts.Slowdown, + SandboxArg: mgr.cfg.SandboxArg, }, } cmd := instance.FuzzerCmd(args) diff --git a/tools/syz-testbuild/testbuild.go b/tools/syz-testbuild/testbuild.go index 961fb2e4c..9fe1dd3f1 100644 --- a/tools/syz-testbuild/testbuild.go +++ b/tools/syz-testbuild/testbuild.go @@ -49,6 +49,7 @@ var ( flagBisectBin = flag.String("bisect_bin", "", "path to bisection binaries") flagSyzkaller = flag.String("syzkaller", ".", "path to built syzkaller") flagSandbox = flag.String("sandbox", "namespace", "sandbox to use for testing") + flagSandboxArg = flag.Int("sandbox_arg", 0, "an argument for sandbox runner") ) const ( @@ -68,18 +69,19 @@ func main() { } defer os.RemoveAll(dir) cfg := &mgrconfig.Config{ - RawTarget: *flagOS + "/" + *flagArch, - HTTP: ":0", - Workdir: dir, - KernelSrc: *flagKernelSrc, - KernelObj: *flagKernelSrc, - Syzkaller: *flagSyzkaller, - Sandbox: *flagSandbox, - SSHUser: "root", - Procs: 1, - Cover: false, - Type: vmType, - VM: json.RawMessage([]byte(fmt.Sprintf(`{ "count": %v, "cpu": 2, "mem": 2048 }`, numTests))), + RawTarget: *flagOS + "/" + *flagArch, + HTTP: ":0", + Workdir: dir, + KernelSrc: *flagKernelSrc, + KernelObj: *flagKernelSrc, + Syzkaller: *flagSyzkaller, + Sandbox: *flagSandbox, + SandboxArg: *flagSandboxArg, + SSHUser: "root", + Procs: 1, + Cover: false, + Type: vmType, + VM: json.RawMessage([]byte(fmt.Sprintf(`{ "count": %v, "cpu": 2, "mem": 2048 }`, numTests))), Derived: mgrconfig.Derived{ TargetOS: *flagOS, TargetArch: *flagArch, -- cgit mrf-deployment