Skip to content

Commit 8ef9f65

Browse files
committed
syz-verifier: refactor fuzzingLoop into smaller helper functions
Split the large fuzzingLoop function into focused helpers to improve readability and maintainability: - fetchNextRequest: handle request retrieval with context cancellation - isDistributableRequest: check if request should be compared across kernels - buildRequestCopies: construct kernel-specific request copies with callbacks - dispatchAndCollect: submit requests to all kernels and collect results The main fuzzing loop is now cleaner with clear separation of concerns: fetch → filter → build → dispatch → feedback → compare. No functional changes, purely refactoring for code clarity.
1 parent bc33237 commit 8ef9f65

File tree

3 files changed

+311
-340
lines changed

3 files changed

+311
-340
lines changed

syz-verifier/README.md

Lines changed: 0 additions & 93 deletions
This file was deleted.

syz-verifier/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ func Setup(name string, cfg *mgrconfig.Config, debug bool) (*Kernel, error) {
5050
return nil, fmt.Errorf("failed to create reporter for %q: %w", name, err)
5151
}
5252

53-
// Enforce deterministic execution for verifier
5453
cfg.Experimental.ResetAccState = true // executor process restarts between program executions to clear accumulated kernel/VM stat.
55-
//cfg.Procs = 1 // No parallel processes execution. When enabled slows down execution significantly.
5654

5755
kernel.serv, err = rpcserver.New(&rpcserver.RemoteConfig{
5856
Config: cfg,
@@ -81,16 +79,18 @@ func main() {
8179
// flagReruns := flag.Int("rerun", 3, "number of time program is rerun when a mismatch is found")
8280
flag.Parse()
8381

84-
kernels := make(map[int]*Kernel)
82+
kernels := make([]*Kernel, len(cfgs))
8583
for idx, cfg := range cfgs {
8684
kcfg, err := mgrconfig.LoadFile(cfg)
8785
if err != nil {
8886
log.Fatalf("%v", err)
8987
}
90-
kernels[idx], err = Setup(kcfg.Name, kcfg, *flagDebug)
88+
kernel, err := Setup(kcfg.Name, kcfg, *flagDebug)
9189
if err != nil {
9290
log.Fatalf("failed to setup kcfg context for %s: %v", kcfg.Name, err)
9391
}
92+
kernel.id = idx
93+
kernels[idx] = kernel
9494

9595
log.Logf(0, "loaded kernel %s", kcfg.Name)
9696
}

0 commit comments

Comments
 (0)