aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-crush
diff options
context:
space:
mode:
authorAlexander Popov <alex.popov@linux.com>2020-11-30 19:50:15 +0300
committerDmitry Vyukov <dvyukov@google.com>2020-12-01 07:58:25 +0100
commit07bfe8a540418c37449ef29dfc84ccf4d15ea0e0 (patch)
treec21e20b2f02110d6313fccddbe8500d7daf5ad1c /tools/syz-crush
parentb3a34598c6b285e38fc13f95c8db997a84815085 (diff)
tools/syz-crush: improve the output
Currently syz-crush saves the results in the syzkaller workdir. If you run this tool multiple times, you may lose the connection between your reproducers and the crash reports saved in workdir. Let's improve storeCrash(): 1. print the sequence number of the saved crash, 2. report about the errors during crash saving, 3. copy the reproducer to the workdir as well. Signed-off-by: Alexander Popov <alex.popov@linux.com>
Diffstat (limited to 'tools/syz-crush')
-rw-r--r--tools/syz-crush/crush.go22
1 files changed, 16 insertions, 6 deletions
diff --git a/tools/syz-crush/crush.go b/tools/syz-crush/crush.go
index a20c827e5..2ebb27fd9 100644
--- a/tools/syz-crush/crush.go
+++ b/tools/syz-crush/crush.go
@@ -140,18 +140,28 @@ func storeCrash(cfg *mgrconfig.Config, rep *report.Report) {
id := hash.String([]byte(rep.Title))
dir := filepath.Join(cfg.Workdir, "crashes", id)
osutil.MkdirAll(dir)
- log.Printf("saving crash %v to %v", rep.Title, dir)
+
+ index := 0
+ for ; osutil.IsExist(filepath.Join(dir, fmt.Sprintf("log%v", index))); index++ {
+ }
+ log.Printf("saving crash '%v' with index %v in %v", rep.Title, index, dir)
if err := osutil.WriteFile(filepath.Join(dir, "description"), []byte(rep.Title+"\n")); err != nil {
log.Printf("failed to write crash description: %v", err)
}
- index := 0
- for ; osutil.IsExist(filepath.Join(dir, fmt.Sprintf("log%v", index))); index++ {
+ if err := osutil.WriteFile(filepath.Join(dir, fmt.Sprintf("log%v", index)), rep.Output); err != nil {
+ log.Printf("failed to write crash log: %v", err)
+ }
+ if err := osutil.WriteFile(filepath.Join(dir, fmt.Sprintf("tag%v", index)), []byte(cfg.Tag)); err != nil {
+ log.Printf("failed to write crash tag: %v", err)
}
- osutil.WriteFile(filepath.Join(dir, fmt.Sprintf("log%v", index)), rep.Output)
- osutil.WriteFile(filepath.Join(dir, fmt.Sprintf("tag%v", index)), []byte(cfg.Tag))
if len(rep.Report) > 0 {
- osutil.WriteFile(filepath.Join(dir, fmt.Sprintf("report%v", index)), rep.Report)
+ if err := osutil.WriteFile(filepath.Join(dir, fmt.Sprintf("report%v", index)), rep.Report); err != nil {
+ log.Printf("failed to write crash report: %v", err)
+ }
+ }
+ if err := osutil.CopyFile(flag.Args()[0], filepath.Join(dir, fmt.Sprintf("reproducer%v", index))); err != nil {
+ log.Printf("failed to write crash reproducer: %v", err)
}
}