Skip to content

Commit 4de07a3

Browse files
committed
dashboard/app: sort bugs by impact
The impact score is deducted from the title.
1 parent 39f2770 commit 4de07a3

File tree

6 files changed

+99
-2
lines changed

6 files changed

+99
-2
lines changed

dashboard/app/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/google/syzkaller/pkg/hash"
2727
"github.com/google/syzkaller/pkg/html"
2828
"github.com/google/syzkaller/pkg/html/urlutil"
29+
"github.com/google/syzkaller/pkg/report"
2930
"github.com/google/syzkaller/pkg/subsystem"
3031
"github.com/google/syzkaller/pkg/vcs"
3132
"golang.org/x/sync/errgroup"
@@ -365,6 +366,7 @@ type uiCommit struct {
365366
type uiBug struct {
366367
Namespace string
367368
Title string
369+
ImpactScore int
368370
NumCrashes int64
369371
NumCrashesBad bool
370372
BisectCause BisectStatus
@@ -1938,6 +1940,7 @@ func createUIBug(c context.Context, bug *Bug, state *ReportingState, managers []
19381940
uiBug := &uiBug{
19391941
Namespace: bug.Namespace,
19401942
Title: bug.displayTitle(),
1943+
ImpactScore: report.TitleToImpact(bug.Title),
19411944
BisectCause: bug.BisectCause,
19421945
BisectFix: bug.BisectFix,
19431946
NumCrashes: bug.NumCrashes,

dashboard/app/templates/templates.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ <h1><a href="/{{$.Namespace}}">syzbot</a></h1>
168168
<th><a onclick="return sortTable(this, 'Kernel', textSort)" href="#">Kernel</a></th>
169169
{{end}}
170170
<th><a onclick="return sortTable(this, 'Title', textSort)" href="#">Title</a></th>
171+
<th><a onclick="return sortTable(this, 'ImpactScore', numSort)" href="#">ImpactScore</a></th>
171172
<th><a onclick="return sortTable(this, 'Repro', reproSort)" href="#">Repro</a></th>
172173
<th><a onclick="return sortTable(this, 'Cause bisect', textSort)" href="#">Cause bisect</a></th>
173174
<th><a onclick="return sortTable(this, 'Fix bisect', textSort)" href="#">Fix bisect</a></th>
@@ -202,6 +203,7 @@ <h1><a href="/{{$.Namespace}}">syzbot</a></h1>
202203
<span class="bug-label">{{link .Link .Name}}</span>
203204
{{- end}}
204205
</td>
206+
<td class="stat">{{$b.ImpactScore}}</td>
205207
<td class="stat">{{formatReproLevel $b.ReproLevel}}</td>
206208
<td class="bisect_status">{{print $b.BisectCause}}</td>
207209
<td class="bisect_status">{{print $b.BisectFix}}</td>

pkg/report/crash/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const (
2020
KASANUseAfterFreeRead = Type("KASAN-USE-AFTER-FREE-READ")
2121
KASANUseAfterFreeWrite = Type("KASAN-USE-AFTER-FREE-WRITE")
2222
KASANWrite = Type("KASAN-WRITE")
23-
KCSAN = Type("KCSAN")
23+
KCSANOther = Type("KCSAN-OTHER")
2424
KCSANDataRace = Type("DATARACE")
2525
KFENCE = Type("KFENCE")
2626
KMSAN = Type("KMSAN")
@@ -56,7 +56,7 @@ func (t Type) IsKMSAN() bool {
5656
}
5757

5858
func (t Type) IsKCSAN() bool {
59-
return t == KCSANDataRace || t == KCSAN
59+
return t == KCSANDataRace || t == KCSANOther
6060
}
6161

6262
func (t Type) IsUBSAN() bool {

pkg/report/impact_score.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright 2025 syzkaller project authors. All rights reserved.
2+
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
3+
4+
package report
5+
6+
import (
7+
"github.com/google/syzkaller/pkg/report/crash"
8+
)
9+
10+
// impactOrder represent an ordering of bug impact severity. The earlier
11+
// entries are considered more severe.
12+
var impactOrder = []crash.Type{
13+
crash.KASANWrite,
14+
crash.KASANUseAfterFreeWrite,
15+
crash.KASANInvalidFree,
16+
crash.KASANUseAfterFreeRead,
17+
crash.KASANRead,
18+
crash.KASANOther,
19+
crash.MemorySafetyUBSAN,
20+
crash.MemorySafetyBUG,
21+
crash.MemorySafetyWARNING,
22+
crash.MemoryLeak,
23+
crash.KMSAN,
24+
crash.KCSANDataRace,
25+
crash.KCSANOther,
26+
crash.AtomicSleep,
27+
crash.LockdepBug,
28+
crash.Hang,
29+
crash.DoS,
30+
}
31+
32+
// TitleToImpact converts a bug title to an impact score.
33+
// A higher score indicates a more severe impact.
34+
// -1 means unknown.
35+
func TitleToImpact(title string) int {
36+
typ := TitleToCrashType(title)
37+
for i, t := range impactOrder {
38+
if typ == t {
39+
return len(impactOrder) - i
40+
}
41+
}
42+
return -1
43+
}

pkg/report/impact_score_test.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright 2025 syzkaller project authors. All rights reserved.
2+
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
3+
4+
package report
5+
6+
import (
7+
"testing"
8+
)
9+
10+
func TestImpactScore(t *testing.T) {
11+
tests := []struct {
12+
name string
13+
title string
14+
expected int
15+
}{
16+
{
17+
name: "empty means unknown",
18+
title: "",
19+
expected: -1,
20+
},
21+
{
22+
name: "unknown",
23+
title: "KGSAN: ",
24+
expected: -1,
25+
},
26+
{
27+
name: "unknown KASAN",
28+
title: "KASAN: unknown",
29+
expected: 12,
30+
},
31+
{
32+
name: "known Hang",
33+
title: "BUG: soft lockup in some function",
34+
expected: 2,
35+
},
36+
}
37+
for _, test := range tests {
38+
t.Run(test.name, func(t *testing.T) {
39+
got := TitleToImpact(test.title)
40+
if got != test.expected {
41+
t.Errorf("TitleToImpact(%q) = %d, want %d", test.title, got, test.expected)
42+
}
43+
})
44+
}
45+
}

pkg/report/title_to_type.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,8 @@ var titleToType = []struct {
228228
includePrefixes: []string{"UBSAN: "},
229229
crashType: crash.UBSAN,
230230
},
231+
{
232+
includePrefixes: []string{"KCSAN: "},
233+
crashType: crash.KCSANOther,
234+
},
231235
}

0 commit comments

Comments
 (0)