aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource/linux_common.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/csource/linux_common.go')
-rw-r--r--pkg/csource/linux_common.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/csource/linux_common.go b/pkg/csource/linux_common.go
index 78d9106de..4e7b0fef4 100644
--- a/pkg/csource/linux_common.go
+++ b/pkg/csource/linux_common.go
@@ -2142,6 +2142,16 @@ static void setup_cgroups()
debug("chmod(/syzcgroup/net) failed: %d\n", errno);
}
}
+
+static void setup_binfmt_misc()
+{
+ if (!write_file("/proc/sys/fs/binfmt_misc/register", ":syz0:M:0:syz0::./file0:")) {
+ debug("write(/proc/sys/fs/binfmt_misc/register, syz0) failed: %d\n", errno);
+ }
+ if (!write_file("/proc/sys/fs/binfmt_misc/register", ":syz1:M:1:yz1::./file0:POC")) {
+ debug("write(/proc/sys/fs/binfmt_misc/register, syz1) failed: %d\n", errno);
+ }
+}
#endif
#if defined(SYZ_EXECUTOR) || defined(SYZ_SANDBOX_NONE) || defined(SYZ_SANDBOX_SETUID) || defined(SYZ_SANDBOX_NAMESPACE)
@@ -2206,6 +2216,7 @@ static int do_sandbox_none(void)
#if defined(SYZ_EXECUTOR) || defined(SYZ_ENABLE_CGROUPS)
setup_cgroups();
+ setup_binfmt_misc();
#endif
sandbox_common();
if (unshare(CLONE_NEWNET)) {
@@ -2234,6 +2245,7 @@ static int do_sandbox_setuid(void)
#if defined(SYZ_EXECUTOR) || defined(SYZ_ENABLE_CGROUPS)
setup_cgroups();
+ setup_binfmt_misc();
#endif
sandbox_common();
if (unshare(CLONE_NEWNET))
@@ -2367,6 +2379,7 @@ static int do_sandbox_namespace(void)
#if defined(SYZ_EXECUTOR) || defined(SYZ_ENABLE_CGROUPS)
setup_cgroups();
+ setup_binfmt_misc();
#endif
real_uid = getuid();
real_gid = getgid();