From 316eb530e5b1c0c0dacd5e17f52fd315a48fd970 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Tue, 19 Apr 2022 12:21:48 +0000 Subject: dashboard: remember and display strace flag Receive the information, whether the crash log contains strace output, from the syz-manager. Adjust bug reporting email depending on that flag. --- dashboard/app/api.go | 1 + dashboard/app/email_test.go | 49 +++++++++++++++++++++++++++++++++++++++++ dashboard/app/entities.go | 1 + dashboard/app/mail_bug.txt | 2 +- dashboard/app/reporting.go | 1 + dashboard/app/reporting_test.go | 2 ++ dashboard/dashapi/dashapi.go | 8 +++++++ syz-manager/manager.go | 4 ++++ 8 files changed, 67 insertions(+), 1 deletion(-) diff --git a/dashboard/app/api.go b/dashboard/app/api.go index 606881e8d..e2ee8ab7a 100644 --- a/dashboard/app/api.go +++ b/dashboard/app/api.go @@ -784,6 +784,7 @@ func saveCrash(c context.Context, ns string, req *dashapi.Crash, bug *Bug, bugKe GetEmails(req.Recipients, dashapi.Cc)), ReproOpts: req.ReproOpts, ReportLen: prio, + Flags: int64(req.Flags), } var err error if crash.Log, err = putText(c, ns, textCrashLog, req.Log, false); err != nil { diff --git a/dashboard/app/email_test.go b/dashboard/app/email_test.go index 53696aa14..7c946d543 100644 --- a/dashboard/app/email_test.go +++ b/dashboard/app/email_test.go @@ -771,3 +771,52 @@ func TestEmailManagerCC(t *testing.T) { "default@maintainers.com", }) } + +func TestStraceReport(t *testing.T) { + c := NewCtx(t) + defer c.Close() + + build := testBuild(1) + c.client2.UploadBuild(build) + + crash := testCrash(build, 1) + crash.Flags = dashapi.CrashUnderStrace + crash.Maintainers = []string{`"Foo Bar" `, `bar@foo.com`, `idont@want.EMAILS`} + c.client2.ReportCrash(crash) + + // Report the crash over email and check all fields. + msg := c.pollEmailBug() + _, extBugID, err := email.RemoveAddrContext(msg.Sender) + c.expectOK(err) + _, dbCrash, dbBuild := c.loadBug(extBugID) + crashLogLink := externalLink(c.ctx, textCrashLog, dbCrash.Log) + kernelConfigLink := externalLink(c.ctx, textKernelConfig, dbBuild.KernelConfig) + c.expectEQ(msg.Body, fmt.Sprintf(`Hello, + +syzbot found the following issue on: + +HEAD commit: 111111111111 kernel_commit_title1 +git tree: repo1 branch1 +console+strace: %[2]v +kernel config: %[3]v +dashboard link: https://testapp.appspot.com/bug?extid=%[1]v +compiler: compiler1 +CC: [bar@foo.com foo@bar.com idont@want.EMAILS] + +Unfortunately, I don't have any reproducer for this issue yet. + +IMPORTANT: if you fix the issue, please add the following tag to the commit: +Reported-by: syzbot+%[1]v@testapp.appspotmail.com + +report1 + +--- +This report is generated by a bot. It may contain errors. +See https://goo.gl/tpsmEJ for more information about syzbot. +syzbot engineers can be reached at syzkaller@googlegroups.com. + +syzbot will keep track of this issue. See: +https://goo.gl/tpsmEJ#status for how to communicate with syzbot.`, + extBugID, crashLogLink, kernelConfigLink)) + c.checkURLContents(crashLogLink, crash.Log) +} diff --git a/dashboard/app/entities.go b/dashboard/app/entities.go index d1c9cdf3b..7df17690f 100644 --- a/dashboard/app/entities.go +++ b/dashboard/app/entities.go @@ -143,6 +143,7 @@ type Crash struct { Reported time.Time // set if this crash was ever reported Maintainers []string `datastore:",noindex"` Log int64 // reference to CrashLog text entity + Flags int64 // properties of the Crash Report int64 // reference to CrashReport text entity ReproOpts []byte `datastore:",noindex"` ReproSyz int64 // reference to ReproSyz text entity diff --git a/dashboard/app/mail_bug.txt b/dashboard/app/mail_bug.txt index 0fcc0529f..c2b2e652d 100644 --- a/dashboard/app/mail_bug.txt +++ b/dashboard/app/mail_bug.txt @@ -6,7 +6,7 @@ syzbot {{if .First}}found{{else}}has found a reproducer for{{end}} the following HEAD commit: {{formatTagHash .KernelCommit}} {{formatCommitTableTitle .KernelCommitTitle}} git tree: {{.KernelRepoAlias}} -{{if .LogLink}}console output: {{.LogLink}} +{{if .LogLink}}{{if .LogHasStrace}}console+strace{{else}}console output{{end}}: {{.LogLink}} {{end}}{{if .KernelConfigLink}}kernel config: {{.KernelConfigLink}} {{end}}dashboard link: {{.Link}} {{if .CompilerID}}compiler: {{.CompilerID}} diff --git a/dashboard/app/reporting.go b/dashboard/app/reporting.go index 03220818b..d9dae7e13 100644 --- a/dashboard/app/reporting.go +++ b/dashboard/app/reporting.go @@ -427,6 +427,7 @@ func createBugReport(c context.Context, bug *Bug, crash *Crash, crashKey *db.Key Moderation: reporting.moderation, Log: crashLog, LogLink: externalLink(c, textCrashLog, crash.Log), + LogHasStrace: dashapi.CrashFlags(crash.Flags)&dashapi.CrashUnderStrace > 0, Report: report, ReportLink: externalLink(c, textCrashReport, crash.Report), CC: kernelRepo.CC.Always, diff --git a/dashboard/app/reporting_test.go b/dashboard/app/reporting_test.go index 453dbb1c7..a53114171 100644 --- a/dashboard/app/reporting_test.go +++ b/dashboard/app/reporting_test.go @@ -26,6 +26,7 @@ func TestReportBug(t *testing.T) { Title: "title1", Maintainers: []string{`"Foo Bar" `, `bar@foo.com`}, Log: []byte("log1"), + Flags: dashapi.CrashUnderStrace, Report: []byte("report1"), MachineInfo: []byte("machine info 1"), } @@ -72,6 +73,7 @@ func TestReportBug(t *testing.T) { MachineInfoLink: externalLink(c.ctx, textMachineInfo, dbCrash.MachineInfo), Log: []byte("log1"), LogLink: externalLink(c.ctx, textCrashLog, dbCrash.Log), + LogHasStrace: true, Report: []byte("report1"), ReportLink: externalLink(c.ctx, textCrashReport, dbCrash.Report), ReproOpts: []uint8{}, diff --git a/dashboard/dashapi/dashapi.go b/dashboard/dashapi/dashapi.go index a78e25073..bcd964852 100644 --- a/dashboard/dashapi/dashapi.go +++ b/dashboard/dashapi/dashapi.go @@ -251,6 +251,12 @@ func (dash *Dashboard) UploadCommits(commits []Commit) error { return dash.Query("upload_commits", &CommitPollResultReq{commits}, nil) } +type CrashFlags int64 + +const ( + CrashUnderStrace CrashFlags = 1 << iota +) + // Crash describes a single kernel crash (potentially with repro). type Crash struct { BuildID string // refers to Build.ID @@ -261,6 +267,7 @@ type Crash struct { Maintainers []string // deprecated in favor of Recipients Recipients Recipients Log []byte + Flags CrashFlags Report []byte MachineInfo []byte // The following is optional and is filled only after repro. @@ -355,6 +362,7 @@ type BugReport struct { SyzkallerCommit string Log []byte LogLink string + LogHasStrace bool Report []byte ReportLink string ReproC []byte diff --git a/syz-manager/manager.go b/syz-manager/manager.go index adc4b2556..de7b43d5e 100644 --- a/syz-manager/manager.go +++ b/syz-manager/manager.go @@ -1032,11 +1032,14 @@ func (mgr *Manager) saveRepro(res *ReproResult) { report := repro.Report output := report.Output + + var crashFlags dashapi.CrashFlags if res.strace != nil { // If syzkaller managed to successfully run the repro with strace, send // the report and the output generated under strace. report = res.strace.Report output = res.strace.Output + crashFlags = dashapi.CrashUnderStrace } dc := &dashapi.Crash{ BuildID: mgr.cfg.Tag, @@ -1045,6 +1048,7 @@ func (mgr *Manager) saveRepro(res *ReproResult) { Suppressed: report.Suppressed, Recipients: report.Recipients.ToDash(), Log: output, + Flags: crashFlags, Report: report.Report, ReproOpts: repro.Opts.Serialize(), ReproSyz: repro.Prog.Serialize(), -- cgit mrf-deployment