aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/fuzzer/queue/queue.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2024-05-14 16:52:34 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-05-16 15:38:27 +0000
commit086ab166bbbf17d3f0a16c8b27f1995a70908b35 (patch)
tree1062586c30bfc16aa5a7629cd4314cf7345da197 /pkg/fuzzer/queue/queue.go
parent1cf9be9327cbff5ed11e2106e362039f09aaed7c (diff)
pkg/fuzzer/queue: retry inputs from crashed VMs
Mark some requests as Important. The Retry() layer will give them one more chance even if they were not executed due to a VM crash. For now, the only important requests are related to triage, candidates and pkg/vminfo tests. Add tests for retry.go.
Diffstat (limited to 'pkg/fuzzer/queue/queue.go')
-rw-r--r--pkg/fuzzer/queue/queue.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/fuzzer/queue/queue.go b/pkg/fuzzer/queue/queue.go
index 14d4ace78..48b912846 100644
--- a/pkg/fuzzer/queue/queue.go
+++ b/pkg/fuzzer/queue/queue.go
@@ -40,11 +40,16 @@ type Request struct {
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
+
// The callback will be called on request completion in the LIFO order.
// If it returns false, all further processing will be stopped.
// It allows wrappers to intercept Done() requests.
callback DoneCallback
+ onceCrashed bool
+
mu sync.Mutex
result *Result
done chan struct{}
@@ -91,6 +96,11 @@ func (r *Request) Wait(ctx context.Context) *Result {
}
}
+// Risky() returns true if there's a substantial risk of the input crashing the VM.
+func (r *Request) Risky() bool {
+ return r.onceCrashed
+}
+
func (r *Request) hash() hash.Sig {
buf := new(bytes.Buffer)
if r.ExecOpts != nil {