From 13747488d833ae81427f1246879b645a2da63864 Mon Sep 17 00:00:00 2001 From: Mickaël Salaün Date: Tue, 8 Jul 2025 12:36:17 +0200 Subject: sys/linux/test: improve landlock_ptrace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running syz-manager with -mode run-tests --tests landlock_ptrace -debug we get this result: executing program ### start ### call=0 errno=0 ### call=1 errno=0 ### call=2 errno=0 ### call=3 errno=0 ### call=4 errno=3 ### call=5 errno=0 ### call=6 errno=0 ### call=7 errno=0 ### call=8 errno=1 ### call=9 errno=0 ### call=10 errno=0 ### call=11 errno=3 ### call=12 errno=0 ### call=13 errno=0 ### call=14 errno=1 ### call=15 errno=3 ### call=16 errno=1 ### call=17 errno=0 ### call=18 errno=3 executing program ### start ### call=0 errno=0 ### call=1 errno=0 ### call=2 errno=0 ### call=3 errno=0 ### call=4 errno=0 ### call=5 errno=0 ### call=6 errno=0 ### call=7 errno=0 ### call=8 errno=1 ### call=9 errno=3 ### call=10 errno=0 ### call=11 errno=3 ### call=12 errno=0 ### call=13 errno=0 ### call=14 errno=1 ### call=15 errno=3 ### call=16 errno=1 ### call=17 errno=0 ### call=18 errno=3 executing program ### start ### call=0 errno=0 ### call=1 errno=0 ### call=2 errno=0 ### call=3 errno=0 ### call=4 errno=3 ### call=5 errno=0 ### call=6 errno=0 ### call=7 errno=0 ### call=8 errno=1 ### call=9 errno=0 ### call=10 errno=0 ### call=11 errno=3 ### call=12 errno=0 ### call=13 errno=0 ### call=14 errno=1 ### call=15 errno=3 ### call=16 errno=1 ### call=17 errno=0 ### call=18 errno=3 Because this test spawns two threads, the ptrace(2) returned code may be different according to the calling thread. Set the common EPERM errnos for all three threads (EINTR is unknown to syzkaller). The other returned codes cannot be fixed because we cannot have a set of valid errno for the same call. Signed-off-by: Mickaël Salaün --- sys/linux/test/landlock_ptrace | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'sys') diff --git a/sys/linux/test/landlock_ptrace b/sys/linux/test/landlock_ptrace index e401b6344..29048aaa6 100644 --- a/sys/linux/test/landlock_ptrace +++ b/sys/linux/test/landlock_ptrace @@ -1,5 +1,8 @@ # Creates independent Landlock hierarchies and try different tracer/tracee # schemas (without scheduling control). +# +# In this test, some ptrace(2) calls return different code according to the +# calling thread. capset(&AUTO={0x20080522, 0x0}, &AUTO={0x0, 0x0, 0x0, 0x0, 0x0, 0x0}) prctl$PR_SET_NO_NEW_PRIVS(0x26, 0x1) @@ -16,7 +19,7 @@ landlock_restrict_self(r1, 0x0) r2 = syz_clone(0x11, 0x0, 0x0, 0x0, 0x0, 0x0) -ptrace(0x10, r0) +ptrace(0x10, r0) # EPERM ptrace(0x11, r0) ptrace(0x10, r2) @@ -25,10 +28,10 @@ ptrace(0x11, r2) r3 = landlock_create_ruleset(&AUTO={0x100, 0x0, 0x0}, AUTO, 0x0) landlock_restrict_self(r3, 0x0) -ptrace(0x10, r0) +ptrace(0x10, r0) # EPERM ptrace(0x11, r0) -ptrace(0x10, r2) +ptrace(0x10, r2) # EPERM ptrace(0x11, r2) # For now, PTRACE_TRACEME is transformed to -1, which returns an error: -- cgit mrf-deployment