aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/mgrconfig/load.go
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/load.go
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/load.go')
-rw-r--r--pkg/mgrconfig/load.go20
1 files changed, 17 insertions, 3 deletions
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)
}