diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2019-11-15 10:57:49 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-11-16 09:58:54 +0100 |
| commit | aa27601f9e978d77b528ddf56e670c24f511d0d2 (patch) | |
| tree | db0dc0f71a6e2b9c92cf675d6752d39344b57629 | |
| parent | 157653cfe75287b566755e9aed29a552f74d7e4c (diff) | |
pkg/host: rename some features
Rename some features in preparation for subsequent changes
which will align names across the code base.
| -rw-r--r-- | pkg/host/features.go | 20 | ||||
| -rw-r--r-- | pkg/host/features_linux.go | 14 | ||||
| -rw-r--r-- | pkg/host/host_freebsd.go | 2 | ||||
| -rw-r--r-- | pkg/host/host_openbsd.go | 2 | ||||
| -rw-r--r-- | pkg/host/syscalls_linux.go | 2 | ||||
| -rw-r--r-- | pkg/runtest/run.go | 8 | ||||
| -rw-r--r-- | syz-fuzzer/fuzzer.go | 8 | ||||
| -rw-r--r-- | syz-manager/hub.go | 2 | ||||
| -rw-r--r-- | syz-manager/manager.go | 2 | ||||
| -rw-r--r-- | tools/syz-execprog/execprog.go | 6 | ||||
| -rw-r--r-- | tools/syz-stress/stress.go | 4 |
11 files changed, 35 insertions, 35 deletions
diff --git a/pkg/host/features.go b/pkg/host/features.go index 53af77241..9c02defbd 100644 --- a/pkg/host/features.go +++ b/pkg/host/features.go @@ -19,10 +19,10 @@ const ( FeatureSandboxSetuid FeatureSandboxNamespace FeatureSandboxAndroid - FeatureFaultInjection - FeatureLeakChecking - FeatureNetworkInjection - FeatureNetworkDevices + FeatureFault + FeatureLeak + FeatureNetInjection + FeatureNetDevices FeatureKCSAN FeatureDevlinkPCI numFeatures @@ -52,10 +52,10 @@ func Check(target *prog.Target) (*Features, error) { FeatureSandboxSetuid: {Name: "setuid sandbox", Reason: unsupported}, FeatureSandboxNamespace: {Name: "namespace sandbox", Reason: unsupported}, FeatureSandboxAndroid: {Name: "Android sandbox", Reason: unsupported}, - FeatureFaultInjection: {Name: "fault injection", Reason: unsupported}, - FeatureLeakChecking: {Name: "leak checking", Reason: unsupported}, - FeatureNetworkInjection: {Name: "net packet injection", Reason: unsupported}, - FeatureNetworkDevices: {Name: "net device setup", Reason: unsupported}, + FeatureFault: {Name: "fault injection", Reason: unsupported}, + FeatureLeak: {Name: "leak checking", Reason: unsupported}, + FeatureNetInjection: {Name: "net packet injection", Reason: unsupported}, + FeatureNetDevices: {Name: "net device setup", Reason: unsupported}, FeatureKCSAN: {Name: "concurrency sanitizer", Reason: unsupported}, FeatureDevlinkPCI: {Name: "devlink PCI setup", Reason: unsupported}, } @@ -83,10 +83,10 @@ func Setup(target *prog.Target, features *Features, featureFlags csource.Feature return nil } args := []string{"setup"} - if features[FeatureLeakChecking].Enabled { + if features[FeatureLeak].Enabled { args = append(args, "leak") } - if features[FeatureFaultInjection].Enabled { + if features[FeatureFault].Enabled { args = append(args, "fault") } if target.OS == "linux" && featureFlags["binfmt_misc"].Enabled { diff --git a/pkg/host/features_linux.go b/pkg/host/features_linux.go index a1586e8ac..7b4b7b243 100644 --- a/pkg/host/features_linux.go +++ b/pkg/host/features_linux.go @@ -21,10 +21,10 @@ func init() { checkFeature[FeatureSandboxSetuid] = unconditionallyEnabled checkFeature[FeatureSandboxNamespace] = checkSandboxNamespace checkFeature[FeatureSandboxAndroid] = checkSandboxAndroid - checkFeature[FeatureFaultInjection] = checkFaultInjection - checkFeature[FeatureLeakChecking] = checkLeakChecking - checkFeature[FeatureNetworkInjection] = checkNetworkInjection - checkFeature[FeatureNetworkDevices] = unconditionallyEnabled + checkFeature[FeatureFault] = checkFault + checkFeature[FeatureLeak] = checkLeak + checkFeature[FeatureNetInjection] = checkNetInjection + checkFeature[FeatureNetDevices] = unconditionallyEnabled checkFeature[FeatureKCSAN] = checkKCSAN checkFeature[FeatureDevlinkPCI] = checkDevlinkPCI } @@ -128,7 +128,7 @@ type KcovRemoteArg struct { // Handles []uint64 goes here. } -func checkFaultInjection() string { +func checkFault() string { if err := osutil.IsAccessible("/proc/self/make-it-fail"); err != nil { return "CONFIG_FAULT_INJECTION is not enabled" } @@ -144,7 +144,7 @@ func checkFaultInjection() string { return "" } -func checkLeakChecking() string { +func checkLeak() string { if reason := checkDebugFS(); reason != "" { return reason } @@ -176,7 +176,7 @@ func checkSandboxAndroid() string { return "" } -func checkNetworkInjection() string { +func checkNetInjection() string { if err := osutil.IsAccessible("/dev/net/tun"); err != nil { return err.Error() } diff --git a/pkg/host/host_freebsd.go b/pkg/host/host_freebsd.go index a377c5280..0f86a1f9c 100644 --- a/pkg/host/host_freebsd.go +++ b/pkg/host/host_freebsd.go @@ -14,5 +14,5 @@ func isSupported(c *prog.Syscall, target *prog.Target, sandbox string) (bool, st func init() { checkFeature[FeatureCoverage] = unconditionallyEnabled checkFeature[FeatureComparisons] = unconditionallyEnabled - checkFeature[FeatureNetworkInjection] = unconditionallyEnabled + checkFeature[FeatureNetInjection] = unconditionallyEnabled } diff --git a/pkg/host/host_openbsd.go b/pkg/host/host_openbsd.go index bbf373de9..5a42edc57 100644 --- a/pkg/host/host_openbsd.go +++ b/pkg/host/host_openbsd.go @@ -31,6 +31,6 @@ func isSupportedVMM() (bool, string) { func init() { checkFeature[FeatureCoverage] = unconditionallyEnabled checkFeature[FeatureComparisons] = unconditionallyEnabled - checkFeature[FeatureNetworkInjection] = unconditionallyEnabled + checkFeature[FeatureNetInjection] = unconditionallyEnabled checkFeature[FeatureSandboxSetuid] = unconditionallyEnabled } diff --git a/pkg/host/syscalls_linux.go b/pkg/host/syscalls_linux.go index dff19fb01..5e67d05eb 100644 --- a/pkg/host/syscalls_linux.go +++ b/pkg/host/syscalls_linux.go @@ -201,7 +201,7 @@ func isSupportedSyzkall(sandbox string, c *prog.Syscall) (bool, string) { case "syz_open_pts": return true, "" case "syz_emit_ethernet", "syz_extract_tcp_res": - reason := checkNetworkInjection() + reason := checkNetInjection() return reason == "", reason case "syz_usb_connect", "syz_usb_disconnect", "syz_usb_control_io", "syz_usb_ep_write", "syz_usb_ep_read": reason := checkUSBInjection() diff --git a/pkg/runtest/run.go b/pkg/runtest/run.go index 09b87e83e..d1d193b6d 100644 --- a/pkg/runtest/run.go +++ b/pkg/runtest/run.go @@ -373,10 +373,10 @@ func (ctx *Context) createSyzTest(p *prog.Prog, sandbox string, threaded, cov bo if ctx.Features[host.FeatureExtraCoverage].Enabled { cfg.Flags |= ipc.FlagExtraCover } - if ctx.Features[host.FeatureNetworkInjection].Enabled { + if ctx.Features[host.FeatureNetInjection].Enabled { cfg.Flags |= ipc.FlagEnableTun } - if ctx.Features[host.FeatureNetworkDevices].Enabled { + if ctx.Features[host.FeatureNetDevices].Enabled { cfg.Flags |= ipc.FlagEnableNetDev } cfg.Flags |= ipc.FlagEnableNetReset @@ -407,10 +407,10 @@ func (ctx *Context) createCTest(p *prog.Prog, sandbox string, threaded bool, tim Trace: true, } if sandbox != "" { - if ctx.Features[host.FeatureNetworkInjection].Enabled { + if ctx.Features[host.FeatureNetInjection].Enabled { opts.NetInjection = true } - if ctx.Features[host.FeatureNetworkDevices].Enabled { + if ctx.Features[host.FeatureNetDevices].Enabled { opts.NetDevices = true } } diff --git a/syz-fuzzer/fuzzer.go b/syz-fuzzer/fuzzer.go index 5cc7df893..a95480a6b 100644 --- a/syz-fuzzer/fuzzer.go +++ b/syz-fuzzer/fuzzer.go @@ -205,10 +205,10 @@ func main() { if r.CheckResult.Features[host.FeatureExtraCoverage].Enabled { config.Flags |= ipc.FlagExtraCover } - if r.CheckResult.Features[host.FeatureNetworkInjection].Enabled { + if r.CheckResult.Features[host.FeatureNetInjection].Enabled { config.Flags |= ipc.FlagEnableTun } - if r.CheckResult.Features[host.FeatureNetworkDevices].Enabled { + if r.CheckResult.Features[host.FeatureNetDevices].Enabled { config.Flags |= ipc.FlagEnableNetDev } config.Flags |= ipc.FlagEnableNetReset @@ -234,7 +234,7 @@ func main() { needPoll: needPoll, manager: manager, target: target, - faultInjectionEnabled: r.CheckResult.Features[host.FeatureFaultInjection].Enabled, + faultInjectionEnabled: r.CheckResult.Features[host.FeatureFault].Enabled, comparisonTracingEnabled: r.CheckResult.Features[host.FeatureComparisons].Enabled, corpusHashes: make(map[hash.Sig]struct{}), } @@ -266,7 +266,7 @@ func main() { func (fuzzer *Fuzzer) useBugFrames(r *rpctype.ConnectRes, flagProcs int) func() { var gateCallback func() - if r.CheckResult.Features[host.FeatureLeakChecking].Enabled { + if r.CheckResult.Features[host.FeatureLeak].Enabled { gateCallback = func() { fuzzer.gateCallback(r.MemoryLeakFrames) } } diff --git a/syz-manager/hub.go b/syz-manager/hub.go index 5f85c8fe2..1287e4bd9 100644 --- a/syz-manager/hub.go +++ b/syz-manager/hub.go @@ -22,7 +22,7 @@ func (mgr *Manager) hubSyncLoop() { target: mgr.target, stats: mgr.stats, enabledCalls: mgr.checkResult.EnabledCalls[mgr.cfg.Sandbox], - leak: mgr.checkResult.Features[host.FeatureLeakChecking].Enabled, + leak: mgr.checkResult.Features[host.FeatureLeak].Enabled, fresh: mgr.fresh, hubReproQueue: mgr.hubReproQueue, } diff --git a/syz-manager/manager.go b/syz-manager/manager.go index 0aaee7828..a305e7446 100644 --- a/syz-manager/manager.go +++ b/syz-manager/manager.go @@ -681,7 +681,7 @@ func (mgr *Manager) needLocalRepro(crash *Crash) bool { if !mgr.cfg.Reproduce || crash.Corrupted { return false } - if mgr.checkResult.Features[host.FeatureLeakChecking].Enabled && + if mgr.checkResult.Features[host.FeatureLeak].Enabled && crash.Type != report.MemoryLeak { // Leak checking is very slow, don't bother reproducing other crashes. return false diff --git a/tools/syz-execprog/execprog.go b/tools/syz-execprog/execprog.go index 909715b7c..5aaf81d2f 100644 --- a/tools/syz-execprog/execprog.go +++ b/tools/syz-execprog/execprog.go @@ -78,7 +78,7 @@ func main() { log.Fatal(err) } var gateCallback func() - if features[host.FeatureLeakChecking].Enabled { + if features[host.FeatureLeak].Enabled { gateCallback = func() { output, err := osutil.RunCmd(10*time.Minute, "", config.Executor, "leak") if err != nil { @@ -311,10 +311,10 @@ func createConfig(target *prog.Target, execOpts.FaultCall = *flagFaultCall execOpts.FaultNth = *flagFaultNth } - if featuresFlags["tun"].Enabled && features[host.FeatureNetworkInjection].Enabled { + if featuresFlags["tun"].Enabled && features[host.FeatureNetInjection].Enabled { config.Flags |= ipc.FlagEnableTun } - if featuresFlags["net_dev"].Enabled && features[host.FeatureNetworkDevices].Enabled { + if featuresFlags["net_dev"].Enabled && features[host.FeatureNetDevices].Enabled { config.Flags |= ipc.FlagEnableNetDev } if featuresFlags["net_reset"].Enabled { diff --git a/tools/syz-stress/stress.go b/tools/syz-stress/stress.go index f974a8cf2..3ca669a1b 100644 --- a/tools/syz-stress/stress.go +++ b/tools/syz-stress/stress.go @@ -147,10 +147,10 @@ func createIPCConfig(target *prog.Target, features *host.Features, featuresFlags if err != nil { return nil, nil, err } - if featuresFlags["tun"].Enabled && features[host.FeatureNetworkInjection].Enabled { + if featuresFlags["tun"].Enabled && features[host.FeatureNetInjection].Enabled { config.Flags |= ipc.FlagEnableTun } - if featuresFlags["net_dev"].Enabled && features[host.FeatureNetworkDevices].Enabled { + if featuresFlags["net_dev"].Enabled && features[host.FeatureNetDevices].Enabled { config.Flags |= ipc.FlagEnableNetDev } if featuresFlags["net_reset"].Enabled { |
