diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2021-12-01 17:25:40 +0000 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2021-12-10 12:30:07 +0100 |
| commit | 18f846ca807cfc6df9c3da3c0ab08251277dfefb (patch) | |
| tree | e14f783b914409f21ae77a01a6b74ededaba6901 /prog/collide.go | |
| parent | 52c8379f77b5f292e2d527c66dfe17a899381d20 (diff) | |
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.
Diffstat (limited to 'prog/collide.go')
| -rw-r--r-- | prog/collide.go | 16 |
1 files changed, 16 insertions, 0 deletions
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++ + } +} |
