diff options
| author | Grigory Bazilevich <g.bazilevich@ispras.ru> | 2026-03-11 09:45:28 +0300 |
|---|---|---|
| committer | Grigory Bazilevich <g.bazilevich@ispras.ru> | 2026-03-11 09:46:11 +0300 |
| commit | 9eca1358882afaf2fca59c50686db1b8ef681850 (patch) | |
| tree | 53ca099978e6015cbed409922219a229ce2814e7 | |
| parent | 3fe1aeddbc74e43e8561db61cdaad620c5993d92 (diff) | |
syz-manager: information about probability-only inputs in db
| -rw-r--r-- | pkg/db/db.go | 1 | ||||
| -rw-r--r-- | pkg/fuzzer/fuzzer.go | 5 | ||||
| -rw-r--r-- | pkg/manager/seeds.go | 11 | ||||
| -rw-r--r-- | syz-manager/manager.go | 7 |
4 files changed, 19 insertions, 5 deletions
diff --git a/pkg/db/db.go b/pkg/db/db.go index 3007a8774..5a3d8f539 100644 --- a/pkg/db/db.go +++ b/pkg/db/db.go @@ -169,6 +169,7 @@ const ( recMagic = uint32(0xfee1bad) curVersion = uint32(2) seqDeleted = ^uint64(0) + SeqProb = ^uint64(1) ) func serializeHeader(w *bytes.Buffer, version uint64) { diff --git a/pkg/fuzzer/fuzzer.go b/pkg/fuzzer/fuzzer.go index 3241cb63a..02c5cda08 100644 --- a/pkg/fuzzer/fuzzer.go +++ b/pkg/fuzzer/fuzzer.go @@ -360,8 +360,9 @@ const ( ) type Candidate struct { - Prog *prog.Prog - Flags ProgFlags + Prog *prog.Prog + Flags ProgFlags + ProbOnly bool } func (fuzzer *Fuzzer) AddCandidates(candidates []Candidate) { diff --git a/pkg/manager/seeds.go b/pkg/manager/seeds.go index f17c36ecb..b2a288054 100644 --- a/pkg/manager/seeds.go +++ b/pkg/manager/seeds.go @@ -12,6 +12,7 @@ import ( "os" "path/filepath" "runtime" + "sort" "strings" "sync" "time" @@ -79,8 +80,9 @@ func LoadSeeds(cfg *mgrconfig.Config, immutable bool) (Seeds, error) { flags = fuzzer.ProgMinimized } candidates = append(candidates, fuzzer.Candidate{ - Prog: inp.Prog, - Flags: flags, + Prog: inp.Prog, + Flags: flags, + ProbOnly: inp.Seq == db.SeqProb, }) } if err := <-chErr; err != nil { @@ -101,6 +103,9 @@ func LoadSeeds(cfg *mgrconfig.Config, immutable bool) (Seeds, error) { return Seeds{}, fmt.Errorf("failed to save corpus database: %w", err) } } + sort.SliceStable(candidates, func(i, j int) bool { + return !candidates[i].ProbOnly && candidates[j].ProbOnly + }) // Switch database to the mode when it does not keep records in memory. // We don't need them anymore and they consume lots of memory. info.CorpusDB.DiscardData() @@ -111,6 +116,7 @@ func LoadSeeds(cfg *mgrconfig.Config, immutable bool) (Seeds, error) { type input struct { IsSeed bool Key string + Seq uint64 Path string Data []byte Prog *prog.Prog @@ -138,6 +144,7 @@ func readInputs(cfg *mgrconfig.Config, db *db.DB, output chan *input) error { for key, rec := range db.Records { inputs <- &input{ Key: key, + Seq: rec.Seq, Data: rec.Val, } } diff --git a/syz-manager/manager.go b/syz-manager/manager.go index ed985c2fc..77ad2a127 100644 --- a/syz-manager/manager.go +++ b/syz-manager/manager.go @@ -411,6 +411,7 @@ func (mgr *Manager) heartbeatLoop() { for _, stat := range stat.Collect(stat.Console) { fmt.Fprintf(buf, "%v=%v ", stat.Name, stat.Value) } + fmt.Fprintf(buf, "%v=%v ", "lastMinCorpus", mgr.lastMinCorpus) log.Logf(0, "%s", buf.String()) } } @@ -993,8 +994,12 @@ func (mgr *Manager) corpusInputHandler(updates <-chan corpus.NewItemEvent) { // We only save new progs into the corpus.db file. continue } + var seq uint64 = 0 + if update.ProbOnly { + seq = db.SeqProb + } mgr.corpusDBMu.Lock() - mgr.corpusDB.Save(update.Sig, update.ProgData, 0) + mgr.corpusDB.Save(update.Sig, update.ProgData, seq) if err := mgr.corpusDB.Flush(); err != nil { log.Errorf("failed to save corpus database: %v", err) } |
