aboutsummaryrefslogtreecommitdiffstats
path: root/syz-cluster/workflow
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2025-04-15 15:40:27 +0200
committerAleksandr Nogikh <nogikh@google.com>2025-04-15 15:55:41 +0000
commit72b08b89bcde266d8ec4abc77b01fcc0cc95bea0 (patch)
treeee5a42e0a60dbd7753aa272a83b77e52db6a8dba /syz-cluster/workflow
parent2197b25c207a81e893d3ac531c1bf215d8ee442d (diff)
pkg/manager: provide diff fuzzer state dumps
Make the fuzzing step of syz-cluster create the manager.DiffStore object explicitly and dump its state to the logs after finishing the fuzzing session.
Diffstat (limited to 'syz-cluster/workflow')
-rw-r--r--syz-cluster/workflow/fuzz-step/main.go25
1 files changed, 14 insertions, 11 deletions
diff --git a/syz-cluster/workflow/fuzz-step/main.go b/syz-cluster/workflow/fuzz-step/main.go
index 05b145554..9120ff3cd 100644
--- a/syz-cluster/workflow/fuzz-step/main.go
+++ b/syz-cluster/workflow/fuzz-step/main.go
@@ -53,30 +53,33 @@ func main() {
log.Fatalf("the binary is built without the git revision information")
}
ctx := context.Background()
- if err := reportStatus(ctx, client, api.TestRunning, ""); err != nil {
+ if err := reportStatus(ctx, client, api.TestRunning, nil); err != nil {
app.Fatalf("failed to report the test: %v", err)
}
artifactsDir := filepath.Join(*flagWorkdir, "artifacts")
osutil.MkdirAll(artifactsDir)
+ store := &manager.DiffFuzzerStore{BasePath: artifactsDir}
// We want to only cancel the run() operation in order to be able to also report
// the final test result back.
runCtx, cancel := context.WithTimeout(context.Background(), d)
defer cancel()
- err = run(runCtx, client, d, artifactsDir)
+ err = run(runCtx, client, d, store)
status := api.TestPassed // TODO: what about TestFailed?
if err != nil && !errors.Is(err, context.DeadlineExceeded) {
app.Errorf("the step failed: %v", err)
status = api.TestError
}
log.Logf(0, "fuzzing is finished")
- if err := reportStatus(ctx, client, status, artifactsDir); err != nil {
+ log.Logf(0, "status at the end:\n%s", store.PlainTextDump())
+ if err := reportStatus(ctx, client, status, store); err != nil {
app.Fatalf("failed to update the test: %v", err)
}
}
-func run(baseCtx context.Context, client *api.Client, timeout time.Duration, artifactsDir string) error {
+func run(baseCtx context.Context, client *api.Client, timeout time.Duration,
+ store *manager.DiffFuzzerStore) error {
series, err := client.GetSessionSeries(baseCtx, *flagSession)
if err != nil {
return fmt.Errorf("failed to query the series info: %w", err)
@@ -128,7 +131,7 @@ func run(baseCtx context.Context, client *api.Client, timeout time.Duration, art
return manager.RunDiffFuzzer(ctx, base, patched, manager.DiffFuzzerConfig{
Debug: false,
PatchedOnly: bugs,
- ArtifactsDir: artifactsDir,
+ Store: store,
MaxTriageTime: timeout / 2,
})
})
@@ -145,12 +148,12 @@ func run(baseCtx context.Context, client *api.Client, timeout time.Duration, art
return nil
case <-time.After(updatePeriod):
}
- artifacts := ""
+ var useStore *manager.DiffFuzzerStore
if time.Since(lastArtifactUpdate) > artifactUploadPeriod {
lastArtifactUpdate = time.Now()
- artifacts = artifactsDir
+ useStore = store
}
- err := reportStatus(ctx, client, api.TestRunning, artifacts)
+ err := reportStatus(ctx, client, api.TestRunning, useStore)
if err != nil {
app.Errorf("failed to update status: %v", err)
}
@@ -222,7 +225,7 @@ func loadConfigs(configFolder, configName string, complete bool) (*mgrconfig.Con
return base, patched, nil
}
-func reportStatus(ctx context.Context, client *api.Client, status, artifactsDir string) error {
+func reportStatus(ctx context.Context, client *api.Client, status string, store *manager.DiffFuzzerStore) error {
testResult := &api.TestResult{
SessionID: *flagSession,
TestName: testName,
@@ -235,10 +238,10 @@ func reportStatus(ctx context.Context, client *api.Client, status, artifactsDir
if err != nil {
return fmt.Errorf("failed to upload the status: %w", err)
}
- if artifactsDir == "" {
+ if store == nil {
return nil
}
- tarGzReader, err := compressArtifacts(artifactsDir)
+ tarGzReader, err := compressArtifacts(store.BasePath)
if err != nil {
return fmt.Errorf("failed to compress the artifacts dir: %w", err)
}