diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-04-02 12:58:03 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-04-02 20:09:26 +0200 |
| commit | 188daeb272ed7795067cffd32b11e5358ac9b696 (patch) | |
| tree | 87cee7f8e998f70c6f37d71ceb25f3e1039bee16 | |
| parent | dc88925771c47ef787f6f3a7b6756b8f0ce40af5 (diff) | |
syz-manager: show what crashes are currently being reproduced
| -rw-r--r-- | syz-manager/html.go | 17 | ||||
| -rw-r--r-- | syz-manager/manager.go | 8 |
2 files changed, 20 insertions, 5 deletions
diff --git a/syz-manager/html.go b/syz-manager/html.go index c71034752..8efcb0939 100644 --- a/syz-manager/html.go +++ b/syz-manager/html.go @@ -57,7 +57,7 @@ func (mgr *Manager) httpSummary(w http.ResponseWriter, r *http.Request) { } var err error - if data.Crashes, err = collectCrashes(mgr.cfg.Workdir); err != nil { + if data.Crashes, err = mgr.collectCrashes(mgr.cfg.Workdir); err != nil { http.Error(w, fmt.Sprintf("failed to collect crashes: %v", err), http.StatusInternalServerError) return } @@ -137,7 +137,7 @@ func (mgr *Manager) collectSummary(data *UISummaryData) (map[string]*CallCov, er func (mgr *Manager) httpCrash(w http.ResponseWriter, r *http.Request) { crashID := r.FormValue("id") - crash := readCrash(mgr.cfg.Workdir, crashID, true) + crash := readCrash(mgr.cfg.Workdir, crashID, nil, true) if crash == nil { http.Error(w, fmt.Sprintf("failed to read crash info"), http.StatusInternalServerError) return @@ -323,7 +323,12 @@ func (mgr *Manager) httpRawCover(w http.ResponseWriter, r *http.Request) { buf.Flush() } -func collectCrashes(workdir string) ([]*UICrashType, error) { +func (mgr *Manager) collectCrashes(workdir string) ([]*UICrashType, error) { + // Note: mu is not locked here. + reproReply := make(chan map[string]bool) + mgr.reproRequest <- reproReply + repros := <-reproReply + crashdir := filepath.Join(workdir, "crashes") dirs, err := osutil.ListDir(crashdir) if err != nil { @@ -331,7 +336,7 @@ func collectCrashes(workdir string) ([]*UICrashType, error) { } var crashTypes []*UICrashType for _, dir := range dirs { - crash := readCrash(workdir, dir, false) + crash := readCrash(workdir, dir, repros, false) if crash != nil { crashTypes = append(crashTypes, crash) } @@ -340,7 +345,7 @@ func collectCrashes(workdir string) ([]*UICrashType, error) { return crashTypes, nil } -func readCrash(workdir, dir string, full bool) *UICrashType { +func readCrash(workdir, dir string, repros map[string]bool, full bool) *UICrashType { if len(dir) != 40 { return nil } @@ -415,6 +420,8 @@ func readCrash(workdir, dir string, full bool) *UICrashType { } else { triaged = "has repro" } + } else if repros[string(desc)] { + triaged = "reproducing" } else if reproAttempts >= maxReproAttempts { triaged = "non-reproducible" } diff --git a/syz-manager/manager.go b/syz-manager/manager.go index f377318a1..3177e909a 100644 --- a/syz-manager/manager.go +++ b/syz-manager/manager.go @@ -82,6 +82,7 @@ type Manager struct { hubCorpus map[hash.Sig]bool needMoreRepros chan chan bool hubReproQueue chan *Crash + reproRequest chan chan map[string]bool // For checking that files that we are using are not changing under us. // Maps file name to modification time. @@ -180,6 +181,7 @@ func RunManager(cfg *mgrconfig.Config, target *prog.Target, syscalls map[int]boo vmStop: make(chan bool), hubReproQueue: make(chan *Crash, 10), needMoreRepros: make(chan chan bool), + reproRequest: make(chan chan map[string]bool), usedFiles: make(map[string]time.Time), } @@ -526,6 +528,12 @@ func (mgr *Manager) vmLoop() { case reply := <-mgr.needMoreRepros: reply <- phase >= phaseTriagedHub && len(reproQueue)+len(pendingRepro)+len(reproducing) == 0 + case reply := <-mgr.reproRequest: + repros := make(map[string]bool) + for title := range reproducing { + repros[title] = true + } + reply <- repros } } } |
