diff options
| author | Tim Tianyang Chen <soapcn@gmail.com> | 2017-12-12 14:46:49 -0800 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-12-14 08:57:27 +0100 |
| commit | ac20b98c1b72fd433f573c383ec9460d672647e2 (patch) | |
| tree | dbef9d3ba8c68c4f7d04c49c319cd25c28b92c3c | |
| parent | ea8dc17ee971e915df1dc8fdd4683c2aafc7b53f (diff) | |
syz-manager: add simple email support
Users can specify an email address to reveive notifications when a
bug is discovered for the first time, without setting up a full fledged
dashboard. The supported mailer is mailx.
Signed-off-by: Tim Tianyang Chen <soapcn@gmail.com>
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | CONTRIBUTORS | 1 | ||||
| -rw-r--r-- | docs/configuration.md | 2 | ||||
| -rw-r--r-- | syz-manager/manager.go | 21 | ||||
| -rw-r--r-- | syz-manager/mgrconfig/mgrconfig.go | 2 |
5 files changed, 24 insertions, 3 deletions
@@ -15,3 +15,4 @@ Jean-Baptiste Cayrou Yuzhe Han Utkarsh Anand Tobias Klauser +Tim Tianyang Chen diff --git a/CONTRIBUTORS b/CONTRIBUTORS index c0656a5c3..c2680fffc 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -25,3 +25,4 @@ Yuzhe Han Thomas Garnier Utkarsh Anand Tobias Klauser +Tim Tianyang Chen diff --git a/docs/configuration.md b/docs/configuration.md index ed301267b..04c9ca1bf 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -6,6 +6,8 @@ invocation time with the `-config` option. This configuration can be based on t following keys in its top-level object: - `http`: URL that will display information about the running `syz-manager` process. + - `email_addr`: Optional email address to receive notifications when bugs are encountered for the first time. + Mailx is the only supported mailer. Please set it up prior to using this function. - `workdir`: Location of a working directory for the `syz-manager` process. Outputs here include: - `<workdir>/crashes/*`: crash output files (see [Crash Reports](#crash-reports)) - `<workdir>/corpus.db`: corpus with interesting programs diff --git a/syz-manager/manager.go b/syz-manager/manager.go index f5d403419..ea127e865 100644 --- a/syz-manager/manager.go +++ b/syz-manager/manager.go @@ -11,6 +11,7 @@ import ( "math/rand" "net" "os" + "os/exec" "os/signal" "path/filepath" "sync" @@ -576,19 +577,33 @@ func (mgr *Manager) isSuppressed(crash *Crash) bool { return false } +func (mgr *Manager) emailCrash(crash *Crash) { + if mgr.cfg.Email_Addr == "" { + return + } + Logf(0, "sending email to %v", mgr.cfg.Email_Addr) + cmd := exec.Command("mailx", "-s", "syzkaller: "+crash.Title, mgr.cfg.Email_Addr) + cmd.Stdin = bytes.NewReader(crash.Report.Report) + if _, err := osutil.Run(10*time.Minute, cmd); err != nil { + Logf(0, "failed to send email: %v", err) + } +} + func (mgr *Manager) saveCrash(crash *Crash) bool { Logf(0, "vm-%v: crash: %v", crash.vmIndex, crash.Title) + if err := mgr.getReporter().Symbolize(crash.Report); err != nil { + Logf(0, "failed to symbolize report: %v", err) + } + mgr.mu.Lock() mgr.stats["crashes"]++ if !mgr.crashTypes[crash.Title] { mgr.crashTypes[crash.Title] = true mgr.stats["crash types"]++ + go mgr.emailCrash(crash) } mgr.mu.Unlock() - if err := mgr.getReporter().Symbolize(crash.Report); err != nil { - Logf(0, "failed to symbolize report: %v", err) - } if mgr.dash != nil { dc := &dashapi.Crash{ BuildID: mgr.cfg.Tag, diff --git a/syz-manager/mgrconfig/mgrconfig.go b/syz-manager/mgrconfig/mgrconfig.go index a4afb9247..cc3abf59b 100644 --- a/syz-manager/mgrconfig/mgrconfig.go +++ b/syz-manager/mgrconfig/mgrconfig.go @@ -34,6 +34,8 @@ type Config struct { Hub_Addr string Hub_Key string + Email_Addr string // syz-manager will send crash emails to this address using mailx (optional) + Dashboard_Client string Dashboard_Addr string Dashboard_Key string |
