From 18f846ca807cfc6df9c3da3c0ab08251277dfefb Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Wed, 1 Dec 2021 17:25:40 +0000 Subject: all: add the `rerun` call property To be able to collide specific syscalls more precisely, we need to repeat the process many times. Introduce the `rerun` call property, which instructs `syz-executor` to repeat the call the specified number of times. The intended use is: call1() (rerun: 100, async) call2() (rerun: 100) For now, assign rerun values randomly to consecutive pairs of calls, where the first one is async. --- prog/collide.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'prog/collide.go') diff --git a/prog/collide.go b/prog/collide.go index cd059c60f..77065147f 100644 --- a/prog/collide.go +++ b/prog/collide.go @@ -55,3 +55,19 @@ func AssignRandomAsync(origProg *Prog, rand *rand.Rand) *Prog { return prog } + +var rerunSteps = []int{32, 64} + +func AssignRandomRerun(prog *Prog, rand *rand.Rand) { + for i := 0; i+1 < len(prog.Calls); i++ { + if !prog.Calls[i].Props.Async || rand.Intn(4) != 0 { + continue + } + // We assign rerun to consecutive pairs of calls, where the first call is async. + // TODO: consider assigning rerun also to non-collided progs. + rerun := rerunSteps[rand.Intn(len(rerunSteps))] + prog.Calls[i].Props.Rerun = rerun + prog.Calls[i+1].Props.Rerun = rerun + i++ + } +} -- cgit mrf-deployment