From 09ff5abc02a0e38bb275a91380fc03d6cd0d47a5 Mon Sep 17 00:00:00 2001 From: Andrey Konovalov Date: Wed, 1 Apr 2020 19:37:07 +0200 Subject: csource, executor: add usb emulation feature The feature gets enabled when /dev/raw-gadget is present and accessible. With this feature enabled, executor will do chmod 0666 /dev/raw-gadget on startup, which makes it possible to do USB fuzzing in setuid and namespace sandboxes. There should be no backwards compatibility issues with syz reproducers that don't explicitly enable this feature, as they currently only work in none sandbox. --- pkg/host/features.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'pkg/host/features.go') diff --git a/pkg/host/features.go b/pkg/host/features.go index 3bc0127b6..707757755 100644 --- a/pkg/host/features.go +++ b/pkg/host/features.go @@ -25,6 +25,7 @@ const ( FeatureNetDevices FeatureKCSAN FeatureDevlinkPCI + FeatureUSBEmulation numFeatures ) @@ -62,6 +63,7 @@ func Check(target *prog.Target) (*Features, error) { FeatureNetDevices: {Name: "net device setup", Reason: unsupported}, FeatureKCSAN: {Name: "concurrency sanitizer", Reason: unsupported}, FeatureDevlinkPCI: {Name: "devlink PCI setup", Reason: unsupported}, + FeatureUSBEmulation: {Name: "USB emulation", Reason: unsupported}, } if targets.Get(target.OS, target.Arch).HostFuzzer { return res, nil @@ -99,6 +101,9 @@ func Setup(target *prog.Target, features *Features, featureFlags csource.Feature if features[FeatureKCSAN].Enabled { args = append(args, "kcsan") } + if features[FeatureUSBEmulation].Enabled { + args = append(args, "usb") + } _, err := osutil.RunCmd(time.Minute, "", executor, args...) return err } -- cgit mrf-deployment