From d8e6f911090ec0020f34e094005284b5c8ac1e7f Mon Sep 17 00:00:00 2001 From: Space Meyer Date: Sat, 30 Jul 2022 12:16:05 +0000 Subject: pkg/bisect: support clang for crash bisection Before we hardcoded bisection to use gcc, now the compiler family can be configured in the bisection config. --- tools/syz-bisect/bisect.go | 13 ++++++++----- tools/syz-testbuild/testbuild.go | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'tools') diff --git a/tools/syz-bisect/bisect.go b/tools/syz-bisect/bisect.go index 1c8692700..9712ddcd3 100644 --- a/tools/syz-bisect/bisect.go +++ b/tools/syz-bisect/bisect.go @@ -43,10 +43,12 @@ var ( ) type Config struct { + // Currently either 'gcc' or 'clang'. Note that pkg/bisect requires + // explicit plumbing for every os/compiler combination. + BisectCompiler string `json:"bisect_compiler"` // BinDir must point to a dir that contains compilers required to build // older versions of the kernel. For linux, it needs to include several - // gcc versions. A working archive can be downloaded from: - // https://storage.googleapis.com/syzkaller/bisect_bin.tar.gz + // compiler versions. BinDir string `json:"bin_dir"` Ccache string `json:"ccache"` KernelRepo string `json:"kernel_repo"` @@ -94,9 +96,10 @@ func main() { TraceWriter: os.Stdout, OutDir: *flagCrash, }, - Fix: *flagFix, - BinDir: mycfg.BinDir, - Ccache: mycfg.Ccache, + Fix: *flagFix, + BisectCompiler: mycfg.BisectCompiler, + BinDir: mycfg.BinDir, + Ccache: mycfg.Ccache, Kernel: bisect.KernelConfig{ Repo: mycfg.KernelRepo, Branch: mycfg.KernelBranch, diff --git a/tools/syz-testbuild/testbuild.go b/tools/syz-testbuild/testbuild.go index 9fe1dd3f1..be2718b3a 100644 --- a/tools/syz-testbuild/testbuild.go +++ b/tools/syz-testbuild/testbuild.go @@ -101,7 +101,7 @@ func main() { tool.Fail(err) } log.Printf("HEAD is on %v %v", head.Hash, head.Title) - tags, err := bisecter.PreviousReleaseTags(head.Hash) + tags, err := bisecter.PreviousReleaseTags(head.Hash, "gcc") if err != nil { tool.Fail(err) } @@ -125,7 +125,7 @@ func main() { } func test(repo vcs.Repo, bisecter vcs.Bisecter, kernelConfig []byte, env instance.Env, com *vcs.Commit) { - bisectEnv, err := bisecter.EnvForCommit(*flagBisectBin, com.Hash, kernelConfig) + bisectEnv, err := bisecter.EnvForCommit("gcc", *flagBisectBin, com.Hash, kernelConfig) if err != nil { tool.Fail(err) } -- cgit mrf-deployment