diff --git a/pkg/bisect/bisect.go b/pkg/bisect/bisect.go index 1ea8a973..fb11e575 100644 --- a/pkg/bisect/bisect.go +++ b/pkg/bisect/bisect.go @@ -29,13 +29,14 @@ type Config struct { } type KernelConfig struct { - Repo string - Branch string - Commit string - Cmdline string - Sysctl string - Config []byte - Userspace string + Repo string + Branch string + Commit string + Cmdline string + Sysctl string + Config []byte + BaselineConfig []byte + Userspace string } type SyzkallerConfig struct { diff --git a/syz-ci/jobs.go b/syz-ci/jobs.go index 6fa618bb..b29a91a7 100644 --- a/syz-ci/jobs.go +++ b/syz-ci/jobs.go @@ -370,6 +370,16 @@ func (jp *JobProcessor) bisect(job *Job, mgrcfg *mgrconfig.Config) error { if err := instance.OverrideVMCount(mgrcfg, bisect.NumTests); err != nil { return err } + + var baseline []byte + var err error + // Read possible baseline for config minimization + if len(mgr.mgrcfg.KernelBaselineConfig) != 0 { + baseline, err = ioutil.ReadFile(mgr.mgrcfg.KernelBaselineConfig) + if err != nil { + return err + } + } trace := new(bytes.Buffer) cfg := &bisect.Config{ Trace: io.MultiWriter(trace, log.VerboseWriter(3)), @@ -377,13 +387,14 @@ func (jp *JobProcessor) bisect(job *Job, mgrcfg *mgrconfig.Config) error { Fix: req.Type == dashapi.JobBisectFix, BinDir: jp.cfg.BisectBinDir, Kernel: bisect.KernelConfig{ - Repo: mgr.mgrcfg.Repo, - Branch: mgr.mgrcfg.Branch, - Commit: req.KernelCommit, - Cmdline: mgr.mgrcfg.KernelCmdline, - Sysctl: mgr.mgrcfg.KernelSysctl, - Config: req.KernelConfig, - Userspace: mgr.mgrcfg.Userspace, + Repo: mgr.mgrcfg.Repo, + Branch: mgr.mgrcfg.Branch, + Commit: req.KernelCommit, + Cmdline: mgr.mgrcfg.KernelCmdline, + Sysctl: mgr.mgrcfg.KernelSysctl, + Config: req.KernelConfig, + BaselineConfig: baseline, + Userspace: mgr.mgrcfg.Userspace, }, Syzkaller: bisect.SyzkallerConfig{ Repo: jp.syzkallerRepo, diff --git a/syz-ci/syz-ci.go b/syz-ci/syz-ci.go index 10caf8bb..d2c0a4db 100644 --- a/syz-ci/syz-ci.go +++ b/syz-ci/syz-ci.go @@ -108,6 +108,8 @@ type ManagerConfig struct { Compiler string `json:"compiler"` Userspace string `json:"userspace"` KernelConfig string `json:"kernel_config"` + // Baseline config for bisection, see pkg/bisect.KernelConfig.BaselineConfig + KernelBaselineConfig string `json:"kernel_baseline_config"` // File with kernel cmdline values (optional). KernelCmdline string `json:"kernel_cmdline"` // File with sysctl values (e.g. output of sysctl -a, optional). diff --git a/syz-ci/testdata/example.cfg b/syz-ci/testdata/example.cfg index 9406fa5c..b9ff45cf 100644 --- a/syz-ci/testdata/example.cfg +++ b/syz-ci/testdata/example.cfg @@ -15,6 +15,7 @@ "compiler": "/syzkaller/gcc/bin/gcc", "userspace": "/syzkaller/wheezy", "kernel_config": "/syzkaller/kasan.config", + "kernel_baseline_config": "/syzkaller/kasan_baseline.config", "manager_config": { "target": "linux/amd64", "sandbox": "namespace",