Skip to content

Commit 1374748

Browse files
l0koda-nogikh
authored andcommitted
sys/linux/test: improve landlock_ptrace
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 <mic@linux.microsoft.com>
1 parent 647091d commit 1374748

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

sys/linux/test/landlock_ptrace

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Creates independent Landlock hierarchies and try different tracer/tracee
22
# schemas (without scheduling control).
3+
#
4+
# In this test, some ptrace(2) calls return different code according to the
5+
# calling thread.
36

47
capset(&AUTO={0x20080522, 0x0}, &AUTO={0x0, 0x0, 0x0, 0x0, 0x0, 0x0})
58
prctl$PR_SET_NO_NEW_PRIVS(0x26, 0x1)
@@ -16,7 +19,7 @@ landlock_restrict_self(r1, 0x0)
1619

1720
r2 = syz_clone(0x11, 0x0, 0x0, 0x0, 0x0, 0x0)
1821

19-
ptrace(0x10, r0)
22+
ptrace(0x10, r0) # EPERM
2023
ptrace(0x11, r0)
2124

2225
ptrace(0x10, r2)
@@ -25,10 +28,10 @@ ptrace(0x11, r2)
2528
r3 = landlock_create_ruleset(&AUTO={0x100, 0x0, 0x0}, AUTO, 0x0)
2629
landlock_restrict_self(r3, 0x0)
2730

28-
ptrace(0x10, r0)
31+
ptrace(0x10, r0) # EPERM
2932
ptrace(0x11, r0)
3033

31-
ptrace(0x10, r2)
34+
ptrace(0x10, r2) # EPERM
3235
ptrace(0x11, r2)
3336

3437
# For now, PTRACE_TRACEME is transformed to -1, which returns an error:

0 commit comments

Comments
 (0)