aboutsummaryrefslogtreecommitdiffstats
path: root/sys/linux
diff options
context:
space:
mode:
Diffstat (limited to 'sys/linux')
-rw-r--r--sys/linux/sys.txt11
-rw-r--r--sys/linux/test/landlock_ptrace7
-rw-r--r--sys/linux/test/syz_clone1
-rw-r--r--sys/linux/test/syz_clone33
4 files changed, 14 insertions, 8 deletions
diff --git a/sys/linux/sys.txt b/sys/linux/sys.txt
index fd934f976..8664e09a8 100644
--- a/sys/linux/sys.txt
+++ b/sys/linux/sys.txt
@@ -293,9 +293,14 @@ utimes(filename ptr[in, filename], times ptr[in, itimerval])
futimesat(dir fd_dir, pathname ptr[in, filename], times ptr[in, itimerval])
utimensat(dir fd_dir, pathname ptr[in, filename], times ptr[in, itimerval], flags flags[utimensat_flags])
-fork() pid (breaks_returns)
-clone(flags flags[clone_flags], sp buffer[in], parentid ptr[out, int32], childtid ptr[out, int32], tls buffer[in]) (breaks_returns)
-clone3(args ptr[in, clone_args], size bytesize[args]) pid (breaks_returns)
+# Small trick - syzkaller cannot give the proper stack pointer to clone(), but we can do it with the aid of pseudo syscalls.
+syz_clone(flags flags[clone_flags], stack buffer[in], stack_len bytesize[stack], parentid ptr[out, int32], childtid ptr[out, int32], tls buffer[in]) pid
+
+syz_clone3(args ptr[in, clone_args], size bytesize[args]) pid
+
+# We need these disabled definitions to simplify the presence and the NR checking.
+clone(flags flags[clone_flags], sp buffer[in], parentid ptr[out, int32], childtid ptr[out, int32], tls buffer[in]) (breaks_returns, disabled)
+clone3(args ptr[in, clone_args], size bytesize[args]) pid (breaks_returns, disabled)
clone_args {
flags flags[clone3_flags, int64]
diff --git a/sys/linux/test/landlock_ptrace b/sys/linux/test/landlock_ptrace
index e3037386d..ad63f3e5c 100644
--- a/sys/linux/test/landlock_ptrace
+++ b/sys/linux/test/landlock_ptrace
@@ -1,13 +1,10 @@
# Creates independent Landlock hierarchies and try different tracer/tracee
# schemas (without scheduling control).
-#
-# fork() is not available for the following architectures:
-# requires: -arch=arm64 -arch=riscv64
capset(&AUTO={0x20080522, 0x0}, &AUTO={0x0, 0x0, 0x0, 0x0, 0x0, 0x0})
prctl$PR_SET_NO_NEW_PRIVS(0x26, 0x1)
-r0 = fork()
+r0 = syz_clone(0x11, 0x0, 0x0, 0x0, 0x0, 0x0)
# PTRACE_ATTACH and PTRACE_DETACH
@@ -17,7 +14,7 @@ ptrace(0x11, r0)
r1 = landlock_create_ruleset(&AUTO={0x100}, AUTO, 0x0)
landlock_restrict_self(r1, 0x0)
-r2 = fork()
+r2 = syz_clone(0x11, 0x0, 0x0, 0x0, 0x0, 0x0)
ptrace(0x10, r0)
ptrace(0x11, r0)
diff --git a/sys/linux/test/syz_clone b/sys/linux/test/syz_clone
new file mode 100644
index 000000000..23022429c
--- /dev/null
+++ b/sys/linux/test/syz_clone
@@ -0,0 +1 @@
+syz_clone(0x11, 0x0, 0x0, 0x0, 0x0, 0x0)
diff --git a/sys/linux/test/syz_clone3 b/sys/linux/test/syz_clone3
new file mode 100644
index 000000000..5539d7f86
--- /dev/null
+++ b/sys/linux/test/syz_clone3
@@ -0,0 +1,3 @@
+# requires: arch=amd64
+
+syz_clone3(&AUTO={0x11, 0x0, 0x0, 0x0, {0x11}, 0x0, 0x0, 0x0, 0x0, 0x0, {0x0}}, AUTO)