aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-09-18 17:38:12 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-09-19 08:37:17 +0000
commit52c1f8045c38bcce0229b2cc3c69b1cbe21eb629 (patch)
tree6795b28e4d5cf644369433d5e1906fbf1bfe7e1b /executor
parent6d197301fe4a048a54f3203599963947b6563bd9 (diff)
sys/linux: add syz_create_resource
syz_create_resource allows to turn any value into a resource. Improve binfmt descriptions using syz_create_resource: we need to pass the same file name to write syscalls and execve. Use syz_create_resource to improve binfmt descriptions.
Diffstat (limited to 'executor')
-rw-r--r--executor/common_linux.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h
index 7356499de..30d29cb05 100644
--- a/executor/common_linux.h
+++ b/executor/common_linux.h
@@ -2277,6 +2277,19 @@ static long syz_memcpy_off(volatile long a0, volatile long a1, volatile long a2,
}
#endif
+#if SYZ_EXECUTOR || __NR_syz_create_resource
+// syz_create_resource(val intptr) intptr
+// Variants of this pseudo-syscall are used to create resources from arbitrary values.
+// For example:
+// syz_create_resource$foo(x int32) resource_foo
+// allows the fuzzer to use the same random int32 value in multiple syscalls,
+// and should increase probability of generation of syscalls related to foo.
+static long syz_create_resource(volatile long val)
+{
+ return val;
+}
+#endif
+
#if (SYZ_EXECUTOR || SYZ_REPEAT && SYZ_NET_INJECTION) && SYZ_EXECUTOR_USES_FORK_SERVER
static void flush_tun()
{