From 720d943f4a78b817fcabd6fe0f12c4dc41cd337e Mon Sep 17 00:00:00 2001 From: Jouni Hogander Date: Thu, 12 Nov 2020 22:19:21 +0200 Subject: tools/syz-reporter: add new columns for syz-bisect output Add new columns to be filled with information from syz-bisect: Causing Commits Commit or list of commits that were identified by syz-bisect being possible culprits for the crash Fixing Commits Commit or list of commits that were identified by syz-bisect being possible fixes for the crash. Causing Configs Config options that were identified being dependencies for reproducing the crash. --- tools/syz-reporter/reporter.go | 79 +++++++++++++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 13 deletions(-) diff --git a/tools/syz-reporter/reporter.go b/tools/syz-reporter/reporter.go index 6173dcf36..7639fb87e 100644 --- a/tools/syz-reporter/reporter.go +++ b/tools/syz-reporter/reporter.go @@ -25,6 +25,7 @@ import ( "strings" "github.com/google/syzkaller/pkg/html" + "github.com/google/syzkaller/pkg/kconfig" "github.com/google/syzkaller/pkg/mgrconfig" "github.com/google/syzkaller/pkg/osutil" ) @@ -42,11 +43,14 @@ type UISummaryData struct { } type UICrashType struct { - Description string - ID string - Count int - Reproducers map[string]string - Crashes []*UICrash + Description string + ID string + Count int + Reproducers map[string]string + Crashes []*UICrash + CausingCommits []string + FixingCommits []string + CausingConfigs []string } type UICrash struct { @@ -150,6 +154,9 @@ func readCrash(workdir, dir string) *UICrashType { var crashes []*UICrash reproducers := make(map[string]string) + var causingCommits []string + var fixingCommits []string + var causingConfigs []string for _, f := range files { if strings.HasPrefix(f, "log") { index, err := strconv.ParseUint(f[3:], 10, 64) @@ -170,14 +177,42 @@ func readCrash(workdir, dir string) *UICrashType { if strings.HasSuffix(f, "prog") { reproducers[f] = f } + + if f == "cause.commit" { + commits, err := ioutil.ReadFile(filepath.Join(crashdir, dir, f)) + if err == nil { + causingCommits = strings.Split(string(commits), "\n") + } + } + if f == "fix.commit" { + commits, err := ioutil.ReadFile(filepath.Join(crashdir, dir, f)) + if err == nil { + fixingCommits = strings.Split(string(commits), "\n") + } + } + if f == kconfig.CauseConfigFile { + configs, err := ioutil.ReadFile(filepath.Join(crashdir, dir, f)) + if err == nil { + configsList := strings.Split(string(configs), "\n") + // Ignore configuration list longer than 10 + if len(configsList) <= 10 { + causingConfigs = configsList + } else { + causingConfigs = []string{"..."} + } + } + } } return &UICrashType{ - Description: desc, - ID: dir, - Count: len(crashes), - Reproducers: reproducers, - Crashes: crashes, + Description: desc, + ID: dir, + Count: len(crashes), + Reproducers: reproducers, + Crashes: crashes, + CausingCommits: causingCommits, + FixingCommits: fixingCommits, + CausingConfigs: causingConfigs, } } @@ -211,15 +246,33 @@ var summaryTemplate = html.CreatePage(` Description Count Reproducers + Causing_Commits + Fixing_Commits + Causing_Configs {{range $c := $.Crashes}} {{$c.Description}} {{$c.Count}} - {{range $reproducer := $c.Reproducers}} - {{$reproducer}}
- {{end}} + {{range $reproducer := $c.Reproducers}} + {{$reproducer}}
+ {{end}} + + + {{range $commit := $c.CausingCommits}} + {{$commit}}
+ {{end}} + + + {{range $commit := $c.FixingCommits}} + {{$commit}}
+ {{end}} + + + {{range $config := $c.CausingConfigs}} + {{$config}}
+ {{end}} {{end}} -- cgit mrf-deployment