Skip to content
Permalink
Browse files

syz-fuzzer: fix retry logic on executor failures

I guess the condition was always meant to be "!ok || try > 10".
So we always ignored non-executor failures, and failed on executor ones.
I think now it's better to just retry always. If the error is something
persistent we will fail after 10 tries anyway.
  • Loading branch information...
dvyukov committed Sep 19, 2018
1 parent 5f78ab4 commit 8eb14a0057bd21ffe60a8a8935c17b81f18a6348
Showing with 19 additions and 20 deletions.
  1. +19 −20 syz-fuzzer/proc.go
@@ -259,28 +259,27 @@ func (proc *Proc) executeRaw(opts *ipc.ExecOpts, p *prog.Prog, stat Stat) []ipc.
defer proc.fuzzer.gate.Leave(ticket)

proc.logProgram(opts, p)
try := 0
retry:
atomic.AddUint64(&proc.fuzzer.stats[stat], 1)
output, info, failed, hanged, err := proc.env.Exec(opts, p)
if failed {
// BUG in output should be recognized by manager.
log.Logf(0, "BUG: executor-detected bug:\n%s", output)
// Don't return any cover so that the input is not added to corpus.
return nil
}
if err != nil {
if _, ok := err.(ipc.ExecutorFailure); ok || try > 10 {
log.Fatalf("executor %v failed %v times:\n%v", proc.pid, try, err)
for try := 0; ; try++ {
atomic.AddUint64(&proc.fuzzer.stats[stat], 1)
output, info, failed, hanged, err := proc.env.Exec(opts, p)
if failed {
// BUG in output should be recognized by manager.
log.Logf(0, "BUG: executor-detected bug:\n%s", output)
// Don't return any cover so that the input is not added to corpus.
return nil
}
if err != nil {
if try > 10 {
log.Fatalf("executor %v failed %v times:\n%v", proc.pid, try, err)
}
log.Logf(4, "fuzzer detected executor failure='%v', retrying #%d", err, try+1)
debug.FreeOSMemory()
time.Sleep(time.Second)
continue
}
try++
log.Logf(4, "fuzzer detected executor failure='%v', retrying #%d\n", err, (try + 1))
debug.FreeOSMemory()
time.Sleep(time.Second)
goto retry
log.Logf(2, "result failed=%v hanged=%v: %s\n", failed, hanged, output)
return info
}
log.Logf(2, "result failed=%v hanged=%v: %s\n", failed, hanged, output)
return info
}

func (proc *Proc) logProgram(opts *ipc.ExecOpts, p *prog.Prog) {

0 comments on commit 8eb14a0

Please sign in to comment.
You can’t perform that action at this time.