[PATCH 1/2] ppc64 kprobes: correct kprobe registration return values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ananth N Mavinakayanahalli <[email protected]>

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 <[email protected]>
Signed-off-by: Paul Mackerras <[email protected]>
---

Index: linux-2.6.12-rc5/arch/ppc64/kernel/kprobes.c
===================================================================
--- linux-2.6.12-rc5.orig/arch/ppc64/kernel/kprobes.c	2005-05-27 14:35:12.000000000 -0400
+++ linux-2.6.12-rc5/arch/ppc64/kernel/kprobes.c	2005-05-27 14:40:42.000000000 -0400
@@ -45,12 +45,17 @@ static kprobe_opcode_t stepped_insn;
 
 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)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux