aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/process.c
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2018-10-09 16:51:05 +1100
committerMichael Ellerman <mpe@ellerman.id.au>2018-10-09 16:51:05 +1100
commit9b7e4d601baac83a7104652042107ce94f245524 (patch)
tree1ed938abb14fd861b5c28d6df90d7508a1cb5184 /arch/powerpc/kernel/process.c
parent47fd2060660e62b169990a6fcd9eb61bc1a85c5c (diff)
parentac1788cc7da4ce54edcfd2e499afdb0a23d5c41d (diff)
downloadlinux-9b7e4d601baac83a7104652042107ce94f245524.tar.gz
Merge branch 'fixes' into next
Merge our fixes branch. It has a few important fixes that are needed for futher testing and also some commits that will conflict with content in next.
Diffstat (limited to 'arch/powerpc/kernel/process.c')
-rw-r--r--arch/powerpc/kernel/process.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index ec264a6f0eb3a..d9d4eb2ea6c90 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1303,6 +1303,16 @@ void show_user_instructions(struct pt_regs *regs)
pc = regs->nip - (instructions_to_print * 3 / 4 * sizeof(int));
+ /*
+ * Make sure the NIP points at userspace, not kernel text/data or
+ * elsewhere.
+ */
+ if (!__access_ok(pc, instructions_to_print * sizeof(int), USER_DS)) {
+ pr_info("%s[%d]: Bad NIP, not dumping instructions.\n",
+ current->comm, current->pid);
+ return;
+ }
+
pr_info("%s[%d]: code: ", current->comm, current->pid);
for (i = 0; i < instructions_to_print; i++) {