]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Nov 2021 13:37:11 +0000 (14:37 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Nov 2021 13:37:11 +0000 (14:37 +0100)
added patches:
parisc-entry-fix-trace-test-in-syscall-exit-path.patch

queue-4.9/parisc-entry-fix-trace-test-in-syscall-exit-path.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/parisc-entry-fix-trace-test-in-syscall-exit-path.patch b/queue-4.9/parisc-entry-fix-trace-test-in-syscall-exit-path.patch
new file mode 100644 (file)
index 0000000..7365c19
--- /dev/null
@@ -0,0 +1,42 @@
+From 3ec18fc7831e7d79e2d536dd1f3bc0d3ba425e8a Mon Sep 17 00:00:00 2001
+From: Sven Schnelle <svens@stackframe.org>
+Date: Sat, 13 Nov 2021 20:41:17 +0100
+Subject: parisc/entry: fix trace test in syscall exit path
+
+From: Sven Schnelle <svens@stackframe.org>
+
+commit 3ec18fc7831e7d79e2d536dd1f3bc0d3ba425e8a upstream.
+
+commit 8779e05ba8aa ("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 <svens@stackframe.org>
+Signed-off-by: Helge Deller <deller@gmx.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/parisc/kernel/entry.S |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/parisc/kernel/entry.S
++++ b/arch/parisc/kernel/entry.S
+@@ -1850,7 +1850,7 @@ syscall_restore:
+       /* Are we being ptraced? */
+       LDREG   TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19
+-      ldi     _TIF_SYSCALL_TRACE_MASK,%r2
++      ldi     _TIF_SINGLESTEP|_TIF_BLOCKSTEP,%r2
+       and,COND(=)     %r19,%r2,%r0
+       b,n     syscall_restore_rfi
index 9f01d3d6a75407b05ffd77c65b0ac9150f794808..d8135982e98ad5cd4949266c024697dcff45992a 100644 (file)
@@ -157,3 +157,4 @@ mm-oom-pagefault_out_of_memory-don-t-force-global-oom-for-dying-tasks.patch
 mm-oom-do-not-trigger-out_of_memory-from-the-pf.patch
 pci-add-pci_exp_devctl_payload_-macros.patch
 net-mdio-mux-fix-unbalanced-put_device.patch
+parisc-entry-fix-trace-test-in-syscall-exit-path.patch