diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2023-07-06 19:41:38 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2023-07-07 09:59:51 +0000 |
| commit | 5142e5aa3b3f41019136f156bc9ece61c0a17f42 (patch) | |
| tree | f26a24f616e5754d95846efb3fda3f9ea003e64a /pkg/bisect | |
| parent | 22ae5830af1ab04e8042e534dd9baf750bc0d0ac (diff) | |
pkg/bisect: fix SYZFATAL bisections
After the previous change, pkg/bisect is unable to bisect SYZFATAL
errors. Fix the bug in the logic and add a test.
Diffstat (limited to 'pkg/bisect')
| -rw-r--r-- | pkg/bisect/bisect.go | 3 | ||||
| -rw-r--r-- | pkg/bisect/bisect_test.go | 18 |
2 files changed, 17 insertions, 4 deletions
diff --git a/pkg/bisect/bisect.go b/pkg/bisect/bisect.go index 9668144ef..3044ae081 100644 --- a/pkg/bisect/bisect.go +++ b/pkg/bisect/bisect.go @@ -803,7 +803,8 @@ func (env *env) isTransientError(rep *report.Report) bool { for _, t := range env.reportTypes { hadSyzFailure = hadSyzFailure || t == crash.SyzFailure } - return rep.Type == crash.SyzFailure && !hadSyzFailure + return rep.Type == crash.SyzFailure && + len(env.reportTypes) > 0 && !hadSyzFailure } func (env *env) saveDebugFile(hash string, idx int, data []byte) { diff --git a/pkg/bisect/bisect_test.go b/pkg/bisect/bisect_test.go index 47251b8cc..0c4775b0c 100644 --- a/pkg/bisect/bisect_test.go +++ b/pkg/bisect/bisect_test.go @@ -87,9 +87,9 @@ func (env *testEnv) Test(numVMs int, reproSyz, reproOpts, reproC []byte) ([]inst (!env.test.fix && commit >= env.test.culprit || env.test.fix && commit < env.test.culprit) { if env.test.flaky { - ret = crashErrors(1, numVMs-1, "crash occurs") + ret = crashErrors(1, numVMs-1, "crash occurs", env.test.reportType) } else { - ret = crashErrors(numVMs, 0, "crash occurs") + ret = crashErrors(numVMs, 0, "crash occurs", env.test.reportType) } return ret, nil } @@ -265,6 +265,7 @@ type BisectionTest struct { brokenEnd int infraErrStart int infraErrEnd int + reportType crash.Type // Range of commits that result in the same kernel binary signature. sameBinaryStart int sameBinaryEnd int @@ -428,6 +429,16 @@ var bisectionTests = []BisectionTest{ culprit: 500, isRelease: true, }, + // Tests that bisection returns the correct fix commit in case of SYZFATAL. + { + name: "fix-finds-fix-for-syzfatal", + fix: true, + startCommit: 400, + reportType: crash.SyzFailure, + commitLen: 1, + culprit: 500, + isRelease: true, + }, // Tests that fix bisection returns error when crash does not reproduce // on the original commit. { @@ -639,13 +650,14 @@ func checkTest(t *testing.T, test BisectionTest) { } } -func crashErrors(crashing, nonCrashing int, title string) []instance.EnvTestResult { +func crashErrors(crashing, nonCrashing int, title string, typ crash.Type) []instance.EnvTestResult { var ret []instance.EnvTestResult for i := 0; i < crashing; i++ { ret = append(ret, instance.EnvTestResult{ Error: &instance.CrashError{ Report: &report.Report{ Title: fmt.Sprintf("crashes at %v", title), + Type: typ, }, }, }) |
