From aa27601f9e978d77b528ddf56e670c24f511d0d2 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 15 Nov 2019 10:57:49 +0100 Subject: pkg/host: rename some features Rename some features in preparation for subsequent changes which will align names across the code base. --- pkg/host/features.go | 20 ++++++++++---------- pkg/host/features_linux.go | 14 +++++++------- pkg/host/host_freebsd.go | 2 +- pkg/host/host_openbsd.go | 2 +- pkg/host/syscalls_linux.go | 2 +- pkg/runtest/run.go | 8 ++++---- 6 files changed, 24 insertions(+), 24 deletions(-) (limited to 'pkg') 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 } } -- cgit mrf-deployment