diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2021-07-16 14:57:55 +0000 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2021-07-20 13:39:45 +0200 |
| commit | 2fe31df39f956886ef214b5b028362964aa07a53 (patch) | |
| tree | 2f94fc7eb2b84927d3059e85fa0e198ba4380ec0 /pkg/bisect | |
| parent | b5969a9bdd1769ae7dc56682c4dbb8bc8f2ab7c3 (diff) | |
all: capture compiler id during the build process
Default compilers are specified in the OS- and platform-dependent logic.
It is more convenient to extract info about them during the kernel build
itself, rather than during the manager object initialization.
Apply the necessary changes throughout the code that is involved in
building the kernels and processing information about this process.
Diffstat (limited to 'pkg/bisect')
| -rw-r--r-- | pkg/bisect/bisect.go | 17 | ||||
| -rw-r--r-- | pkg/bisect/bisect_test.go | 12 |
2 files changed, 15 insertions, 14 deletions
diff --git a/pkg/bisect/bisect.go b/pkg/bisect/bisect.go index 0454cf68c..b2ec3dd46 100644 --- a/pkg/bisect/bisect.go +++ b/pkg/bisect/bisect.go @@ -410,24 +410,23 @@ func (env *env) build() (*vcs.Commit, string, error) { if err != nil { return nil, "", err } - compilerID, err := build.CompilerIdentity(bisectEnv.Compiler) - if err != nil { - return nil, "", err - } - env.log("testing commit %v with %v", current.Hash, compilerID) + env.log("testing commit %v", current.Hash) buildStart := time.Now() mgr := env.cfg.Manager if err := build.Clean(mgr.TargetOS, mgr.TargetVMArch, mgr.Type, mgr.KernelSrc); err != nil { return nil, "", fmt.Errorf("kernel clean failed: %v", err) } kern := &env.cfg.Kernel - _, kernelSign, err := env.inst.BuildKernel(bisectEnv.Compiler, env.cfg.Ccache, kern.Userspace, + _, imageDetails, err := env.inst.BuildKernel(bisectEnv.Compiler, env.cfg.Ccache, kern.Userspace, kern.Cmdline, kern.Sysctl, bisectEnv.KernelConfig) - if kernelSign != "" { - env.log("kernel signature: %v", kernelSign) + if imageDetails.CompilerID != "" { + env.log("compiler: %v", imageDetails.CompilerID) + } + if imageDetails.Signature != "" { + env.log("kernel signature: %v", imageDetails.Signature) } env.buildTime += time.Since(buildStart) - return current, kernelSign, err + return current, imageDetails.Signature, err } func (env *env) test() (*testResult, error) { diff --git a/pkg/bisect/bisect_test.go b/pkg/bisect/bisect_test.go index e71903c98..7a05afb36 100644 --- a/pkg/bisect/bisect_test.go +++ b/pkg/bisect/bisect_test.go @@ -10,6 +10,7 @@ import ( "strconv" "testing" + "github.com/google/syzkaller/pkg/build" "github.com/google/syzkaller/pkg/debugtracer" "github.com/google/syzkaller/pkg/hash" "github.com/google/syzkaller/pkg/instance" @@ -34,18 +35,19 @@ func (env *testEnv) BuildSyzkaller(repo, commit string) error { } func (env *testEnv) BuildKernel(compilerBin, cCache, userspaceDir, cmdlineFile, sysctlFile string, - kernelConfig []byte) (string, string, error) { + kernelConfig []byte) (string, build.ImageDetails, error) { commit := env.headCommit() configHash := hash.String(kernelConfig) - kernelSign := fmt.Sprintf("%v-%v", commit, configHash) + details := build.ImageDetails{} + details.Signature = fmt.Sprintf("%v-%v", commit, configHash) if commit >= env.test.sameBinaryStart && commit <= env.test.sameBinaryEnd { - kernelSign = "same-sign-" + configHash + details.Signature = "same-sign-" + configHash } env.config = string(kernelConfig) if env.config == "baseline-fails" { - return "", kernelSign, fmt.Errorf("failure") + return "", details, fmt.Errorf("failure") } - return "", kernelSign, nil + return "", details, nil } func (env *testEnv) Test(numVMs int, reproSyz, reproOpts, reproC []byte) ([]error, error) { |
