aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2019-11-27 14:05:14 +0100
committerDmitry Vyukov <dvyukov@google.com>2019-11-27 14:05:14 +0100
commit6f7be11fa1dfb7538af54ffafd1cc644d3975a1d (patch)
tree2c5e659127245a15b559ecc1dcda66cacbfbac6c
parent9f5fd6fe1a3835945ce119f2b5d3633d3b81ff61 (diff)
dashboard/app: don't report bisections pointing to release commits
They should have been detected by "same binary" logic. But the problem is that we may use different compilers for different commits and they switch exactly at release commits. So we can build the release with a differnet compiler than the rest of commits and then obviously it won't be "same binary". Detect release commits separately. Update #1271
-rw-r--r--dashboard/app/bisect_test.go4
-rw-r--r--dashboard/app/entities.go4
-rw-r--r--dashboard/dashapi/dashapi.go5
-rw-r--r--pkg/bisect/bisect.go7
-rw-r--r--pkg/bisect/bisect_test.go14
-rw-r--r--pkg/vcs/git.go12
-rw-r--r--pkg/vcs/vcs.go2
-rw-r--r--syz-ci/jobs.go3
8 files changed, 47 insertions, 4 deletions
diff --git a/dashboard/app/bisect_test.go b/dashboard/app/bisect_test.go
index 94532fa06..88aedc7fb 100644
--- a/dashboard/app/bisect_test.go
+++ b/dashboard/app/bisect_test.go
@@ -552,7 +552,7 @@ func TestBisectWrong(t *testing.T) {
build := testBuild(1)
c.client2.UploadBuild(build)
- for i := 0; i < 4; i++ {
+ for i := 0; i < 5; i++ {
var flags dashapi.JobDoneFlags
switch i {
case 0:
@@ -562,6 +562,8 @@ func TestBisectWrong(t *testing.T) {
flags = dashapi.BisectResultNoop
case 3:
flags = dashapi.BisectResultMerge | dashapi.BisectResultNoop
+ case 4:
+ flags = dashapi.BisectResultRelease
default:
t.Fatalf("assign flags")
}
diff --git a/dashboard/app/entities.go b/dashboard/app/entities.go
index 26e422d06..8d4a74e06 100644
--- a/dashboard/app/entities.go
+++ b/dashboard/app/entities.go
@@ -202,6 +202,7 @@ const (
// Parallel to dashapi.JobDoneFlags, see comments there.
BisectResultMerge JobFlags = 1 << iota
BisectResultNoop
+ BisectResultRelease
)
func (job *Job) isUnreliableBisect() bool {
@@ -211,7 +212,8 @@ func (job *Job) isUnreliableBisect() bool {
// If a bisection points to a merge or a commit that does not affect the kernel binary,
// it is considered an unreliable/wrong result and should not be reported in emails.
return job.Flags&BisectResultMerge != 0 ||
- job.Flags&BisectResultNoop != 0
+ job.Flags&BisectResultNoop != 0 ||
+ job.Flags&BisectResultRelease != 0
}
// Text holds text blobs (crash logs, reports, reproducers, etc).
diff --git a/dashboard/dashapi/dashapi.go b/dashboard/dashapi/dashapi.go
index b05f3fbf5..833dd099f 100644
--- a/dashboard/dashapi/dashapi.go
+++ b/dashboard/dashapi/dashapi.go
@@ -172,8 +172,9 @@ const (
type JobDoneFlags int64
const (
- BisectResultMerge JobDoneFlags = 1 << iota // bisected to a merge commit
- BisectResultNoop // commit does not affect resulting kernel binary
+ BisectResultMerge JobDoneFlags = 1 << iota // bisected to a merge commit
+ BisectResultNoop // commit does not affect resulting kernel binary
+ BisectResultRelease // commit is a kernel release
)
func (dash *Dashboard) JobPoll(req *JobPollReq) (*JobPollResp, error) {
diff --git a/pkg/bisect/bisect.go b/pkg/bisect/bisect.go
index 4fbeeec4f..1f3d8ea61 100644
--- a/pkg/bisect/bisect.go
+++ b/pkg/bisect/bisect.go
@@ -71,6 +71,7 @@ const NumTests = 10 // number of tests we do per commit
// - Commit is nil
// - NoopChange is set if the commit did not cause any change in the kernel binary
// (bisection result it most likely wrong)
+// - Bisected to a release commit
// - if bisection is inconclusive, range of potential cause/fix commits in Commits
// - report is nil in such case
// - Commit is nil
@@ -83,6 +84,7 @@ type Result struct {
Report *report.Report
Commit *vcs.Commit
NoopChange bool
+ IsRelease bool
}
// Run does the bisection and returns either the Result,
@@ -221,6 +223,11 @@ func (env *env) bisect() (*Result, error) {
}
if len(commits) == 1 {
com := commits[0]
+ isRelease, err := env.bisecter.IsRelease(com.Hash)
+ if err != nil {
+ env.log("failed to detect release: %v", err)
+ }
+ res.IsRelease = isRelease
if testRes := results[com.Hash]; testRes != nil {
res.Report = testRes.rep
if testRes.kernelSign != "" && len(com.Parents) == 1 {
diff --git a/pkg/bisect/bisect_test.go b/pkg/bisect/bisect_test.go
index 01dbfd44e..56e5e5ccb 100644
--- a/pkg/bisect/bisect_test.go
+++ b/pkg/bisect/bisect_test.go
@@ -127,6 +127,7 @@ type BisectionTest struct {
expectErr bool
expectRep bool
noopChange bool
+ isRelease bool
commitLen int
oldestLatest int
// input and output
@@ -177,6 +178,7 @@ func TestBisectionResults(t *testing.T) {
startCommit: 400,
commitLen: 1,
culprit: 500,
+ isRelease: true,
},
// Tests that fix bisection returns error when crash does not reproduce
// on the original commit.
@@ -254,6 +256,7 @@ func TestBisectionResults(t *testing.T) {
sameBinaryStart: 405,
sameBinaryEnd: 500,
noopChange: true,
+ isRelease: true,
},
{
name: "cause-same-binary-release2",
@@ -285,6 +288,14 @@ func TestBisectionResults(t *testing.T) {
sameBinaryEnd: 905,
noopChange: true,
},
+ {
+ name: "fix-release",
+ fix: true,
+ startCommit: 400,
+ commitLen: 1,
+ culprit: 900,
+ isRelease: true,
+ },
}
for _, test := range tests {
test := test
@@ -328,6 +339,9 @@ func TestBisectionResults(t *testing.T) {
if res.NoopChange != test.noopChange {
t.Fatalf("got noop change: %v, want: %v", res.NoopChange, test.noopChange)
}
+ if res.IsRelease != test.isRelease {
+ t.Fatalf("got release change: %v, want: %v", res.IsRelease, test.isRelease)
+ }
if test.oldestLatest != 0 && fmt.Sprint(test.oldestLatest) != res.Commit.Title ||
test.oldestLatest == 0 && res.Commit != nil {
t.Fatalf("expected latest/oldest: %v got '%v'",
diff --git a/pkg/vcs/git.go b/pkg/vcs/git.go
index 5a6de4b3f..a42f12edc 100644
--- a/pkg/vcs/git.go
+++ b/pkg/vcs/git.go
@@ -476,3 +476,15 @@ func (git *git) previousReleaseTags(commit string, self bool) ([]string, error)
tags = append(tags, tags1...)
return tags, nil
}
+
+func (git *git) IsRelease(commit string) (bool, error) {
+ tags1, err := git.previousReleaseTags(commit, true)
+ if err != nil {
+ return false, err
+ }
+ tags2, err := git.previousReleaseTags(commit, false)
+ if err != nil {
+ return false, err
+ }
+ return len(tags1) != len(tags2), nil
+}
diff --git a/pkg/vcs/vcs.go b/pkg/vcs/vcs.go
index 777f0f7e7..ea4e1d0ad 100644
--- a/pkg/vcs/vcs.go
+++ b/pkg/vcs/vcs.go
@@ -64,6 +64,8 @@ type Bisecter interface {
// PreviousReleaseTags returns list of preceding release tags that are reachable from the given commit.
PreviousReleaseTags(commit string) ([]string, error)
+ IsRelease(commit string) (bool, error)
+
EnvForCommit(binDir, commit string, kernelConfig []byte) (*BisectEnv, error)
}
diff --git a/syz-ci/jobs.go b/syz-ci/jobs.go
index f6bc01c37..faa53cc25 100644
--- a/syz-ci/jobs.go
+++ b/syz-ci/jobs.go
@@ -419,6 +419,9 @@ func (jp *JobProcessor) bisect(job *Job, mgrcfg *mgrconfig.Config) error {
if res.NoopChange {
resp.Flags |= dashapi.BisectResultNoop
}
+ if res.IsRelease {
+ resp.Flags |= dashapi.BisectResultRelease
+ }
}
if res.Report != nil {
resp.CrashTitle = res.Report.Title