aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/fuzzer/queue/queue.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/fuzzer/queue/queue.go')
-rw-r--r--pkg/fuzzer/queue/queue.go27
1 files changed, 26 insertions, 1 deletions
diff --git a/pkg/fuzzer/queue/queue.go b/pkg/fuzzer/queue/queue.go
index 46df9d234..051f7205e 100644
--- a/pkg/fuzzer/queue/queue.go
+++ b/pkg/fuzzer/queue/queue.go
@@ -37,7 +37,6 @@ type Request struct {
// Options needed by runtest.
BinaryFile string // If set, it's executed instead of Prog.
- Repeat int // Repeats in addition to the first run.
// Important requests will be retried even from crashed VMs.
Important bool
@@ -113,6 +112,11 @@ func (r *Request) Validate() error {
if (collectComps) && (collectSignal || collectCover) {
return fmt.Errorf("hint collection is mutually exclusive with signal/coverage")
}
+ sandboxes := flatrpc.ExecEnvSandboxNone | flatrpc.ExecEnvSandboxSetuid |
+ flatrpc.ExecEnvSandboxNamespace | flatrpc.ExecEnvSandboxAndroid
+ if r.BinaryFile == "" && r.ExecOpts.EnvFlags&sandboxes == 0 {
+ return fmt.Errorf("no sandboxes set")
+ }
return nil
}
@@ -415,3 +419,24 @@ func (d *Deduplicator) onDone(req *Request, res *Result) bool {
}
return true
}
+
+// DefaultOpts applies opts to all requests in source.
+func DefaultOpts(source Source, opts flatrpc.ExecOpts) Source {
+ return &defaultOpts{source, opts}
+}
+
+type defaultOpts struct {
+ source Source
+ opts flatrpc.ExecOpts
+}
+
+func (do *defaultOpts) Next() *Request {
+ req := do.source.Next()
+ if req == nil {
+ return nil
+ }
+ req.ExecOpts.ExecFlags |= do.opts.ExecFlags
+ req.ExecOpts.EnvFlags |= do.opts.EnvFlags
+ req.ExecOpts.SandboxArg = do.opts.SandboxArg
+ return req
+}