aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/host
diff options
context:
space:
mode:
authorMarco Elver <elver@google.com>2019-10-04 13:43:02 +0200
committerDmitry Vyukov <dvyukov@google.com>2019-10-04 13:44:09 +0200
commitb2f369e56e13dc135d57c53210ea7ab38b239e94 (patch)
treef740d97da76dbe3c9b1e2de6409e4e6f94c1e375 /pkg/host
parentfc17ba4941e5e2cae9663b84e13627981c29d381 (diff)
executor, host, csource: Add support to enable KCSAN
By default, the current KCSAN .config does not enable KCSAN during boot, since we encounter races during boot which would prevent syzkaller from ever executing. This adds support to detect if KCSAN is available, and enables it on the fuzzer host.
Diffstat (limited to 'pkg/host')
-rw-r--r--pkg/host/host.go5
-rw-r--r--pkg/host/host_linux.go8
2 files changed, 13 insertions, 0 deletions
diff --git a/pkg/host/host.go b/pkg/host/host.go
index c7454d12b..dbd3b9ec3 100644
--- a/pkg/host/host.go
+++ b/pkg/host/host.go
@@ -75,6 +75,7 @@ const (
FeatureLeakChecking
FeatureNetworkInjection
FeatureNetworkDevices
+ FeatureKCSAN
numFeatures
)
@@ -106,6 +107,7 @@ func Check(target *prog.Target) (*Features, error) {
FeatureLeakChecking: {Name: "leak checking", Reason: unsupported},
FeatureNetworkInjection: {Name: "net packet injection", Reason: unsupported},
FeatureNetworkDevices: {Name: "net device setup", Reason: unsupported},
+ FeatureKCSAN: {Name: "concurrency sanitizer", Reason: unsupported},
}
switch target.OS {
case "akaros", "fuchsia", "test":
@@ -142,6 +144,9 @@ func Setup(target *prog.Target, features *Features, featureFlags csource.Feature
if target.OS == "linux" && featureFlags["binfmt_misc"].Enabled {
args = append(args, "binfmt_misc")
}
+ if features[FeatureKCSAN].Enabled {
+ args = append(args, "kcsan")
+ }
_, err := osutil.RunCmd(time.Minute, "", executor, args...)
return err
}
diff --git a/pkg/host/host_linux.go b/pkg/host/host_linux.go
index 25da4b016..da208bbad 100644
--- a/pkg/host/host_linux.go
+++ b/pkg/host/host_linux.go
@@ -395,6 +395,7 @@ func init() {
checkFeature[FeatureLeakChecking] = checkLeakChecking
checkFeature[FeatureNetworkInjection] = checkNetworkInjection
checkFeature[FeatureNetworkDevices] = unconditionallyEnabled
+ checkFeature[FeatureKCSAN] = checkKCSAN
}
func checkCoverage() string {
@@ -556,3 +557,10 @@ func checkDebugFS() string {
}
return ""
}
+
+func checkKCSAN() string {
+ if err := osutil.IsAccessible("/proc/kcsaninfo"); err != nil {
+ return err.Error()
+ }
+ return ""
+}