aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_linux.h
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-11-27 17:23:09 +0100
committerDmitry Vyukov <dvyukov@google.com>2024-12-11 15:22:17 +0000
commita9a0ffed7ef93dd86695100cf081438a918d6026 (patch)
tree4731e02f6854a978b45d90c24f530ed13257826e /executor/common_linux.h
parent299ee674e6c124a35f1cf258df4f0f3c6e1db1f3 (diff)
executor: mount gadgetfs
We can reach it at least with automatic descriptions.
Diffstat (limited to 'executor/common_linux.h')
-rw-r--r--executor/common_linux.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h
index 5fc1bec2c..e63b0479f 100644
--- a/executor/common_linux.h
+++ b/executor/common_linux.h
@@ -3906,6 +3906,7 @@ static void initialize_cgroups()
#endif
#if SYZ_EXECUTOR || SYZ_SANDBOX_NONE || SYZ_SANDBOX_NAMESPACE
+static void setup_gadgetfs();
static void setup_binderfs();
static void setup_fusectl();
// Mount tmpfs and chroot into it in sandbox=none and sandbox=namespace.
@@ -3972,11 +3973,27 @@ static void sandbox_common_mount_tmpfs(void)
fail("chroot failed");
if (chdir("/"))
fail("chdir failed");
+ setup_gadgetfs();
setup_binderfs();
setup_fusectl();
}
#endif
+#if SYZ_EXECUTOR || SYZ_SANDBOX_NONE || SYZ_SANDBOX_NAMESPACE
+#include <sys/mount.h>
+#include <sys/stat.h>
+
+static void setup_gadgetfs()
+{
+ if (mkdir("/dev/gadgetfs", 0777)) {
+ debug("mkdir(/dev/gadgetfs) failed: %d\n", errno);
+ }
+ if (mount("gadgetfs", "/dev/gadgetfs", "gadgetfs", 0, NULL)) {
+ debug("mount of gadgetfs at /dev/gadgetfs failed: %d\n", errno);
+ }
+}
+#endif
+
#if SYZ_EXECUTOR || SYZ_SANDBOX_NONE || SYZ_SANDBOX_SETUID || SYZ_SANDBOX_NAMESPACE || SYZ_SANDBOX_ANDROID
#include <errno.h>
#include <sys/mount.h>