OSDN Git Service

Merge branch 'siginfo-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebieder...
[uclinux-h8/linux.git] / arch / powerpc / kernel / process.c
index 553a396..5d983d8 100644 (file)
@@ -1299,6 +1299,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++) {