aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-bisect
diff options
context:
space:
mode:
authorJouni Hogander <jouni.hogander@unikie.com>2020-11-19 09:38:22 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-12-10 12:57:35 +0100
commit1b7c5ffa41acdbd6603afb7bd04a580a79346dbc (patch)
tree48f5f003e8c5a29f40a5e61662748740117f2552 /tools/syz-bisect
parent2a55c22bb3a8435906fc89d5676b0c7f8bb4b7e3 (diff)
tools/syz-bisect: read repro.cprog and/or repro.prog
Currently syz-bisect is reading repro.c or repro.syz. Syz-manager is storing reproducers as repro.cprog and repro.prog. Use these names instead. Also add check to ensure either one is found before bisect.Run is called
Diffstat (limited to 'tools/syz-bisect')
-rw-r--r--tools/syz-bisect/bisect.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/tools/syz-bisect/bisect.go b/tools/syz-bisect/bisect.go
index a7f3ca180..d100797dd 100644
--- a/tools/syz-bisect/bisect.go
+++ b/tools/syz-bisect/bisect.go
@@ -3,17 +3,15 @@
// syz-bisect runs bisection to find cause/fix commit for a crash.
//
-// The tool is originally created to test pkg/bisect logic,
-// the interface is not particularly handy to use.
+// The tool is originally created to test pkg/bisect logic.
//
// The tool requires a config file passed in -config flag, see Config type below for details,
// and a directory with info about the crash passed in -crash flag).
// If -fix flag is specified, it does fix bisection. Otherwise it does cause bisection.
//
// The crash dir should contain the following files:
-// - repro.c: C reproducer for the crash (optional)
-// - repro.syz: syzkaller reproducer for the crash
-// - repro.opts: syzkaller reproducer options (e.g. {"procs":1,"sandbox":"none",...})
+// - repro.cprog or repro.prog: reproducer for the crash
+// - repro.opts: syzkaller reproducer options (e.g. {"procs":1,"sandbox":"none",...}) (optional)
// - syzkaller.commit: hash of syzkaller commit which was used to trigger the crash
// - kernel.commit: hash of kernel commit on which the crash was triggered
// - kernel.config: kernel config file
@@ -105,10 +103,15 @@ func main() {
loadString("kernel.commit", &cfg.Kernel.Commit)
loadFile("kernel.config", &cfg.Kernel.Config, true)
loadFile("kernel.baseline_config", &cfg.Kernel.BaselineConfig, false)
- loadFile("repro.syz", &cfg.Repro.Syz, false)
- loadFile("repro.c", &cfg.Repro.C, false)
+ loadFile("repro.prog", &cfg.Repro.Syz, false)
+ loadFile("repro.cprog", &cfg.Repro.C, false)
loadFile("repro.opts", &cfg.Repro.Opts, true)
+ if len(cfg.Repro.Syz) == 0 && len(cfg.Repro.C) == 0 {
+ fmt.Fprintf(os.Stderr, "no repro.cprog or repro.prog found\n")
+ os.Exit(1)
+ }
+
if _, err := bisect.Run(cfg); err != nil {
fmt.Fprintf(os.Stderr, "bisection failed: %v\n", err)
os.Exit(1)