aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/mgrconfig
diff options
context:
space:
mode:
authorStefan Wiehler <me@sephalon.net>2024-12-02 16:00:37 +0100
committerDmitry Vyukov <dvyukov@google.com>2024-12-17 11:13:44 +0000
commitbc1a1b50f942408a9139887b914f745d9fa02adc (patch)
tree1c41777ce9ba26e8efe80e3fc6d717bde44be707 /pkg/mgrconfig
parentf93b2b552ce5fe589b450ff74ca1b459cdbc71a8 (diff)
all: add support for binaries shipped with target
In some build environments (notably Yocto), syzkaller host and target binaries end up in separate packages for each built architecture, which are then shipped with the respective image/SDK. Add the "Execprog/ExecutorBinOnTarget" and "StraceBinOnTarget" options to the manager config, which when set expects the respective binaries to be shipped with the target image and does not attempt to copy them from the host.
Diffstat (limited to 'pkg/mgrconfig')
-rw-r--r--pkg/mgrconfig/config.go9
-rw-r--r--pkg/mgrconfig/load.go20
2 files changed, 26 insertions, 3 deletions
diff --git a/pkg/mgrconfig/config.go b/pkg/mgrconfig/config.go
index 1e499412a..a02c00c67 100644
--- a/pkg/mgrconfig/config.go
+++ b/pkg/mgrconfig/config.go
@@ -191,6 +191,15 @@ type Config struct {
// If set, for each reproducer syzkaller will run it once more under strace and save
// the output.
StraceBin string `json:"strace_bin"`
+ // If true, syzkaller will expect strace_bin to be part of the target
+ // image instead of copying it from the host (default: false).
+ StraceBinOnTarget bool `json:"strace_bin_on_target"`
+
+ // File in PATH to syz-execprog/executor on the target. If set,
+ // syzkaller will expect the execprog/executor binaries to be part of
+ // the target image instead of copying them from the host.
+ ExecprogBinOnTarget string `json:"execprog_bin_on_target"`
+ ExecutorBinOnTarget string `json:"executor_bin_on_target"`
// Whether to run fsck commands on file system images found in new crash
// reproducers. The fsck logs get reported as assets in the dashboard.
diff --git a/pkg/mgrconfig/load.go b/pkg/mgrconfig/load.go
index ccaebba74..602cf4ec8 100644
--- a/pkg/mgrconfig/load.go
+++ b/pkg/mgrconfig/load.go
@@ -308,17 +308,31 @@ func (cfg *Config) completeBinaries() error {
}
cfg.ExecprogBin = targetBin("syz-execprog", cfg.TargetVMArch)
cfg.ExecutorBin = targetBin("syz-executor", cfg.TargetArch)
- // If the target already provides an executor binary, we don't need to copy it.
+
+ if cfg.ExecprogBinOnTarget != "" {
+ cfg.SysTarget.ExecprogBin = cfg.ExecprogBinOnTarget
+ }
+ if cfg.ExecutorBinOnTarget != "" {
+ cfg.SysTarget.ExecutorBin = cfg.ExecutorBinOnTarget
+ }
+ if cfg.StraceBinOnTarget && cfg.StraceBin == "" {
+ cfg.StraceBin = "strace"
+ }
+
+ // If the target already provides binaries, we don't need to copy them.
+ if cfg.SysTarget.ExecprogBin != "" {
+ cfg.ExecprogBin = ""
+ }
if cfg.SysTarget.ExecutorBin != "" {
cfg.ExecutorBin = ""
}
- if !osutil.IsExist(cfg.ExecprogBin) {
+ if cfg.ExecprogBin != "" && !osutil.IsExist(cfg.ExecprogBin) {
return fmt.Errorf("bad config syzkaller param: can't find %v", cfg.ExecprogBin)
}
if cfg.ExecutorBin != "" && !osutil.IsExist(cfg.ExecutorBin) {
return fmt.Errorf("bad config syzkaller param: can't find %v", cfg.ExecutorBin)
}
- if cfg.StraceBin != "" {
+ if !cfg.StraceBinOnTarget && cfg.StraceBin != "" {
if !osutil.IsExist(cfg.StraceBin) {
return fmt.Errorf("bad config param strace_bin: can't find %v", cfg.StraceBin)
}