aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-11-29 10:40:36 +0100
committerDmitry Vyukov <dvyukov@google.com>2020-11-30 13:33:18 +0100
commit1fd901159188a5e0c2b3559ae7ec7deff7c4e7a2 (patch)
tree82c9a88630b01824aab94866cbe1d405a7e7219d
parenta142e60d5cf11dc798e4909c97803d75add83a11 (diff)
pkg/mgrconfig: add prog&sys.targets targets to Config
These are widely used with the config as the refactoring shows. This removes a bunch of unnecessary code. Also fixes a number of bugs where we confused Arch with VMArch.
-rw-r--r--pkg/bisect/bisect.go15
-rw-r--r--pkg/bisect/bisect_test.go2
-rw-r--r--pkg/instance/instance.go11
-rw-r--r--pkg/mgrconfig/config.go2
-rw-r--r--pkg/mgrconfig/load.go34
-rw-r--r--pkg/report/report.go6
-rw-r--r--pkg/repro/repro.go8
-rw-r--r--syz-ci/jobs.go2
-rw-r--r--syz-manager/manager.go62
-rw-r--r--syz-manager/rpc.go2
-rw-r--r--tools/syz-bisect/bisect.go4
-rw-r--r--tools/syz-crush/crush.go12
-rw-r--r--tools/syz-repro/repro.go4
-rw-r--r--tools/syz-runtest/runtest.go17
-rw-r--r--tools/syz-testbuild/testbuild.go2
15 files changed, 73 insertions, 110 deletions
diff --git a/pkg/bisect/bisect.go b/pkg/bisect/bisect.go
index 3e64233c6..76c518e6c 100644
--- a/pkg/bisect/bisect.go
+++ b/pkg/bisect/bisect.go
@@ -16,7 +16,6 @@ import (
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/pkg/report"
"github.com/google/syzkaller/pkg/vcs"
- "github.com/google/syzkaller/sys/targets"
)
type Config struct {
@@ -29,7 +28,7 @@ type Config struct {
Kernel KernelConfig
Syzkaller SyzkallerConfig
Repro ReproConfig
- Manager mgrconfig.Config
+ Manager *mgrconfig.Config
}
type KernelConfig struct {
@@ -63,7 +62,6 @@ type ReproConfig struct {
type env struct {
cfg *Config
- target *targets.Target
repo vcs.Repo
bisecter vcs.Bisecter
minimizer vcs.ConfigMinimizer
@@ -116,7 +114,7 @@ func Run(cfg *Config) (*Result, error) {
if err != nil {
return nil, err
}
- inst, err := instance.NewEnv(&cfg.Manager)
+ inst, err := instance.NewEnv(cfg.Manager)
if err != nil {
return nil, err
}
@@ -135,13 +133,8 @@ func runImpl(cfg *Config, repo vcs.Repo, inst instance.Env) (*Result, error) {
if !ok && len(cfg.Kernel.BaselineConfig) != 0 {
return nil, fmt.Errorf("config minimization is not implemented for %v", cfg.Manager.TargetOS)
}
- target := targets.Get(cfg.Manager.TargetOS, cfg.Manager.TargetVMArch)
- if target == nil {
- return nil, fmt.Errorf("unknown target %v/%v", cfg.Manager.TargetOS, cfg.Manager.TargetVMArch)
- }
env := &env{
cfg: cfg,
- target: target,
repo: repo,
bisecter: bisecter,
minimizer: minimizer,
@@ -309,7 +302,7 @@ func (env *env) minimizeConfig() (*testResult, error) {
testResults[hash.Hash(test)] = testRes
return testRes.verdict, err
}
- minConfig, err := env.minimizer.Minimize(env.target, env.cfg.Kernel.Config,
+ minConfig, err := env.minimizer.Minimize(env.cfg.Manager.SysTarget, env.cfg.Kernel.Config,
env.cfg.Kernel.BaselineConfig, env.cfg.Trace, predMinimize)
if err != nil {
return nil, err
@@ -426,7 +419,7 @@ func (env *env) build() (*vcs.Commit, string, error) {
}
env.log("testing commit %v with %v", current.Hash, compilerID)
buildStart := time.Now()
- mgr := &env.cfg.Manager
+ mgr := env.cfg.Manager
if err := build.Clean(mgr.TargetOS, mgr.TargetVMArch, mgr.Type, mgr.KernelSrc); err != nil {
return nil, "", fmt.Errorf("kernel clean failed: %v", err)
}
diff --git a/pkg/bisect/bisect_test.go b/pkg/bisect/bisect_test.go
index 26e157aaa..db4409a5c 100644
--- a/pkg/bisect/bisect_test.go
+++ b/pkg/bisect/bisect_test.go
@@ -126,7 +126,7 @@ func runBisection(t *testing.T, baseDir string, test BisectionTest) (*Result, er
cfg := &Config{
Fix: test.fix,
Trace: trace,
- Manager: mgrconfig.Config{
+ Manager: &mgrconfig.Config{
Derived: mgrconfig.Derived{
TargetOS: targets.TestOS,
TargetVMArch: targets.TestArch64,
diff --git a/pkg/instance/instance.go b/pkg/instance/instance.go
index 467998a60..5ca1c2b78 100644
--- a/pkg/instance/instance.go
+++ b/pkg/instance/instance.go
@@ -22,7 +22,6 @@ import (
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/pkg/report"
"github.com/google/syzkaller/pkg/vcs"
- "github.com/google/syzkaller/prog"
"github.com/google/syzkaller/sys/targets"
"github.com/google/syzkaller/vm"
)
@@ -310,7 +309,7 @@ func (inst *inst) testInstance() error {
// If SyzExecutorCmd is provided, it means that syz-executor is already in
// the image, so no need to copy it.
- executorCmd := targets.Get(inst.cfg.TargetOS, inst.cfg.TargetArch).SyzExecutorCmd
+ executorCmd := inst.cfg.SysTarget.SyzExecutorCmd
if executorCmd == "" {
executorCmd, err = inst.vm.Copy(inst.cfg.SyzExecutorBin)
if err != nil {
@@ -352,7 +351,7 @@ func (inst *inst) testRepro() error {
}
// If SyzExecutorCmd is provided, it means that syz-executor is already in
// the image, so no need to copy it.
- executorCmd := targets.Get(cfg.TargetOS, cfg.TargetArch).SyzExecutorCmd
+ executorCmd := cfg.SysTarget.SyzExecutorCmd
if executorCmd == "" {
executorCmd, err = inst.vm.Copy(inst.cfg.SyzExecutorBin)
if err != nil {
@@ -390,11 +389,7 @@ func (inst *inst) testRepro() error {
if len(inst.reproC) == 0 {
return nil
}
- target, err := prog.GetTarget(cfg.TargetOS, cfg.TargetArch)
- if err != nil {
- return err
- }
- bin, err := csource.BuildNoWarn(target, inst.reproC)
+ bin, err := csource.BuildNoWarn(cfg.Target, inst.reproC)
if err != nil {
return err
}
diff --git a/pkg/mgrconfig/config.go b/pkg/mgrconfig/config.go
index 0fc7316e4..3de0814d5 100644
--- a/pkg/mgrconfig/config.go
+++ b/pkg/mgrconfig/config.go
@@ -9,7 +9,7 @@ type Config struct {
// Instance name (used for identification and as GCE instance prefix).
Name string `json:"name"`
// Target OS/arch, e.g. "linux/arm64" or "linux/amd64/386" (amd64 OS with 386 test process).
- Target string `json:"target"`
+ RawTarget string `json:"target"`
// URL that will display information about the running syz-manager process (e.g. "localhost:50000").
HTTP string `json:"http"`
// TCP address to serve RPC for fuzzer processes (optional).
diff --git a/pkg/mgrconfig/load.go b/pkg/mgrconfig/load.go
index a1bde9efa..d4756a0cd 100644
--- a/pkg/mgrconfig/load.go
+++ b/pkg/mgrconfig/load.go
@@ -19,6 +19,9 @@ import (
// Derived config values that are handy to keep with the config, filled after reading user config.
type Derived struct {
+ Target *prog.Target
+ SysTarget *targets.Target
+
// Parsed Target:
TargetOS string
TargetArch string
@@ -28,6 +31,8 @@ type Derived struct {
SyzFuzzerBin string
SyzExecprogBin string
SyzExecutorBin string
+
+ Syscalls []int
}
func LoadData(data []byte) (*Config, error) {
@@ -81,10 +86,18 @@ func defaultValues() *Config {
func loadPartial(cfg *Config) (*Config, error) {
var err error
- cfg.TargetOS, cfg.TargetVMArch, cfg.TargetArch, err = splitTarget(cfg.Target)
+ cfg.TargetOS, cfg.TargetVMArch, cfg.TargetArch, err = splitTarget(cfg.RawTarget)
+ if err != nil {
+ return nil, err
+ }
+ cfg.Target, err = prog.GetTarget(cfg.TargetOS, cfg.TargetArch)
if err != nil {
return nil, err
}
+ cfg.SysTarget = targets.Get(cfg.TargetOS, cfg.TargetVMArch)
+ if cfg.SysTarget == nil {
+ return nil, fmt.Errorf("unsupported OS/arch: %v/%v", cfg.TargetOS, cfg.TargetVMArch)
+ }
return cfg, nil
}
@@ -114,7 +127,7 @@ func Complete(cfg *Config) error {
}
cfg.Image = osutil.Abs(cfg.Image)
}
- if err := completeBinaries(cfg); err != nil {
+ if err := cfg.completeBinaries(); err != nil {
return err
}
if cfg.Procs < 1 || cfg.Procs > prog.MaxPids {
@@ -125,7 +138,7 @@ func Complete(cfg *Config) error {
default:
return fmt.Errorf("config param sandbox must contain one of none/setuid/namespace/android")
}
- if err := checkSSHParams(cfg); err != nil {
+ if err := cfg.checkSSHParams(); err != nil {
return err
}
cfg.CompleteKernelDirs()
@@ -148,6 +161,11 @@ func Complete(cfg *Config) error {
return err
}
}
+ var err error
+ cfg.Syscalls, err = ParseEnabledSyscalls(cfg.Target, cfg.EnabledSyscalls, cfg.DisabledSyscalls)
+ if err != nil {
+ return err
+ }
return nil
}
@@ -172,7 +190,7 @@ func (cfg *Config) CompleteKernelDirs() {
cfg.KernelBuildSrc = osutil.Abs(cfg.KernelBuildSrc)
}
-func checkSSHParams(cfg *Config) error {
+func (cfg *Config) checkSSHParams() error {
if cfg.SSHKey == "" {
return nil
}
@@ -187,13 +205,9 @@ func checkSSHParams(cfg *Config) error {
return nil
}
-func completeBinaries(cfg *Config) error {
- sysTarget := targets.Get(cfg.TargetOS, cfg.TargetArch)
- if sysTarget == nil {
- return fmt.Errorf("unsupported OS/arch: %v/%v", cfg.TargetOS, cfg.TargetArch)
- }
+func (cfg *Config) completeBinaries() error {
cfg.Syzkaller = osutil.Abs(cfg.Syzkaller)
- exe := sysTarget.ExeExtension
+ exe := cfg.SysTarget.ExeExtension
targetBin := func(name, arch string) string {
return filepath.Join(cfg.Syzkaller, "bin", cfg.TargetOS+"_"+arch, name+exe)
}
diff --git a/pkg/report/report.go b/pkg/report/report.go
index fc923764f..47e8d9412 100644
--- a/pkg/report/report.go
+++ b/pkg/report/report.go
@@ -100,12 +100,8 @@ func NewReporter(cfg *mgrconfig.Config) (Reporter, error) {
if err != nil {
return nil, err
}
- target := targets.Get(cfg.TargetOS, cfg.TargetArch)
- if target == nil && typ != "gvisor" {
- return nil, fmt.Errorf("unknown target %v/%v", cfg.TargetOS, cfg.TargetArch)
- }
config := &config{
- target: target,
+ target: cfg.SysTarget,
kernelSrc: cfg.KernelSrc,
kernelBuildSrc: cfg.KernelBuildSrc,
kernelObj: cfg.KernelObj,
diff --git a/pkg/repro/repro.go b/pkg/repro/repro.go
index 41a3a5874..930127901 100644
--- a/pkg/repro/repro.go
+++ b/pkg/repro/repro.go
@@ -67,11 +67,7 @@ func Run(crashLog []byte, cfg *mgrconfig.Config, features *host.Features, report
if len(vmIndexes) == 0 {
return nil, nil, fmt.Errorf("no VMs provided")
}
- target, err := prog.GetTarget(cfg.TargetOS, cfg.TargetArch)
- if err != nil {
- return nil, nil, err
- }
- entries := target.ParseLog(crashLog)
+ entries := cfg.Target.ParseLog(crashLog)
if len(entries) == 0 {
return nil, nil, fmt.Errorf("crash log does not contain any programs")
}
@@ -101,7 +97,7 @@ func Run(crashLog []byte, cfg *mgrconfig.Config, features *host.Features, report
timeouts = []time.Duration{noOutputTimeout}
}
ctx := &context{
- target: targets.Get(cfg.TargetOS, cfg.TargetArch),
+ target: cfg.SysTarget,
reporter: reporter,
crashTitle: crashTitle,
crashType: crashType,
diff --git a/syz-ci/jobs.go b/syz-ci/jobs.go
index 849e1b3f1..4980fb3ac 100644
--- a/syz-ci/jobs.go
+++ b/syz-ci/jobs.go
@@ -420,7 +420,7 @@ func (jp *JobProcessor) bisect(job *Job, mgrcfg *mgrconfig.Config) error {
Syz: req.ReproSyz,
C: req.ReproC,
},
- Manager: *mgrcfg,
+ Manager: mgrcfg,
}
res, err := bisect.Run(cfg)
diff --git a/syz-manager/manager.go b/syz-manager/manager.go
index 3942e12d5..655661ba1 100644
--- a/syz-manager/manager.go
+++ b/syz-manager/manager.go
@@ -68,7 +68,6 @@ type Manager struct {
mu sync.Mutex
phase int
- configEnabledSyscalls []int
targetEnabledSyscalls map[*prog.Syscall]bool
candidates []rpctype.RPCCandidate // untriaged inputs from corpus and hub
@@ -124,22 +123,10 @@ func main() {
if err != nil {
log.Fatalf("%v", err)
}
- target, err := prog.GetTarget(cfg.TargetOS, cfg.TargetArch)
- if err != nil {
- log.Fatalf("%v", err)
- }
- sysTarget := targets.Get(cfg.TargetOS, cfg.TargetVMArch)
- if sysTarget == nil {
- log.Fatalf("unsupported OS/arch: %v/%v", cfg.TargetOS, cfg.TargetVMArch)
- }
- syscalls, err := mgrconfig.ParseEnabledSyscalls(target, cfg.EnabledSyscalls, cfg.DisabledSyscalls)
- if err != nil {
- log.Fatalf("%v", err)
- }
- RunManager(cfg, target, sysTarget, syscalls)
+ RunManager(cfg)
}
-func RunManager(cfg *mgrconfig.Config, target *prog.Target, sysTarget *targets.Target, syscalls []int) {
+func RunManager(cfg *mgrconfig.Config) {
var vmPool *vm.Pool
// Type "none" is a special case for debugging/development when manager
// does not start any VMs, but instead you start them manually
@@ -161,27 +148,26 @@ func RunManager(cfg *mgrconfig.Config, target *prog.Target, sysTarget *targets.T
}
mgr := &Manager{
- cfg: cfg,
- vmPool: vmPool,
- target: target,
- sysTarget: sysTarget,
- reporter: reporter,
- crashdir: crashdir,
- startTime: time.Now(),
- stats: &Stats{haveHub: cfg.HubClient != ""},
- crashTypes: make(map[string]bool),
- configEnabledSyscalls: syscalls,
- corpus: make(map[string]rpctype.RPCInput),
- disabledHashes: make(map[string]struct{}),
- memoryLeakFrames: make(map[string]bool),
- dataRaceFrames: make(map[string]bool),
- fresh: true,
- vmStop: make(chan bool),
- hubReproQueue: make(chan *Crash, 10),
- needMoreRepros: make(chan chan bool),
- reproRequest: make(chan chan map[string]bool),
- usedFiles: make(map[string]time.Time),
- saturatedCalls: make(map[string]bool),
+ cfg: cfg,
+ vmPool: vmPool,
+ target: cfg.Target,
+ sysTarget: cfg.SysTarget,
+ reporter: reporter,
+ crashdir: crashdir,
+ startTime: time.Now(),
+ stats: &Stats{haveHub: cfg.HubClient != ""},
+ crashTypes: make(map[string]bool),
+ corpus: make(map[string]rpctype.RPCInput),
+ disabledHashes: make(map[string]struct{}),
+ memoryLeakFrames: make(map[string]bool),
+ dataRaceFrames: make(map[string]bool),
+ fresh: true,
+ vmStop: make(chan bool),
+ hubReproQueue: make(chan *Crash, 10),
+ needMoreRepros: make(chan chan bool),
+ reproRequest: make(chan chan map[string]bool),
+ usedFiles: make(map[string]time.Time),
+ saturatedCalls: make(map[string]bool),
}
mgr.preloadCorpus()
@@ -606,7 +592,7 @@ func (mgr *Manager) runInstanceInner(index int, instanceName string) (*report.Re
// If SyzExecutorCmd is provided, it means that syz-executor is already in
// the image, so no need to copy it.
- executorCmd := targets.Get(mgr.cfg.TargetOS, mgr.cfg.TargetArch).SyzExecutorCmd
+ executorCmd := mgr.sysTarget.SyzExecutorCmd
if executorCmd == "" {
executorCmd, err = inst.Copy(mgr.cfg.SyzExecutorBin)
if err != nil {
@@ -1073,7 +1059,7 @@ func (mgr *Manager) machineChecked(a *rpctype.CheckArgs, enabledSyscalls map[*pr
for _, dc := range a.DisabledCalls[mgr.cfg.Sandbox] {
disabled[mgr.target.Syscalls[dc.ID].Name] = dc.Reason
}
- for _, id := range mgr.configEnabledSyscalls {
+ for _, id := range mgr.cfg.Syscalls {
name := mgr.target.Syscalls[id].Name
if reason := disabled[name]; reason != "" {
log.Logf(0, "disabling %v: %v", name, reason)
diff --git a/syz-manager/rpc.go b/syz-manager/rpc.go
index add55f031..7d595342b 100644
--- a/syz-manager/rpc.go
+++ b/syz-manager/rpc.go
@@ -64,7 +64,7 @@ func startRPCServer(mgr *Manager) (*RPCServer, error) {
serv := &RPCServer{
mgr: mgr,
target: mgr.target,
- configEnabledSyscalls: mgr.configEnabledSyscalls,
+ configEnabledSyscalls: mgr.cfg.Syscalls,
stats: mgr.stats,
sandbox: mgr.cfg.Sandbox,
fuzzers: make(map[string]*Fuzzer),
diff --git a/tools/syz-bisect/bisect.go b/tools/syz-bisect/bisect.go
index f50b29095..a7f3ca180 100644
--- a/tools/syz-bisect/bisect.go
+++ b/tools/syz-bisect/bisect.go
@@ -70,7 +70,7 @@ func main() {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
- mgrcfg, err := mgrconfig.LoadPartialData(mycfg.Manager)
+ mgrcfg, err := mgrconfig.LoadData(mycfg.Manager)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
@@ -99,7 +99,7 @@ func main() {
Syzkaller: bisect.SyzkallerConfig{
Repo: mycfg.SyzkallerRepo,
},
- Manager: *mgrcfg,
+ Manager: mgrcfg,
}
loadString("syzkaller.commit", &cfg.Syzkaller.Commit)
loadString("kernel.commit", &cfg.Kernel.Commit)
diff --git a/tools/syz-crush/crush.go b/tools/syz-crush/crush.go
index 164e46da6..778f17b10 100644
--- a/tools/syz-crush/crush.go
+++ b/tools/syz-crush/crush.go
@@ -24,7 +24,6 @@ import (
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/pkg/report"
"github.com/google/syzkaller/prog"
- "github.com/google/syzkaller/sys/targets"
"github.com/google/syzkaller/vm"
)
@@ -60,11 +59,6 @@ func main() {
log.Printf("running until crash is found or till %v", *flagRestartTime)
}
- target, err := prog.GetTarget(cfg.TargetOS, cfg.TargetArch)
- if err != nil {
- log.Fatalf("%v", err)
- }
-
vmPool, err := vm.Create(cfg, *flagDebug)
if err != nil {
log.Fatalf("%v", err)
@@ -90,7 +84,7 @@ func main() {
log.Fatalf("error reading source file from '%s'", reproduceMe)
}
- cfg.SyzExecprogBin, err = csource.BuildNoWarn(target, execprog)
+ cfg.SyzExecprogBin, err = csource.BuildNoWarn(cfg.Target, execprog)
if err != nil {
log.Fatalf("failed to build source file: %v", err)
}
@@ -107,7 +101,7 @@ func main() {
for i := 0; i < vmPool.Count(); i++ {
go func(index int) {
for {
- runDone <- runInstance(target, cfg, reporter, vmPool, index, *flagRestartTime, runType)
+ runDone <- runInstance(cfg.Target, cfg, reporter, vmPool, index, *flagRestartTime, runType)
if atomic.LoadUint32(&shutdown) != 0 || !*flagInfinite {
// If this is the last worker then we can close the channel.
if atomic.AddUint32(&stoppedWorkers, 1) == uint32(vmPool.Count()) {
@@ -181,7 +175,7 @@ func runInstance(target *prog.Target, cfg *mgrconfig.Config, reporter report.Rep
if runType == LogFile {
// If SyzExecutorCmd is provided, it means that syz-executor is already in
// the image, so no need to copy it.
- executorCmd := targets.Get(cfg.TargetOS, cfg.TargetArch).SyzExecutorCmd
+ executorCmd := cfg.SysTarget.SyzExecutorCmd
if executorCmd == "" {
executorCmd, err = inst.Copy(cfg.SyzExecutorBin)
if err != nil {
diff --git a/tools/syz-repro/repro.go b/tools/syz-repro/repro.go
index b73b3db20..b46952931 100644
--- a/tools/syz-repro/repro.go
+++ b/tools/syz-repro/repro.go
@@ -15,7 +15,6 @@ import (
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/pkg/report"
"github.com/google/syzkaller/pkg/repro"
- "github.com/google/syzkaller/prog"
"github.com/google/syzkaller/vm"
)
@@ -40,9 +39,6 @@ func main() {
if err != nil {
log.Fatalf("failed to open log file %v: %v", logFile, err)
}
- if _, err := prog.GetTarget(cfg.TargetOS, cfg.TargetArch); err != nil {
- log.Fatalf("%v", err)
- }
vmPool, err := vm.Create(cfg, *flagDebug)
if err != nil {
log.Fatalf("%v", err)
diff --git a/tools/syz-runtest/runtest.go b/tools/syz-runtest/runtest.go
index b6f25d784..1780c6892 100644
--- a/tools/syz-runtest/runtest.go
+++ b/tools/syz-runtest/runtest.go
@@ -26,7 +26,6 @@ import (
"github.com/google/syzkaller/pkg/runtest"
"github.com/google/syzkaller/prog"
_ "github.com/google/syzkaller/sys"
- "github.com/google/syzkaller/sys/targets"
"github.com/google/syzkaller/vm"
)
@@ -42,10 +41,6 @@ func main() {
if err != nil {
log.Fatal(err)
}
- target, err := prog.GetTarget(cfg.TargetOS, cfg.TargetArch)
- if err != nil {
- log.Fatal(err)
- }
vmPool, err := vm.Create(cfg, *flagDebug)
if err != nil {
log.Fatal(err)
@@ -57,7 +52,6 @@ func main() {
osutil.MkdirAll(cfg.Workdir)
mgr := &Manager{
cfg: cfg,
- target: target,
vmPool: vmPool,
reporter: reporter,
debug: *flagDebug,
@@ -102,7 +96,7 @@ func main() {
for sandbox, ids := range mgr.checkResult.EnabledCalls {
calls := make(map[*prog.Syscall]bool)
for _, id := range ids {
- calls[target.Syscalls[id]] = true
+ calls[cfg.Target.Syscalls[id]] = true
}
enabledCalls[sandbox] = calls
}
@@ -116,8 +110,8 @@ func main() {
fmt.Printf("%-24v: %v calls enabled\n", sandbox+" sandbox", len(calls))
}
ctx := &runtest.Context{
- Dir: filepath.Join(cfg.Syzkaller, "sys", target.OS, targets.TestOS),
- Target: target,
+ Dir: filepath.Join(cfg.Syzkaller, "sys", cfg.Target.OS, "test"),
+ Target: cfg.Target,
Features: mgr.checkResult.Features,
EnabledCalls: enabledCalls,
Requests: mgr.requests,
@@ -137,7 +131,6 @@ func main() {
type Manager struct {
cfg *mgrconfig.Config
- target *prog.Target
vmPool *vm.Pool
reporter report.Reporter
requests chan *runtest.RunRequest
@@ -173,7 +166,7 @@ func (mgr *Manager) boot(name string, index int) (*report.Report, error) {
// If SyzExecutorCmd is provided, it means that syz-executor is already in
// the image, so no need to copy it.
- executorCmd := targets.Get(mgr.cfg.TargetOS, mgr.cfg.TargetArch).SyzExecutorCmd
+ executorCmd := mgr.cfg.SysTarget.SyzExecutorCmd
if executorCmd == "" {
executorCmd, err = inst.Copy(mgr.cfg.SyzExecutorBin)
if err != nil {
@@ -212,7 +205,7 @@ func (mgr *Manager) finishRequest(name string, rep *report.Report) error {
func (mgr *Manager) Connect(a *rpctype.ConnectArgs, r *rpctype.ConnectRes) error {
r.GitRevision = prog.GitRevision
- r.TargetRevision = mgr.target.Revision
+ r.TargetRevision = mgr.cfg.Target.Revision
r.AllSandboxes = true
select {
case <-mgr.checkResultReady:
diff --git a/tools/syz-testbuild/testbuild.go b/tools/syz-testbuild/testbuild.go
index eae70e2ae..69f2c67db 100644
--- a/tools/syz-testbuild/testbuild.go
+++ b/tools/syz-testbuild/testbuild.go
@@ -67,7 +67,7 @@ func main() {
}
defer os.RemoveAll(dir)
cfg := &mgrconfig.Config{
- Target: *flagOS + "/" + *flagArch,
+ RawTarget: *flagOS + "/" + *flagArch,
HTTP: ":0",
Workdir: dir,
KernelSrc: *flagKernelSrc,