diff options
| author | Jouni Hogander <jouni.hogander@unikie.com> | 2020-11-19 14:56:00 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-12-10 12:57:35 +0100 |
| commit | e97786ae481ec832fb4477df20aeab0d96fe25a6 (patch) | |
| tree | c897e1b00a894ac0d956eff199f58047dd3f40f7 | |
| parent | cbdf514ebdff5b19bc93cdfcc81598587627330e (diff) | |
tools/syz-bisect: store bisection results
Store bisection results into given crashdir as fix.commit or cause.commit
| -rw-r--r-- | tools/syz-bisect/bisect.go | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/tools/syz-bisect/bisect.go b/tools/syz-bisect/bisect.go index 3241ff469..1c8692700 100644 --- a/tools/syz-bisect/bisect.go +++ b/tools/syz-bisect/bisect.go @@ -14,6 +14,8 @@ // The crash dir should contain the following files: // - repro.cprog or repro.prog: reproducer for the crash // - repro.opts: syzkaller reproducer options (e.g. {"procs":1,"sandbox":"none",...}) (optional) +// +// The tool stores bisection result into cause.commit or fix.commit. package main import ( @@ -127,10 +129,13 @@ func main() { cfg.Kernel.Commit = vcs.HEAD } - if _, err := bisect.Run(cfg); err != nil { + result, err := bisect.Run(cfg) + if err != nil { fmt.Fprintf(os.Stderr, "bisection failed: %v\n", err) os.Exit(1) } + + saveResultCommits(result.Commits) } func loadFile(path, file string, dst *[]byte, mandatory bool) { @@ -145,3 +150,24 @@ func loadFile(path, file string, dst *[]byte, mandatory bool) { } *dst = data } + +func saveResultCommits(commits []*vcs.Commit) { + var result string + if len(commits) > 0 { + for _, commit := range commits { + result = result + commit.Hash + "\n" + } + } else if *flagFix { + result = "the crash still happens on HEAD\n" + } else { + result = "the crash already happened on the oldest tested release\n" + } + + var fileName string + if *flagFix { + fileName = filepath.Join(*flagCrash, "fix.commit") + } else { + fileName = filepath.Join(*flagCrash, "cause.commit") + } + osutil.WriteFile(fileName, []byte(result)) +} |
