Skip to content

Commit

Permalink
parisc/entry: fix trace test in syscall exit path
Browse files Browse the repository at this point in the history
commit 8779e05 ("parisc: Fix ptrace check on syscall return")
fixed testing of TI_FLAGS. This uncovered a bug in the test mask.
syscall_restore_rfi is only used when the kernel needs to exit to
usespace with single or block stepping and the recovery counter
enabled. The test however used _TIF_SYSCALL_TRACE_MASK, which
includes a lot of bits that shouldn't be tested here.

Fix this by using TIF_SINGLESTEP and TIF_BLOCKSTEP directly.

I encountered this bug by enabling syscall tracepoints. Both in qemu and
on real hardware. As soon as i enabled the tracepoint (sys_exit_read,
but i guess it doesn't really matter which one), i got random page
faults in userspace almost immediately.

Signed-off-by: Sven Schnelle <[email protected]>
Signed-off-by: Helge Deller <[email protected]>
  • Loading branch information
svenschnelle authored and hdeller committed Nov 13, 2021
1 parent 38860b2 commit 3ec18fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/parisc/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -1805,7 +1805,7 @@ syscall_restore:

/* Are we being ptraced? */
LDREG TASK_TI_FLAGS(%r1),%r19
ldi _TIF_SYSCALL_TRACE_MASK,%r2
ldi _TIF_SINGLESTEP|_TIF_BLOCKSTEP,%r2
and,COND(=) %r19,%r2,%r0
b,n syscall_restore_rfi

Expand Down

0 comments on commit 3ec18fc

Please sign in to comment.