diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-08-09 13:11:14 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-08-09 15:41:52 +0200 |
| commit | 32e29dda2cf82b0dab7408bdef4c0af4d0a7fef8 (patch) | |
| tree | 90f6af0be34a3577fb661d6be059f1fedba4d73c /pkg/repro | |
| parent | 8b78527436f4171d1fbd1c44b1954b7807ec5ef4 (diff) | |
pkg/repro: fix invalid options minimization
Repro can generate Sandbox="namespace"/UseTmpDir=false.
This combination is broken for two reasons:
- on second and subsequent executions of the program,
it fails to create syz-tmp dir
- with Procs>1, it fails right away, because all procs
try to create syz-tmp dir
Don't generate such combination.
Diffstat (limited to 'pkg/repro')
| -rw-r--r-- | pkg/repro/repro.go | 2 | ||||
| -rw-r--r-- | pkg/repro/repro_test.go | 17 |
2 files changed, 12 insertions, 7 deletions
diff --git a/pkg/repro/repro.go b/pkg/repro/repro.go index 154812967..0b4581ffb 100644 --- a/pkg/repro/repro.go +++ b/pkg/repro/repro.go @@ -792,7 +792,7 @@ var cSimplifies = append(progSimplifies, []Simplify{ return true }, func(opts *csource.Options) bool { - if !opts.UseTmpDir { + if !opts.UseTmpDir || opts.Sandbox == "namespace" { return false } opts.UseTmpDir = false diff --git a/pkg/repro/repro_test.go b/pkg/repro/repro_test.go index 3334db770..e56e176aa 100644 --- a/pkg/repro/repro_test.go +++ b/pkg/repro/repro_test.go @@ -78,13 +78,18 @@ func TestSimplifies(t *testing.T) { WaitRepeat: true, Repro: true, } - if err := opts.Check(); err != nil { - t.Fatalf("initial opts are invalid: %v", err) - } - for i, fn := range cSimplifies { - fn(&opts) + var check func(opts csource.Options, i int) + check = func(opts csource.Options, i int) { if err := opts.Check(); err != nil { - t.Fatalf("opts %v are invalid: %v", i, err) + t.Fatalf("opts are invalid: %v", err) + } + if i == len(cSimplifies) { + return + } + check(opts, i+1) + if cSimplifies[i](&opts) { + check(opts, i+1) } } + check(opts, 0) } |
