[PATCH] powerpc/signal32: Fix erroneous SIGSEGV on RT signal return

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE1920d LANDED

Landed in mainline as 525642624783 on 2021-04-28.

2 messages, 2 authors, 2021-04-29 · open the first message on its own page

[PATCH] powerpc/signal32: Fix erroneous SIGSEGV on RT signal return

From: Christophe Leroy <hidden>
Date: 2021-04-23 13:52:15

Return of user_read_access_begin() is tested the wrong way,
leading to a SIGSEGV when the user address is valid and likely
an Oops when the user address is bad.

Fix the test.

Fixes: 887f3ceb51cd ("powerpc/signal32: Convert do_setcontext[_tm]() to user access block")
Signed-off-by: Christophe Leroy <redacted>
---
 arch/powerpc/kernel/signal_32.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index fc41c58f0cbb..8f05ed0da292 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -967,7 +967,7 @@ static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs, int
 	sigset_t set;
 	struct mcontext __user *mcp;
 
-	if (user_read_access_begin(ucp, sizeof(*ucp)))
+	if (!user_read_access_begin(ucp, sizeof(*ucp)))
 		return -EFAULT;
 
 	unsafe_get_sigset_t(&set, &ucp->uc_sigmask, failed);
@@ -1005,7 +1005,7 @@ static int do_setcontext_tm(struct ucontext __user *ucp,
 	u32 cmcp;
 	u32 tm_cmcp;
 
-	if (user_read_access_begin(ucp, sizeof(*ucp)))
+	if (!user_read_access_begin(ucp, sizeof(*ucp)))
 		return -EFAULT;
 
 	unsafe_get_sigset_t(&set, &ucp->uc_sigmask, failed);
-- 
2.25.0

Re: [PATCH] powerpc/signal32: Fix erroneous SIGSEGV on RT signal return

From: Michael Ellerman <hidden>
Date: 2021-04-29 14:02:34

On Fri, 23 Apr 2021 13:52:10 +0000 (UTC), Christophe Leroy wrote:
Return of user_read_access_begin() is tested the wrong way,
leading to a SIGSEGV when the user address is valid and likely
an Oops when the user address is bad.

Fix the test.
Applied to powerpc/next.

[1/1] powerpc/signal32: Fix erroneous SIGSEGV on RT signal return
      https://git.kernel.org/powerpc/c/5256426247837feb8703625bda7fcfc824af04cf

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help