aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-06-04 12:55:41 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-06-24 09:57:34 +0000
commite16e2c9a4cb6937323e861b646792a6c4c978a3c (patch)
tree6c513e98e5f465b44a98546d8984485d2c128582 /pkg/csource
parent90d67044dab68568e8f35bc14b68055dbd166eff (diff)
executor: add runner mode
Move all syz-fuzzer logic into syz-executor and remove syz-fuzzer. Also restore syz-runtest functionality in the manager. Update #4917 (sets most signal handlers to SIG_IGN)
Diffstat (limited to 'pkg/csource')
-rw-r--r--pkg/csource/options.go58
1 files changed, 58 insertions, 0 deletions
diff --git a/pkg/csource/options.go b/pkg/csource/options.go
index ba6dcfbed..ba44dd021 100644
--- a/pkg/csource/options.go
+++ b/pkg/csource/options.go
@@ -11,6 +11,7 @@ import (
"sort"
"strings"
+ "github.com/google/syzkaller/pkg/flatrpc"
"github.com/google/syzkaller/pkg/mgrconfig"
"github.com/google/syzkaller/sys/targets"
)
@@ -364,3 +365,60 @@ var ExecutorOpts = Options{
Sandbox: "none",
UseTmpDir: true,
}
+
+func FeaturesToFlags(features flatrpc.Feature, manual Features) flatrpc.ExecEnv {
+ for feat := range flatrpc.EnumNamesFeature {
+ opt := FlatRPCFeaturesToCSource[feat]
+ if opt != "" && manual != nil && !manual[opt].Enabled {
+ features &= ^feat
+ }
+ }
+ var flags flatrpc.ExecEnv
+ if manual == nil || manual["net_reset"].Enabled {
+ flags |= flatrpc.ExecEnvEnableNetReset
+ }
+ if manual == nil || manual["cgroups"].Enabled {
+ flags |= flatrpc.ExecEnvEnableCgroups
+ }
+ if manual == nil || manual["close_fds"].Enabled {
+ flags |= flatrpc.ExecEnvEnableCloseFds
+ }
+ if features&flatrpc.FeatureExtraCoverage != 0 {
+ flags |= flatrpc.ExecEnvExtraCover
+ }
+ if features&flatrpc.FeatureDelayKcovMmap != 0 {
+ flags |= flatrpc.ExecEnvDelayKcovMmap
+ }
+ if features&flatrpc.FeatureNetInjection != 0 {
+ flags |= flatrpc.ExecEnvEnableTun
+ }
+ if features&flatrpc.FeatureNetDevices != 0 {
+ flags |= flatrpc.ExecEnvEnableNetDev
+ }
+ if features&flatrpc.FeatureDevlinkPCI != 0 {
+ flags |= flatrpc.ExecEnvEnableDevlinkPCI
+ }
+ if features&flatrpc.FeatureNicVF != 0 {
+ flags |= flatrpc.ExecEnvEnableNicVF
+ }
+ if features&flatrpc.FeatureVhciInjection != 0 {
+ flags |= flatrpc.ExecEnvEnableVhciInjection
+ }
+ if features&flatrpc.FeatureWifiEmulation != 0 {
+ flags |= flatrpc.ExecEnvEnableWifi
+ }
+ return flags
+}
+
+var FlatRPCFeaturesToCSource = map[flatrpc.Feature]string{
+ flatrpc.FeatureNetInjection: "tun",
+ flatrpc.FeatureNetDevices: "net_dev",
+ flatrpc.FeatureDevlinkPCI: "devlink_pci",
+ flatrpc.FeatureNicVF: "nic_vf",
+ flatrpc.FeatureVhciInjection: "vhci",
+ flatrpc.FeatureWifiEmulation: "wifi",
+ flatrpc.FeatureUSBEmulation: "usb",
+ flatrpc.FeatureBinFmtMisc: "binfmt_misc",
+ flatrpc.FeatureLRWPANEmulation: "ieee802154",
+ flatrpc.FeatureSwap: "swap",
+}