From d401b9d77980e7469e1c6eaa282f33df0fcfb3df Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Thu, 21 Aug 2025 19:00:20 +0200 Subject: pkg/manager: add Rank column with tooltips to the main page --- pkg/manager/crash.go | 12 ++++++++++++ pkg/manager/html/main.html | 9 +++++++++ pkg/manager/http.go | 41 ++++++++++++++++++++++++++++++++--------- 3 files changed, 53 insertions(+), 9 deletions(-) (limited to 'pkg/manager') diff --git a/pkg/manager/crash.go b/pkg/manager/crash.go index f0fa58959..a62ec8280 100644 --- a/pkg/manager/crash.go +++ b/pkg/manager/crash.go @@ -216,6 +216,7 @@ type CrashInfo struct { type BugInfo struct { ID string Title string + TailTitles []*report.TitleFreqRank FirstTime time.Time LastTime time.Time HasRepro bool @@ -223,6 +224,7 @@ type BugInfo struct { StraceFile string // relative to the workdir ReproAttempts int Crashes []*CrashInfo + Rank int } func (cs *CrashStore) BugInfo(id string, full bool) (*BugInfo, error) { @@ -238,6 +240,16 @@ func (cs *CrashStore) BugInfo(id string, full bool) (*BugInfo, error) { return nil, err } ret.Title = strings.TrimSpace(string(desc)) + + // Bug rank may go up over time if we observe higher ranked bugs as a consequence of the first failure. + ret.Rank = report.TitlesToImpact(ret.Title) + if titleStat, err := report.ReadStatFile(filepath.Join(dir, "title-stat")); err == nil { + ret.TailTitles = report.ExplainTitleStat(titleStat) + for _, ti := range ret.TailTitles { + ret.Rank = max(ret.Rank, ti.Rank) + } + } + ret.FirstTime = osutil.CreationTime(stat) ret.LastTime = stat.ModTime() files, err := osutil.ListDir(dir) diff --git a/pkg/manager/html/main.html b/pkg/manager/html/main.html index 42e92ac2b..43652cbf6 100644 --- a/pkg/manager/html/main.html +++ b/pkg/manager/html/main.html @@ -26,6 +26,7 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the Description + Rank Count First Time Last Time @@ -37,6 +38,14 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the {{range $c := $.Crashes}} {{$c.Title}} + + {{if $c.RankTooltip}} + {{$c.Rank}} +
{{$c.RankTooltip}}
+ {{else}} + {{$c.Rank}} + {{end}} + {{len $c.Crashes}} {{formatTime $c.FirstTime}} {{formatTime $c.LastTime}} diff --git a/pkg/manager/http.go b/pkg/manager/http.go index e6a7d6b46..61d208f41 100644 --- a/pkg/manager/http.go +++ b/pkg/manager/http.go @@ -29,6 +29,7 @@ import ( "github.com/google/syzkaller/pkg/html/pages" "github.com/google/syzkaller/pkg/log" "github.com/google/syzkaller/pkg/mgrconfig" + "github.com/google/syzkaller/pkg/report" "github.com/google/syzkaller/pkg/stat" "github.com/google/syzkaller/pkg/vcs" "github.com/google/syzkaller/pkg/vminfo" @@ -355,12 +356,33 @@ func makeUICrashType(info *BugInfo, startTime time.Time, repros map[string]bool) triaged := reproStatus(info.HasRepro, info.HasCRepro, repros[info.Title], info.ReproAttempts >= MaxReproAttempts) return UICrashType{ - BugInfo: *info, - New: info.FirstTime.After(startTime), - Active: info.LastTime.After(startTime), - Triaged: triaged, - Crashes: crashes, + BugInfo: *info, + RankTooltip: higherRankTooltip(info.Title, info.TailTitles), + New: info.FirstTime.After(startTime), + Active: info.LastTime.After(startTime), + Triaged: triaged, + Crashes: crashes, + } +} + +// higherRankTooltip generates the prioritized list of the titles with higher Rank +// than the firstTitle has. +func higherRankTooltip(firstTitle string, titlesInfo []*report.TitleFreqRank) string { + baseRank := report.TitlesToImpact(firstTitle) + res := "" + for _, ti := range titlesInfo { + if ti.Rank <= baseRank { + continue + } + res += fmt.Sprintf("[rank %2v, freq %5.1f%%] %s\n", + ti.Rank, + 100*float32(ti.Count)/float32(ti.Total), + ti.Title) + } + if res != "" { + return fmt.Sprintf("[rank %2v, originally] %s\n%s", baseRank, firstTitle, res) } + return res } var crashIDRe = regexp.MustCompile(`^\w+$`) @@ -1024,10 +1046,11 @@ type UICrashPage struct { type UICrashType struct { BugInfo - New bool // was first found in the current run - Active bool // was found in the current run - Triaged string - Crashes []UICrash + RankTooltip string + New bool // was first found in the current run + Active bool // was found in the current run + Triaged string + Crashes []UICrash } type UICrash struct { -- cgit mrf-deployment