pkg/host: rename some features

Rename some features in preparation for subsequent changes
which will align names across the code base.
This commit is contained in:
Dmitry Vyukov 2019-11-15 10:57:49 +01:00
parent 157653cfe7
commit aa27601f9e
11 changed files with 35 additions and 35 deletions

View File

@ -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 {

View File

@ -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()
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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()

View File

@ -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
}
}

View File

@ -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) }
}

View File

@ -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,
}

View File

@ -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

View File

@ -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 {

View File

@ -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 {