From 1b7c5ffa41acdbd6603afb7bd04a580a79346dbc Mon Sep 17 00:00:00 2001 From: Jouni Hogander Date: Thu, 19 Nov 2020 09:38:22 +0200 Subject: 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 --- tools/syz-bisect/bisect.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'tools/syz-bisect') 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) -- cgit mrf-deployment