aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource/generated.go
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2020-04-01 19:37:07 +0200
committerAndrey Konovalov <andreyknvl@gmail.com>2020-04-03 12:42:06 +0200
commit09ff5abc02a0e38bb275a91380fc03d6cd0d47a5 (patch)
treea39602cd91fbad39b6e10a8455b58d7f59831965 /pkg/csource/generated.go
parentca1beb07f02e67ba2faa81a5b56b061111f818f3 (diff)
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.
Diffstat (limited to 'pkg/csource/generated.go')
-rw-r--r--pkg/csource/generated.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go
index 3bf6c0aa8..98619862b 100644
--- a/pkg/csource/generated.go
+++ b/pkg/csource/generated.go
@@ -7066,6 +7066,14 @@ static void setup_kcsan_filterlist(char** frames, int nframes, bool blacklist)
#endif
#endif
+#if SYZ_EXECUTOR || SYZ_USB
+static void setup_usb()
+{
+ if (chmod("/dev/raw-gadget", 0666))
+ fail("failed to chmod /dev/raw-gadget");
+}
+#endif
+
#elif GOOS_test
#include <stdlib.h>
@@ -7549,6 +7557,9 @@ int main(void)
#if SYZ_KCSAN
setup_kcsan();
#endif
+#if SYZ_USB
+ setup_usb();
+#endif
#if SYZ_HANDLE_SEGV
install_segv_handler();