aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-diff/diff.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2024-11-05 17:33:59 +0100
committerAleksandr Nogikh <nogikh@google.com>2024-11-13 10:32:10 +0000
commit5ad1a162959d6df7712dc93cffe128322b11d7af (patch)
treec9da9e418df1605fff5eb07d6f90a74a9bee4e6b /tools/syz-diff/diff.go
parent8acebd3f596375b3c8c34ee8f9000a344064295a (diff)
pkg/repro: accept a cancellable context
Refactor pkg/repro to accept a context.Context object. This will make it look more similar to other package interfaces and will eventually let us abort currently running repro jobs without having to shut down the whole application. Simplify the code by factoring out the parameters common both to RunSyzRepro() and RunCRepro().
Diffstat (limited to 'tools/syz-diff/diff.go')
-rw-r--r--tools/syz-diff/diff.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/syz-diff/diff.go b/tools/syz-diff/diff.go
index c3da6c8ec..6549aed70 100644
--- a/tools/syz-diff/diff.go
+++ b/tools/syz-diff/diff.go
@@ -207,8 +207,13 @@ func (dc *diffContext) RunRepro(crash *manager.Crash) *manager.ReproResult {
dc.reproAttempts[crash.Title]++
dc.mu.Unlock()
- res, stats, err := repro.Run(crash.Output, dc.new.cfg, dc.new.features,
- dc.new.reporter, dc.new.pool, repro.Fast)
+ res, stats, err := repro.Run(context.Background(), crash.Output, repro.Environment{
+ Config: dc.new.cfg,
+ Features: dc.new.features,
+ Reporter: dc.new.reporter,
+ Pool: dc.new.pool,
+ Fast: true,
+ })
if res != nil && res.Report != nil {
dc.mu.Lock()
dc.reproAttempts[res.Report.Title] = maxReproAttempts
@@ -474,8 +479,11 @@ func (rr *reproRunner) Run(r *repro.Result) {
if err != nil {
return
}
- result, err = ret.RunSyzProg(r.Prog.Serialize(), max(r.Duration, time.Minute), opts,
- instance.SyzExitConditions)
+ result, err = ret.RunSyzProg(instance.ExecParams{
+ SyzProg: r.Prog.Serialize(),
+ Duration: max(r.Duration, time.Minute),
+ Opts: opts,
+ })
})
crashed := result != nil && result.Report != nil
log.Logf(1, "attempt #%d to run %q on base: crashed=%v", i, ret.originalTitle, crashed)