All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 1/5] powerpc/signal64: Access function descriptor with user access block
@ 2021-09-17  6:59 ` Christophe Leroy
  0 siblings, 0 replies; 10+ messages in thread
From: Christophe Leroy @ 2021-09-17  6:59 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, ebiederm, hch
  Cc: Christophe Leroy, linux-kernel, linuxppc-dev

Access the function descriptor of the handler within a
user access block.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
v3: Flatten the change to avoid nested gotos.
---
 arch/powerpc/kernel/signal_64.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 1831bba0582e..7b1cd50bc4fb 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -936,8 +936,13 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set,
 		func_descr_t __user *funct_desc_ptr =
 			(func_descr_t __user *) ksig->ka.sa.sa_handler;
 
-		err |= get_user(regs->ctr, &funct_desc_ptr->entry);
-		err |= get_user(regs->gpr[2], &funct_desc_ptr->toc);
+		if (!user_read_access_begin(funct_desc_ptr, sizeof(func_descr_t)))
+			goto badfunc;
+
+		unsafe_get_user(regs->ctr, &funct_desc_ptr->entry, badfunc_block);
+		unsafe_get_user(regs->gpr[2], &funct_desc_ptr->toc, badfunc_block);
+
+		user_read_access_end();
 	}
 
 	/* enter the signal handler in native-endian mode */
@@ -962,5 +967,12 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set,
 badframe:
 	signal_fault(current, regs, "handle_rt_signal64", frame);
 
+	return 1;
+
+badfunc_block:
+	user_read_access_end();
+badfunc:
+	signal_fault(current, regs, __func__, (void __user *)ksig->ka.sa.sa_handler);
+
 	return 1;
 }
-- 
2.31.1


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

end of thread, other threads:[~2021-09-17  7:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17  6:59 [PATCH v5 1/5] powerpc/signal64: Access function descriptor with user access block Christophe Leroy
2021-09-17  6:59 ` Christophe Leroy
2021-09-17  6:59 ` [PATCH v5 2/5] powerpc/signal: Include the new stack frame inside the " Christophe Leroy
2021-09-17  6:59   ` Christophe Leroy
2021-09-17  6:59 ` [PATCH v5 3/5] signal: Add unsafe_copy_siginfo_to_user() Christophe Leroy
2021-09-17  6:59   ` Christophe Leroy
2021-09-17  6:59 ` [PATCH v5 4/5] powerpc/uaccess: Add unsafe_clear_user() Christophe Leroy
2021-09-17  6:59   ` Christophe Leroy
2021-09-17  6:59 ` [PATCH v5 5/5] powerpc/signal: Use unsafe_copy_siginfo_to_user() Christophe Leroy
2021-09-17  6:59   ` Christophe Leroy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.