]> err.no Git - linux-2.6/commitdiff
[PATCH] ppc64 kprobes: correct kprobe registration return values
authorAnanth N Mavinakayanahalli <ananth@in.ibm.com>
Wed, 8 Jun 2005 22:49:41 +0000 (15:49 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 8 Jun 2005 23:21:13 +0000 (16:21 -0700)
Add stricter checks during kprobe registration.  Return correct error value so
insmod doesn't succeed.  Also printk reason for registration failure.

Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/ppc64/kernel/kprobes.c

index 5a9f47b18c45ee06b86486afcb2a84dc88b67ad9..8f3317244311d8cdc650dd198f65fd21354e42cc 100644 (file)
@@ -45,12 +45,17 @@ static struct pt_regs jprobe_saved_regs;
 
 int arch_prepare_kprobe(struct kprobe *p)
 {
+       int ret = 0;
        kprobe_opcode_t insn = *p->addr;
 
-       if (IS_MTMSRD(insn) || IS_RFID(insn))
-               /* cannot put bp on RFID/MTMSRD */
-               return 1;
-       return 0;
+       if ((unsigned long)p->addr & 0x03) {
+               printk("Attempt to register kprobe at an unaligned address\n");
+               ret = -EINVAL;
+       } else if (IS_MTMSRD(insn) || IS_RFID(insn)) {
+               printk("Cannot register a kprobe on rfid or mtmsrd\n");
+               ret = -EINVAL;
+       }
+       return ret;
 }
 
 void arch_copy_kprobe(struct kprobe *p)