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 {
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 {

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 {
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,

View File

@ -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).

View File

@ -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",