aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJukka Kaartinen <jukka.kaartinen@unikie.com>2020-04-08 16:44:45 +0300
committerDmitry Vyukov <dvyukov@google.com>2020-07-02 09:32:57 +0200
commitd42301aa2fcaa64823b3ece21f2a9c83335471f5 (patch)
treefb66e5c16d1e2155f369c87c4df324f95eacab50
parentbed103955b496d2edb4bb6ed2ab6396ed9cbb9a1 (diff)
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>
-rw-r--r--pkg/bisect/bisect.go15
-rw-r--r--syz-ci/jobs.go25
-rw-r--r--syz-ci/syz-ci.go2
-rw-r--r--syz-ci/testdata/example.cfg1
4 files changed, 29 insertions, 14 deletions
diff --git a/pkg/bisect/bisect.go b/pkg/bisect/bisect.go
index 1ea8a9738..fb11e5753 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 6fa618bbd..b29a91a72 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 10caf8bb8..d2c0a4dbe 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 9406fa5c3..b9ff45cfd 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",