[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <fd7938d94008711d441551c06b25a033669a0618.1629732940.git.christophe.leroy@csgroup.eu>
Date: Mon, 23 Aug 2021 15:35:51 +0000 (UTC)
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>
Cc: linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: [PATCH v2 1/5] powerpc/signal64: Access function descriptor with user
access block
Access the function descriptor of the handler within a
user access block.
Signed-off-by: Christophe Leroy <christophe.leroy@...roup.eu>
---
arch/powerpc/kernel/signal_64.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 1831bba0582e..790c450c2de8 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -936,8 +936,18 @@ 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))) {
+ unsafe_get_user(regs->ctr, &funct_desc_ptr->entry, bad_funct_desc_block);
+ unsafe_get_user(regs->gpr[2], &funct_desc_ptr->toc, bad_funct_desc_block);
+ } else {
+ goto bad_funct_desc;
+bad_funct_desc_block:
+ user_read_access_end();
+bad_funct_desc:
+ signal_fault(current, regs, __func__, funct_desc_ptr);
+ return 1;
+ }
+ user_read_access_end();
}
/* enter the signal handler in native-endian mode */
--
2.25.0
Powered by blists - more mailing lists