aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
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 /pkg
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 'pkg')
-rw-r--r--pkg/manager/diff.go6
-rw-r--r--pkg/manager/diff_store.go37
2 files changed, 40 insertions, 3 deletions
diff --git a/pkg/manager/diff.go b/pkg/manager/diff.go
index d0cb33aa3..379fd246c 100644
--- a/pkg/manager/diff.go
+++ b/pkg/manager/diff.go
@@ -39,6 +39,7 @@ import (
type DiffFuzzerConfig struct {
Debug bool
PatchedOnly chan *UniqueBug
+ Store *DiffFuzzerStore
ArtifactsDir string // Where to store the artifacts that supplement the logs.
// The fuzzer waits no more than MaxTriageTime time until it starts taking VMs away
// for bug reproduction.
@@ -82,13 +83,12 @@ func RunDiffFuzzer(ctx context.Context, baseCfg, newCfg *mgrconfig.Config, cfg D
base.source = stream
new.duplicateInto = stream
- store := &DiffFuzzerStore{BasePath: cfg.ArtifactsDir}
diffCtx := &diffContext{
cfg: cfg,
doneRepro: make(chan *ReproResult),
base: base,
new: new,
- store: store,
+ store: cfg.Store,
reproAttempts: map[string]int{},
patchedOnly: cfg.PatchedOnly,
}
@@ -96,7 +96,7 @@ func RunDiffFuzzer(ctx context.Context, baseCfg, newCfg *mgrconfig.Config, cfg D
diffCtx.http = &HTTPServer{
Cfg: newCfg,
StartTime: time.Now(),
- DiffStore: store,
+ DiffStore: cfg.Store,
Pools: map[string]*vm.Dispatcher{
new.name: new.pool,
base.name: base.pool,
diff --git a/pkg/manager/diff_store.go b/pkg/manager/diff_store.go
index 76e2b97ff..2fb7d7f19 100644
--- a/pkg/manager/diff_store.go
+++ b/pkg/manager/diff_store.go
@@ -4,9 +4,12 @@
package manager
import (
+ "bytes"
"fmt"
"path/filepath"
+ "sort"
"sync"
+ "text/tabwriter"
"time"
"github.com/google/syzkaller/pkg/log"
@@ -116,6 +119,40 @@ func (s *DiffFuzzerStore) List() []DiffBug {
return list
}
+func (s *DiffFuzzerStore) PlainTextDump() []byte {
+ list := s.List()
+ sort.Slice(list, func(i, j int) bool {
+ // Put patched-only on top, otherwise sort by the title.
+ first, second := list[i].PatchedOnly(), list[j].PatchedOnly()
+ if first != second {
+ return first
+ }
+ return list[i].Title < list[j].Title
+ })
+ var buf bytes.Buffer
+ w := tabwriter.NewWriter(&buf, 0, 0, 1, ' ', 0)
+ fmt.Fprintln(w, "Title\tOn-Base\tOn-Patched")
+
+ printInfo := func(info *DiffBugInfo) {
+ if info.Crashes > 0 {
+ fmt.Fprintf(w, "%d crashes", info.Crashes)
+ }
+ if info.Repro != "" {
+ fmt.Fprintf(w, "[reproduced]")
+ }
+ }
+
+ for _, item := range list {
+ fmt.Fprintf(w, "%s\t", item.Title)
+ printInfo(&item.Base)
+ fmt.Fprintf(w, "\t")
+ printInfo(&item.Patched)
+ fmt.Fprintf(w, "\n")
+ }
+ w.Flush()
+ return buf.Bytes()
+}
+
func (s *DiffFuzzerStore) saveFile(title, name string, data []byte) string {
hash := crashHash(title)
path := filepath.Join(s.BasePath, "crashes", hash)