stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][stable] parisc/entry: fix trace test in syscall exit path
@ 2021-11-16 13:40 Helge Deller
  2021-11-19 13:36 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Helge Deller @ 2021-11-16 13:40 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman, Sasha Levin; +Cc: Sven Schnelle

Please apply this patch to the stable kernels up to v5.15.

It's basically upstream commit 3ec18fc7831e7d79e2d536dd1f3bc0d3ba425e8a,
adjusted so that it applies to the stable kernels.

It requires that upstream commit 8779e05ba8aaffec1829872ef9774a71f44f6580
is applied before, which shouldn't be a problem as it was tagged for
stable series in the original commmit already.

Thanks,
Helge
--------

From: Sven Schnelle <svens@stackframe.org>
Date: Sat, 13 Nov 2021 20:41:17 +0100
Subject: [PATCH] parisc/entry: fix trace test in syscall exit path

Upstream commit: 3ec18fc7831e7d79e2d536dd1f3bc0d3ba425e8a

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>

diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index 2716e58b498b..437c8d31f390 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -1835,7 +1835,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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][stable] parisc/entry: fix trace test in syscall exit path
  2021-11-16 13:40 [PATCH][stable] parisc/entry: fix trace test in syscall exit path Helge Deller
@ 2021-11-19 13:36 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2021-11-19 13:36 UTC (permalink / raw)
  To: Helge Deller; +Cc: stable, Sasha Levin, Sven Schnelle

On Tue, Nov 16, 2021 at 02:40:21PM +0100, Helge Deller wrote:
> Please apply this patch to the stable kernels up to v5.15.
> 
> It's basically upstream commit 3ec18fc7831e7d79e2d536dd1f3bc0d3ba425e8a,
> adjusted so that it applies to the stable kernels.
> 
> It requires that upstream commit 8779e05ba8aaffec1829872ef9774a71f44f6580
> is applied before, which shouldn't be a problem as it was tagged for
> stable series in the original commmit already.

Now queued up, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-19 13:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16 13:40 [PATCH][stable] parisc/entry: fix trace test in syscall exit path Helge Deller
2021-11-19 13:36 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).