From b95100df5e0793a76c9cadcacb15ef186ad350cd Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Wed, 2 Aug 2023 18:53:35 +0200 Subject: syz-ci: specify custom ignore lists for bisections Make syz-ci configuration more flexible by allowing users to set the list of commits that should never be reported as valid bisection results. Keep the list of such upstream Linux commits in the code in order not to duplicate it everywhere. --- syz-ci/jobs.go | 30 ++++++++++++++++++++---------- syz-ci/syz-ci.go | 10 +++++++--- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/syz-ci/jobs.go b/syz-ci/jobs.go index 8df869397..f9851edfb 100644 --- a/syz-ci/jobs.go +++ b/syz-ci/jobs.go @@ -553,16 +553,8 @@ func (jp *JobProcessor) bisect(job *Job, mgrcfg *mgrconfig.Config) error { if res.Confidence < confidenceCutOff { resp.Flags |= dashapi.BisectResultIgnore } - ignoredCommits := []string{ - // Commit "usb: gadget: add raw-gadget interface" adds a kernel interface for - // triggering USB bugs, which ends up being the guilty commit during bisection - // for USB bugs introduced before it. - "f2c2e717642c66f7fe7e5dd69b2e8ff5849f4d10", - } - for _, commit := range ignoredCommits { - if res.Commits[0].Hash == commit { - resp.Flags |= dashapi.BisectResultIgnore - } + if jp.ignoreBisectCommit(res.Commits[0]) { + resp.Flags |= dashapi.BisectResultIgnore } } if res.Report != nil { @@ -583,6 +575,24 @@ func (jp *JobProcessor) bisect(job *Job, mgrcfg *mgrconfig.Config) error { return nil } +var ignoredCommits = []string{ + // Commit "usb: gadget: add raw-gadget interface" adds a kernel interface for + // triggering USB bugs, which ends up being the guilty commit during bisection + // for USB bugs introduced before it. + "f2c2e717642c66f7fe7e5dd69b2e8ff5849f4d10", +} + +func (jp *JobProcessor) ignoreBisectCommit(commit *vcs.Commit) bool { + // First look at the always ignored values. + for _, hash := range ignoredCommits { + if commit.Hash == hash { + return true + } + } + _, ok := jp.cfg.BisectIgnore[commit.Hash] + return ok +} + func (jp *JobProcessor) testPatch(job *Job, mgrcfg *mgrconfig.Config) error { req, resp, mgr := job.req, job.resp, job.mgr env, err := instance.NewEnv(mgrcfg, buildSem, testSem) diff --git a/syz-ci/syz-ci.go b/syz-ci/syz-ci.go index e30e59929..a8f59524a 100644 --- a/syz-ci/syz-ci.go +++ b/syz-ci/syz-ci.go @@ -112,9 +112,13 @@ type Config struct { // BinDir must point to a dir that contains compilers required to build // older versions of the kernel. For linux, it needs to include several // compiler versions. - BisectBinDir string `json:"bisect_bin_dir"` - Ccache string `json:"ccache"` - Managers []*ManagerConfig `json:"managers"` + BisectBinDir string `json:"bisect_bin_dir"` + // Keys of BisectIgnore are full commit hashes that should never be reported + // in bisection results. + // Values of the map are ignored and can e.g. serve as comments. + BisectIgnore map[string]string `json:"bisect_ignore"` + Ccache string `json:"ccache"` + Managers []*ManagerConfig `json:"managers"` // Poll period for jobs in seconds (optional, defaults to 10 seconds) JobPollPeriod int `json:"job_poll_period"` // Set up a second (parallel) job processor to speed up processing. -- cgit mrf-deployment