diff options
Diffstat (limited to 'pkg/bisect')
| -rw-r--r-- | pkg/bisect/bisect.go | 16 | ||||
| -rw-r--r-- | pkg/bisect/bisect_test.go | 15 |
2 files changed, 29 insertions, 2 deletions
diff --git a/pkg/bisect/bisect.go b/pkg/bisect/bisect.go index 440de5a5d..fbb8d031c 100644 --- a/pkg/bisect/bisect.go +++ b/pkg/bisect/bisect.go @@ -348,6 +348,22 @@ func (env *env) identifyRewrittenCommit() (string, error) { return cfg.Kernel.Commit, err } + if !cfg.Fix { + // If we're doing a cause bisection, we don't really need the commit to be + // reachable from cfg.Kernel.Branch. + // So let's try to force tag fetch and check if the commit is present in the + // repository. + env.log("fetch other tags and check if the commit is present") + commit, err := env.repo.CheckoutCommit(cfg.Kernel.Repo, cfg.Kernel.Commit) + if err != nil { + // Ignore the error because the command will fail if the commit is really not + // present in the tree. + env.log("fetch failed with %s", err) + } else if commit != nil { + return commit.Hash, nil + } + } + // We record the tested kernel commit when syzkaller triggers a crash. These commits can become // unreachable after the crash was found, when the history of the tested kernel branch was // rewritten. The commit might have been completely deleted from the branch or just changed in diff --git a/pkg/bisect/bisect_test.go b/pkg/bisect/bisect_test.go index c57ef7020..95849e419 100644 --- a/pkg/bisect/bisect_test.go +++ b/pkg/bisect/bisect_test.go @@ -173,7 +173,8 @@ func createTestRepo(t *testing.T) string { } } } - // Emulate another tree, that's needed for cross-tree tests. + // Emulate another tree, that's needed for cross-tree tests and + // for cause bisections for commits not reachable from master. repo.Git("checkout", "v8.0") repo.Git("checkout", "-b", "v8-branch") repo.CommitFileChange("850", "v8-branch") @@ -248,7 +249,7 @@ func testBisection(t *testing.T, baseDir string, test BisectionTest) { res, err := runImpl(cfg, r, inst) checkBisectionError(test, res, err) - if !test.crossTree { + if !test.crossTree && !test.noFakeHashTest { // Should be mitigated via GetCommitByTitle during bisection. cfg.Kernel.Commit = fmt.Sprintf("fake-hash-for-%v-%v", cfg.Kernel.Commit, cfg.Kernel.CommitTitle) res, err = runImpl(cfg, r, inst) @@ -326,6 +327,7 @@ type BisectionTest struct { baselineConfig string resultingConfig string crossTree bool + noFakeHashTest bool extraTest func(t *testing.T, res *Result) } @@ -662,6 +664,15 @@ var bisectionTests = []BisectionTest{ crossTree: true, fixCommit: "903", }, + { + name: "cause-finds-other-branch-commit", + startCommit: 852, + startCommitBranch: "v8-branch", + commitLen: 1, + expectRep: true, + introduced: "602", + noFakeHashTest: true, + }, } func TestBisectionResults(t *testing.T) { |
