mirror of
https://github.com/reactos/syzkaller.git
synced 2024-10-07 09:03:28 +00:00
dashboard/app: send machine information to dashboard
- Change syz-manager so that it will send machine info the first time a crash occurs. - Add a field in entities.Crash to store machine info. - Add a field in dashapi.BugReport to store machine info. - Change the HTML template and struct uiCrash to display machine info. - Add a test to make sure that the link to machine info appears on the webpage. Update #466
This commit is contained in:
parent
df4f5a9c4a
commit
9eff3337ee
@ -810,6 +810,9 @@ func saveCrash(c context.Context, ns string, req *dashapi.Crash, bugKey *db.Key,
|
|||||||
if crash.ReproC, err = putText(c, ns, textReproC, req.ReproC, false); err != nil {
|
if crash.ReproC, err = putText(c, ns, textReproC, req.ReproC, false); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if crash.MachineInfo, err = putText(c, ns, textMachineInfo, req.MachineInfo, false); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
crashKey := db.NewIncompleteKey(c, "Crash", bugKey)
|
crashKey := db.NewIncompleteKey(c, "Crash", bugKey)
|
||||||
if _, err = db.Put(c, crashKey, crash); err != nil {
|
if _, err = db.Put(c, crashKey, crash); err != nil {
|
||||||
return fmt.Errorf("failed to put crash: %v", err)
|
return fmt.Errorf("failed to put crash: %v", err)
|
||||||
|
@ -131,6 +131,7 @@ type Crash struct {
|
|||||||
ReproOpts []byte `datastore:",noindex"`
|
ReproOpts []byte `datastore:",noindex"`
|
||||||
ReproSyz int64 // reference to ReproSyz text entity
|
ReproSyz int64 // reference to ReproSyz text entity
|
||||||
ReproC int64 // reference to ReproC text entity
|
ReproC int64 // reference to ReproC text entity
|
||||||
|
MachineInfo int64 // Reference to MachineInfo text entity.
|
||||||
// Custom crash priority for reporting (greater values are higher priority).
|
// Custom crash priority for reporting (greater values are higher priority).
|
||||||
// For example, a crash in mainline kernel has higher priority than a crash in a side branch.
|
// For example, a crash in mainline kernel has higher priority than a crash in a side branch.
|
||||||
// For historical reasons this is called ReportLen.
|
// For historical reasons this is called ReportLen.
|
||||||
@ -232,6 +233,7 @@ const (
|
|||||||
textCrashReport = "CrashReport"
|
textCrashReport = "CrashReport"
|
||||||
textReproSyz = "ReproSyz"
|
textReproSyz = "ReproSyz"
|
||||||
textReproC = "ReproC"
|
textReproC = "ReproC"
|
||||||
|
textMachineInfo = "MachineInfo"
|
||||||
textKernelConfig = "KernelConfig"
|
textKernelConfig = "KernelConfig"
|
||||||
textPatch = "Patch"
|
textPatch = "Patch"
|
||||||
textLog = "Log"
|
textLog = "Log"
|
||||||
|
@ -668,21 +668,22 @@ func createBugReportForJob(c context.Context, job *Job, jobKey *db.Key, config i
|
|||||||
}
|
}
|
||||||
kernelRepo := kernelRepoInfo(build)
|
kernelRepo := kernelRepoInfo(build)
|
||||||
rep := &dashapi.BugReport{
|
rep := &dashapi.BugReport{
|
||||||
Type: typ,
|
Type: typ,
|
||||||
Config: reportingConfig,
|
Config: reportingConfig,
|
||||||
JobID: extJobID(jobKey),
|
JobID: extJobID(jobKey),
|
||||||
ExtID: job.ExtID,
|
ExtID: job.ExtID,
|
||||||
CC: append(job.CC, kernelRepo.CC...),
|
CC: append(job.CC, kernelRepo.CC...),
|
||||||
Log: crashLog,
|
Log: crashLog,
|
||||||
LogLink: externalLink(c, textCrashLog, job.CrashLog),
|
LogLink: externalLink(c, textCrashLog, job.CrashLog),
|
||||||
Report: report,
|
Report: report,
|
||||||
ReportLink: externalLink(c, textCrashReport, job.CrashReport),
|
ReportLink: externalLink(c, textCrashReport, job.CrashReport),
|
||||||
ReproCLink: externalLink(c, textReproC, crash.ReproC),
|
ReproCLink: externalLink(c, textReproC, crash.ReproC),
|
||||||
ReproSyzLink: externalLink(c, textReproSyz, crash.ReproSyz),
|
ReproSyzLink: externalLink(c, textReproSyz, crash.ReproSyz),
|
||||||
CrashTitle: job.CrashTitle,
|
MachineInfoLink: externalLink(c, textMachineInfo, crash.MachineInfo),
|
||||||
Error: jobError,
|
CrashTitle: job.CrashTitle,
|
||||||
ErrorLink: externalLink(c, textError, job.Error),
|
Error: jobError,
|
||||||
PatchLink: externalLink(c, textPatch, job.Patch),
|
ErrorLink: externalLink(c, textError, job.Error),
|
||||||
|
PatchLink: externalLink(c, textPatch, job.Patch),
|
||||||
}
|
}
|
||||||
if job.Type == JobBisectCause || job.Type == JobBisectFix {
|
if job.Type == JobBisectCause || job.Type == JobBisectFix {
|
||||||
rep.Maintainers = append(crash.Maintainers, kernelRepo.Maintainers...)
|
rep.Maintainers = append(crash.Maintainers, kernelRepo.Maintainers...)
|
||||||
|
@ -165,13 +165,14 @@ type uiBug struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type uiCrash struct {
|
type uiCrash struct {
|
||||||
Manager string
|
Manager string
|
||||||
Time time.Time
|
Time time.Time
|
||||||
Maintainers string
|
Maintainers string
|
||||||
LogLink string
|
LogLink string
|
||||||
ReportLink string
|
ReportLink string
|
||||||
ReproSyzLink string
|
ReproSyzLink string
|
||||||
ReproCLink string
|
ReproCLink string
|
||||||
|
MachineInfoLink string
|
||||||
*uiBuild
|
*uiBuild
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -917,13 +918,14 @@ func loadFixBisectionsForBug(c context.Context, bug *Bug) ([]*uiCrash, error) {
|
|||||||
|
|
||||||
func makeUICrash(crash *Crash, build *Build) *uiCrash {
|
func makeUICrash(crash *Crash, build *Build) *uiCrash {
|
||||||
ui := &uiCrash{
|
ui := &uiCrash{
|
||||||
Manager: crash.Manager,
|
Manager: crash.Manager,
|
||||||
Time: crash.Time,
|
Time: crash.Time,
|
||||||
Maintainers: strings.Join(crash.Maintainers, ", "),
|
Maintainers: strings.Join(crash.Maintainers, ", "),
|
||||||
LogLink: textLink(textCrashLog, crash.Log),
|
LogLink: textLink(textCrashLog, crash.Log),
|
||||||
ReportLink: textLink(textCrashReport, crash.Report),
|
ReportLink: textLink(textCrashReport, crash.Report),
|
||||||
ReproSyzLink: textLink(textReproSyz, crash.ReproSyz),
|
ReproSyzLink: textLink(textReproSyz, crash.ReproSyz),
|
||||||
ReproCLink: textLink(textReproC, crash.ReproC),
|
ReproCLink: textLink(textReproC, crash.ReproC),
|
||||||
|
MachineInfoLink: textLink(textMachineInfo, crash.MachineInfo),
|
||||||
}
|
}
|
||||||
if build != nil {
|
if build != nil {
|
||||||
ui.uiBuild = makeUIBuild(build)
|
ui.uiBuild = makeUIBuild(build)
|
||||||
|
@ -391,6 +391,10 @@ func createBugReport(c context.Context, bug *Bug, crash *Crash, crashKey *db.Key
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
machineInfo, _, err := getText(c, textMachineInfo, crash.MachineInfo)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
if len(reproSyz) != 0 {
|
if len(reproSyz) != 0 {
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
buf.WriteString(syzReproPrefix)
|
buf.WriteString(syzReproPrefix)
|
||||||
@ -411,24 +415,26 @@ func createBugReport(c context.Context, bug *Bug, crash *Crash, crashKey *db.Key
|
|||||||
|
|
||||||
kernelRepo := kernelRepoInfo(build)
|
kernelRepo := kernelRepoInfo(build)
|
||||||
rep := &dashapi.BugReport{
|
rep := &dashapi.BugReport{
|
||||||
Type: typ,
|
Type: typ,
|
||||||
Config: reportingConfig,
|
Config: reportingConfig,
|
||||||
ExtID: bugReporting.ExtID,
|
ExtID: bugReporting.ExtID,
|
||||||
First: bugReporting.Reported.IsZero(),
|
First: bugReporting.Reported.IsZero(),
|
||||||
Moderation: reporting.moderation,
|
Moderation: reporting.moderation,
|
||||||
Log: crashLog,
|
Log: crashLog,
|
||||||
LogLink: externalLink(c, textCrashLog, crash.Log),
|
LogLink: externalLink(c, textCrashLog, crash.Log),
|
||||||
Report: report,
|
Report: report,
|
||||||
ReportLink: externalLink(c, textCrashReport, crash.Report),
|
ReportLink: externalLink(c, textCrashReport, crash.Report),
|
||||||
CC: kernelRepo.CC,
|
CC: kernelRepo.CC,
|
||||||
Maintainers: append(crash.Maintainers, kernelRepo.Maintainers...),
|
Maintainers: append(crash.Maintainers, kernelRepo.Maintainers...),
|
||||||
ReproC: reproC,
|
ReproC: reproC,
|
||||||
ReproCLink: externalLink(c, textReproC, crash.ReproC),
|
ReproCLink: externalLink(c, textReproC, crash.ReproC),
|
||||||
ReproSyz: reproSyz,
|
ReproSyz: reproSyz,
|
||||||
ReproSyzLink: externalLink(c, textReproSyz, crash.ReproSyz),
|
ReproSyzLink: externalLink(c, textReproSyz, crash.ReproSyz),
|
||||||
CrashID: crashKey.IntID(),
|
MachineInfo: machineInfo,
|
||||||
NumCrashes: bug.NumCrashes,
|
MachineInfoLink: externalLink(c, textMachineInfo, crash.MachineInfo),
|
||||||
HappenedOn: managersToRepos(c, bug.Namespace, bug.HappenedOn),
|
CrashID: crashKey.IntID(),
|
||||||
|
NumCrashes: bug.NumCrashes,
|
||||||
|
HappenedOn: managersToRepos(c, bug.Namespace, bug.HappenedOn),
|
||||||
}
|
}
|
||||||
if bugReporting.CC != "" {
|
if bugReporting.CC != "" {
|
||||||
rep.CC = append(rep.CC, strings.Split(bugReporting.CC, "|")...)
|
rep.CC = append(rep.CC, strings.Split(bugReporting.CC, "|")...)
|
||||||
|
@ -5,6 +5,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"regexp"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -460,3 +461,47 @@ func TestReportingFilter(t *testing.T) {
|
|||||||
rep4 := c.client.pollBug()
|
rep4 := c.client.pollBug()
|
||||||
c.expectEQ(string(rep4.Config), `{"Index":2}`)
|
c.expectEQ(string(rep4.Config), `{"Index":2}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMachineInfo(t *testing.T) {
|
||||||
|
c := NewCtx(t)
|
||||||
|
defer c.Close()
|
||||||
|
|
||||||
|
build := testBuild(1)
|
||||||
|
c.client.UploadBuild(build)
|
||||||
|
|
||||||
|
machineInfo := []byte("info1")
|
||||||
|
|
||||||
|
// Create a crash with machine information and check the returned machine
|
||||||
|
// information field is equal.
|
||||||
|
crash := &dashapi.Crash{
|
||||||
|
BuildID: "build1",
|
||||||
|
Title: "title1",
|
||||||
|
Maintainers: []string{`"Foo Bar" <foo@bar.com>`, `bar@foo.com`},
|
||||||
|
Log: []byte("log1"),
|
||||||
|
Report: []byte("report1"),
|
||||||
|
MachineInfo: machineInfo,
|
||||||
|
}
|
||||||
|
c.client.ReportCrash(crash)
|
||||||
|
rep := c.client.pollBug()
|
||||||
|
c.expectEQ(machineInfo, rep.MachineInfo)
|
||||||
|
|
||||||
|
// Check that a link to machine information page is created on the dashboard,
|
||||||
|
// and the content is correct.
|
||||||
|
indexPage, err := c.AuthGET(AccessAdmin, "/test1")
|
||||||
|
c.expectOK(err)
|
||||||
|
bugLinkRegex := regexp.MustCompile(`<a href="(/bug\?id=[^"]+)">title1</a>`)
|
||||||
|
bugLinkSubmatch := bugLinkRegex.FindSubmatch(indexPage)
|
||||||
|
c.expectEQ(len(bugLinkSubmatch), 2)
|
||||||
|
bugURL := string(bugLinkSubmatch[1])
|
||||||
|
|
||||||
|
bugPage, err := c.AuthGET(AccessAdmin, bugURL)
|
||||||
|
c.expectOK(err)
|
||||||
|
infoLinkRegex := regexp.MustCompile(`<a href="(/text\?tag=MachineInfo[^"]+)">machine info</a>`)
|
||||||
|
infoLinkSubmatch := infoLinkRegex.FindSubmatch(bugPage)
|
||||||
|
c.expectEQ(len(infoLinkSubmatch), 2)
|
||||||
|
infoURL := string(infoLinkSubmatch[1])
|
||||||
|
|
||||||
|
receivedInfo, err := c.AuthGET(AccessAdmin, infoURL)
|
||||||
|
c.expectOK(err)
|
||||||
|
c.expectEQ(receivedInfo, machineInfo)
|
||||||
|
}
|
||||||
|
@ -342,6 +342,7 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the
|
|||||||
<td class="repro">{{if $b.ReportLink}}<a href="{{$b.ReportLink}}">report</a>{{end}}</td>
|
<td class="repro">{{if $b.ReportLink}}<a href="{{$b.ReportLink}}">report</a>{{end}}</td>
|
||||||
<td class="repro">{{if $b.ReproSyzLink}}<a href="{{$b.ReproSyzLink}}">syz</a>{{end}}</td>
|
<td class="repro">{{if $b.ReproSyzLink}}<a href="{{$b.ReproSyzLink}}">syz</a>{{end}}</td>
|
||||||
<td class="repro">{{if $b.ReproCLink}}<a href="{{$b.ReproCLink}}">C</a>{{end}}</td>
|
<td class="repro">{{if $b.ReproCLink}}<a href="{{$b.ReproCLink}}">C</a>{{end}}</td>
|
||||||
|
<td class="repro">{{if $b.MachineInfoLink}}<a href="{{$b.MachineInfoLink}}">machine info</a>{{end}}</td>
|
||||||
{{if $.HasMaintainers}}
|
{{if $.HasMaintainers}}
|
||||||
<td class="maintainers" title="{{$b.Maintainers}}">{{$b.Maintainers}}</td>
|
<td class="maintainers" title="{{$b.Maintainers}}">{{$b.Maintainers}}</td>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -241,6 +241,7 @@ type Crash struct {
|
|||||||
Recipients Recipients
|
Recipients Recipients
|
||||||
Log []byte
|
Log []byte
|
||||||
Report []byte
|
Report []byte
|
||||||
|
MachineInfo []byte
|
||||||
// The following is optional and is filled only after repro.
|
// The following is optional and is filled only after repro.
|
||||||
ReproOpts []byte
|
ReproOpts []byte
|
||||||
ReproSyz []byte
|
ReproSyz []byte
|
||||||
@ -333,6 +334,8 @@ type BugReport struct {
|
|||||||
ReproCLink string
|
ReproCLink string
|
||||||
ReproSyz []byte
|
ReproSyz []byte
|
||||||
ReproSyzLink string
|
ReproSyzLink string
|
||||||
|
MachineInfo []byte
|
||||||
|
MachineInfoLink string
|
||||||
CrashID int64 // returned back in BugUpdate
|
CrashID int64 // returned back in BugUpdate
|
||||||
NumCrashes int64
|
NumCrashes int64
|
||||||
HappenedOn []string // list of kernel repo aliases
|
HappenedOn []string // list of kernel repo aliases
|
||||||
|
@ -695,12 +695,13 @@ func (mgr *Manager) saveCrash(crash *Crash) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
dc := &dashapi.Crash{
|
dc := &dashapi.Crash{
|
||||||
BuildID: mgr.cfg.Tag,
|
BuildID: mgr.cfg.Tag,
|
||||||
Title: crash.Title,
|
Title: crash.Title,
|
||||||
Corrupted: crash.Corrupted,
|
Corrupted: crash.Corrupted,
|
||||||
Recipients: crash.Recipients.ToDash(),
|
Recipients: crash.Recipients.ToDash(),
|
||||||
Log: crash.Output,
|
Log: crash.Output,
|
||||||
Report: crash.Report.Report,
|
Report: crash.Report.Report,
|
||||||
|
MachineInfo: crash.machineInfo,
|
||||||
}
|
}
|
||||||
resp, err := mgr.dash.ReportCrash(dc)
|
resp, err := mgr.dash.ReportCrash(dc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user