diff options
| author | Andrey Konovalov <andreyknvl@google.com> | 2019-02-05 16:19:34 +0100 |
|---|---|---|
| committer | Andrey Konovalov <andreyknvl@gmail.com> | 2019-03-05 14:30:10 +0100 |
| commit | dfd609eca1871f01757d6b04b19fc273c87c14e5 (patch) | |
| tree | bd16e4561775f52e40f970a35a032f1f390171a9 /pkg/repro | |
| parent | c55829aef16e95df564cb23e700e5de8490229a0 (diff) | |
execprog, stress, prog2c: unify flags to enable additional features
This change makes all syz-execprog, syz-prog2c and syz-stress accept
-enable and -disable flags to enable or disable additional features
(tun, net_dev, net_reset, cgroups and binfmt_misc) instead of having
a separate flag for each of them.
The default (without any flags) behavior isn't changed: syz-execprog
and syz-stress enabled all the features (provided the runtime supports
them) and syz-prog2c disables all of them.
Diffstat (limited to 'pkg/repro')
| -rw-r--r-- | pkg/repro/repro.go | 26 | ||||
| -rw-r--r-- | pkg/repro/repro_test.go | 24 |
2 files changed, 29 insertions, 21 deletions
diff --git a/pkg/repro/repro.go b/pkg/repro/repro.go index ab91e545a..2c6a0e6ed 100644 --- a/pkg/repro/repro.go +++ b/pkg/repro/repro.go @@ -777,7 +777,7 @@ var progSimplifies = []Simplify{ } opts.Repeat = false opts.EnableCgroups = false - opts.ResetNet = false + opts.EnableNetReset = false opts.Procs = 1 return true }, @@ -804,9 +804,10 @@ var cSimplifies = append(progSimplifies, []Simplify{ } opts.Sandbox = "" opts.EnableTun = false + opts.EnableNetDev = false + opts.EnableNetReset = false opts.EnableCgroups = false - opts.EnableNetdev = false - opts.ResetNet = false + opts.EnableBinfmtMisc = false return true }, func(opts *csource.Options) bool { @@ -817,24 +818,31 @@ var cSimplifies = append(progSimplifies, []Simplify{ return true }, func(opts *csource.Options) bool { - if !opts.EnableCgroups { + if !opts.EnableNetDev { return false } - opts.EnableCgroups = false + opts.EnableNetDev = false return true }, func(opts *csource.Options) bool { - if !opts.EnableNetdev { + if !opts.EnableNetReset { return false } - opts.EnableNetdev = false + opts.EnableNetReset = false + return true + }, + func(opts *csource.Options) bool { + if !opts.EnableCgroups { + return false + } + opts.EnableCgroups = false return true }, func(opts *csource.Options) bool { - if !opts.ResetNet { + if !opts.EnableBinfmtMisc { return false } - opts.ResetNet = false + opts.EnableBinfmtMisc = false return true }, func(opts *csource.Options) bool { diff --git a/pkg/repro/repro_test.go b/pkg/repro/repro_test.go index 349b412fc..c417b7416 100644 --- a/pkg/repro/repro_test.go +++ b/pkg/repro/repro_test.go @@ -73,18 +73,18 @@ func TestBisect(t *testing.T) { func TestSimplifies(t *testing.T) { opts := csource.Options{ - Threaded: true, - Collide: true, - Repeat: true, - Procs: 10, - Sandbox: "namespace", - EnableTun: true, - EnableCgroups: true, - EnableNetdev: true, - ResetNet: true, - UseTmpDir: true, - HandleSegv: true, - Repro: true, + Threaded: true, + Collide: true, + Repeat: true, + Procs: 10, + Sandbox: "namespace", + EnableTun: true, + EnableNetDev: true, + EnableNetReset: true, + EnableCgroups: true, + UseTmpDir: true, + HandleSegv: true, + Repro: true, } var check func(opts csource.Options, i int) check = func(opts csource.Options, i int) { |
