[PATCH] x86_64: check if ptrace RIP is canonical
authorAndi Kleen <ak@suse.de>
Tue, 17 May 2005 04:53:29 +0000 (21:53 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 17 May 2005 14:59:15 +0000 (07:59 -0700)
This works around an AMD Erratum.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/x86_64/kernel/ptrace.c

index e26e86bb56fe53381e2016e4f478dbdc37ec0294..892212161aa86410cd3166a0919de74f1cd37951 100644 (file)
@@ -277,6 +277,11 @@ static int putreg(struct task_struct *child,
                                return -EIO;
                        value &= 0xffff;
                        break;
+               case offsetof(struct user_regs_struct, rip):
+                       /* Check if the new RIP address is canonical */
+                       if (value >= TASK_SIZE)
+                               return -EIO;
+                       break;
        }
        put_stack_long(child, regno - sizeof(struct pt_regs), value);
        return 0;