diff options
| author | Mickaël Salaün <mic@linux.microsoft.com> | 2025-07-08 12:36:17 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-07-09 10:22:52 +0000 |
| commit | 13747488d833ae81427f1246879b645a2da63864 (patch) | |
| tree | d737245e43428dbb50855b4bc36241b6ff60deea /sys | |
| parent | 647091d604f00b9292bdd7fbc96b55bdfa2bcf52 (diff) | |
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>
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/linux/test/landlock_ptrace | 9 |
1 files changed, 6 insertions, 3 deletions
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: |
