aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-10-20 11:17:22 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-10-23 09:59:39 +0200
commit6755f62592cfd0ee124c3e48b0bbb375cdd5e857 (patch)
treee43299ef4c1f33627d3ae9802008623dc28e7bf6
parent9b5612df77394bdc3b094b63e93ab4bbf7930aaa (diff)
syz-fuzzer: fix manager polling
We need to always poll manager to send stats/maxsignal, we just need not request candidates if we have plenty of work.
-rw-r--r--pkg/rpctype/rpctype.go7
-rw-r--r--syz-fuzzer/fuzzer.go13
-rw-r--r--syz-manager/manager.go10
3 files changed, 18 insertions, 12 deletions
diff --git a/pkg/rpctype/rpctype.go b/pkg/rpctype/rpctype.go
index efe9e4c1d..e3a9531d6 100644
--- a/pkg/rpctype/rpctype.go
+++ b/pkg/rpctype/rpctype.go
@@ -51,9 +51,10 @@ type NewInputArgs struct {
}
type PollArgs struct {
- Name string
- MaxSignal []uint32
- Stats map[string]uint64
+ Name string
+ NeedCandidates bool
+ MaxSignal []uint32
+ Stats map[string]uint64
}
type PollRes struct {
diff --git a/syz-fuzzer/fuzzer.go b/syz-fuzzer/fuzzer.go
index 14a32f900..c5b35822d 100644
--- a/syz-fuzzer/fuzzer.go
+++ b/syz-fuzzer/fuzzer.go
@@ -346,15 +346,16 @@ func main() {
}
if poll || time.Since(lastPoll) > 10*time.Second {
triageMu.RLock()
- if len(candidates) > *flagProcs {
- triageMu.RUnlock()
+ needCandidates := len(candidates) < *flagProcs
+ triageMu.RUnlock()
+ if !needCandidates && poll {
continue
}
- triageMu.RUnlock()
a := &PollArgs{
- Name: *flagName,
- Stats: make(map[string]uint64),
+ Name: *flagName,
+ NeedCandidates: needCandidates,
+ Stats: make(map[string]uint64),
}
signalMu.Lock()
a.MaxSignal = make([]uint32, 0, len(newSignal))
@@ -390,6 +391,8 @@ func main() {
if err := manager.Call("Manager.Poll", a, r); err != nil {
panic(err)
}
+ Logf(1, "poll: candidates=%v inputs=%v signal=%v",
+ len(r.Candidates), len(r.NewInputs), len(r.MaxSignal))
if len(r.MaxSignal) != 0 {
signalMu.Lock()
for _, s := range r.MaxSignal {
diff --git a/syz-manager/manager.go b/syz-manager/manager.go
index 68adcdf62..2af810f78 100644
--- a/syz-manager/manager.go
+++ b/syz-manager/manager.go
@@ -996,10 +996,12 @@ func (mgr *Manager) Poll(a *PollArgs, r *PollRes) error {
f.inputs = nil
}
- for i := 0; i < mgr.cfg.Procs && len(mgr.candidates) > 0; i++ {
- last := len(mgr.candidates) - 1
- r.Candidates = append(r.Candidates, mgr.candidates[last])
- mgr.candidates = mgr.candidates[:last]
+ if a.NeedCandidates {
+ for i := 0; i < mgr.cfg.Procs && len(mgr.candidates) > 0; i++ {
+ last := len(mgr.candidates) - 1
+ r.Candidates = append(r.Candidates, mgr.candidates[last])
+ mgr.candidates = mgr.candidates[:last]
+ }
}
if len(mgr.candidates) == 0 {
mgr.candidates = nil