Pass baseline config around

Add new new Syzkaller configuration option kernel_baseline_config. This option
is supposed to be used by kernel configruation bisection as a "good" config"

Signed-off-by: Jukka Kaartinen <jukka.kaartinen@unikie.com>
Signed-off-by: Jouni Hogander <jouni.hogander@unikie.com>
This commit is contained in:
Jukka Kaartinen 2020-04-08 16:44:45 +03:00 committed by Dmitry Vyukov
parent bed103955b
commit d42301aa2f
4 changed files with 29 additions and 14 deletions

View File

@ -29,13 +29,14 @@ type Config struct {
} }
type KernelConfig struct { type KernelConfig struct {
Repo string Repo string
Branch string Branch string
Commit string Commit string
Cmdline string Cmdline string
Sysctl string Sysctl string
Config []byte Config []byte
Userspace string BaselineConfig []byte
Userspace string
} }
type SyzkallerConfig struct { type SyzkallerConfig struct {

View File

@ -370,6 +370,16 @@ func (jp *JobProcessor) bisect(job *Job, mgrcfg *mgrconfig.Config) error {
if err := instance.OverrideVMCount(mgrcfg, bisect.NumTests); err != nil { if err := instance.OverrideVMCount(mgrcfg, bisect.NumTests); err != nil {
return err 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) trace := new(bytes.Buffer)
cfg := &bisect.Config{ cfg := &bisect.Config{
Trace: io.MultiWriter(trace, log.VerboseWriter(3)), 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, Fix: req.Type == dashapi.JobBisectFix,
BinDir: jp.cfg.BisectBinDir, BinDir: jp.cfg.BisectBinDir,
Kernel: bisect.KernelConfig{ Kernel: bisect.KernelConfig{
Repo: mgr.mgrcfg.Repo, Repo: mgr.mgrcfg.Repo,
Branch: mgr.mgrcfg.Branch, Branch: mgr.mgrcfg.Branch,
Commit: req.KernelCommit, Commit: req.KernelCommit,
Cmdline: mgr.mgrcfg.KernelCmdline, Cmdline: mgr.mgrcfg.KernelCmdline,
Sysctl: mgr.mgrcfg.KernelSysctl, Sysctl: mgr.mgrcfg.KernelSysctl,
Config: req.KernelConfig, Config: req.KernelConfig,
Userspace: mgr.mgrcfg.Userspace, BaselineConfig: baseline,
Userspace: mgr.mgrcfg.Userspace,
}, },
Syzkaller: bisect.SyzkallerConfig{ Syzkaller: bisect.SyzkallerConfig{
Repo: jp.syzkallerRepo, Repo: jp.syzkallerRepo,

View File

@ -108,6 +108,8 @@ type ManagerConfig struct {
Compiler string `json:"compiler"` Compiler string `json:"compiler"`
Userspace string `json:"userspace"` Userspace string `json:"userspace"`
KernelConfig string `json:"kernel_config"` 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). // File with kernel cmdline values (optional).
KernelCmdline string `json:"kernel_cmdline"` KernelCmdline string `json:"kernel_cmdline"`
// File with sysctl values (e.g. output of sysctl -a, optional). // File with sysctl values (e.g. output of sysctl -a, optional).

View File

@ -15,6 +15,7 @@
"compiler": "/syzkaller/gcc/bin/gcc", "compiler": "/syzkaller/gcc/bin/gcc",
"userspace": "/syzkaller/wheezy", "userspace": "/syzkaller/wheezy",
"kernel_config": "/syzkaller/kasan.config", "kernel_config": "/syzkaller/kasan.config",
"kernel_baseline_config": "/syzkaller/kasan_baseline.config",
"manager_config": { "manager_config": {
"target": "linux/amd64", "target": "linux/amd64",
"sandbox": "namespace", "sandbox": "namespace",