aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/process.c
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@c-s.fr>2020-01-23 17:30:47 +0000
committerMichael Ellerman <mpe@ellerman.id.au>2020-01-26 00:11:35 +1100
commitdef0bfdbd6039e96a9eb2baaa4470b079daab0d4 (patch)
treeec4077cf1931e6bd1018a3c3b5526c721b05624b /arch/powerpc/kernel/process.c
parentpowerpc/maple: Fix comparing pointer to 0 (diff)
downloadlinux-dev-def0bfdbd6039e96a9eb2baaa4470b079daab0d4.tar.xz
linux-dev-def0bfdbd6039e96a9eb2baaa4470b079daab0d4.zip
powerpc: use probe_user_read() and probe_user_write()
Instead of opencoding, use probe_user_read() to failessly read a user location and probe_user_write() for writing to user. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/e041f5eedb23f09ab553be8a91c3de2087147320.1579800517.git.christophe.leroy@c-s.fr
Diffstat (limited to '')
-rw-r--r--arch/powerpc/kernel/process.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 7fcf72e58826..fad50db9dcf2 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1277,16 +1277,6 @@ void show_user_instructions(struct pt_regs *regs)
pc = regs->nip - (NR_INSN_TO_PRINT * 3 / 4 * sizeof(int));
- /*
- * Make sure the NIP points at userspace, not kernel text/data or
- * elsewhere.
- */
- if (!__access_ok(pc, NR_INSN_TO_PRINT * sizeof(int), USER_DS)) {
- pr_info("%s[%d]: Bad NIP, not dumping instructions.\n",
- current->comm, current->pid);
- return;
- }
-
seq_buf_init(&s, buf, sizeof(buf));
while (n) {
@@ -1297,7 +1287,7 @@ void show_user_instructions(struct pt_regs *regs)
for (i = 0; i < 8 && n; i++, n--, pc += sizeof(int)) {
int instr;
- if (probe_kernel_address((const void *)pc, instr)) {
+ if (probe_user_read(&instr, (void __user *)pc, sizeof(instr))) {
seq_buf_printf(&s, "XXXXXXXX ");
continue;
}