diff options
author | Ananth N Mavinakayanahalli <ananth@in.ibm.com> | 2005-06-08 18:49:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-08 19:21:13 -0400 |
commit | 63224d1e8b4cf87cc7420201a8cb3b44b9bf0b40 (patch) | |
tree | ba7d897b1aeecb087d536b121176c10255bd1744 /arch/ppc64/kernel/kprobes.c | |
parent | 42442ed5744b03f5351a142649b8b4c97e6950ab (diff) |
[PATCH] ppc64 kprobes: correct kprobe registration return values
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>
Diffstat (limited to 'arch/ppc64/kernel/kprobes.c')
-rw-r--r-- | arch/ppc64/kernel/kprobes.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/arch/ppc64/kernel/kprobes.c b/arch/ppc64/kernel/kprobes.c index 5a9f47b18c45..8f3317244311 100644 --- a/arch/ppc64/kernel/kprobes.c +++ b/arch/ppc64/kernel/kprobes.c | |||
@@ -45,12 +45,17 @@ static struct pt_regs jprobe_saved_regs; | |||
45 | 45 | ||
46 | int arch_prepare_kprobe(struct kprobe *p) | 46 | int arch_prepare_kprobe(struct kprobe *p) |
47 | { | 47 | { |
48 | int ret = 0; | ||
48 | kprobe_opcode_t insn = *p->addr; | 49 | kprobe_opcode_t insn = *p->addr; |
49 | 50 | ||
50 | if (IS_MTMSRD(insn) || IS_RFID(insn)) | 51 | if ((unsigned long)p->addr & 0x03) { |
51 | /* cannot put bp on RFID/MTMSRD */ | 52 | printk("Attempt to register kprobe at an unaligned address\n"); |
52 | return 1; | 53 | ret = -EINVAL; |
53 | return 0; | 54 | } else if (IS_MTMSRD(insn) || IS_RFID(insn)) { |
55 | printk("Cannot register a kprobe on rfid or mtmsrd\n"); | ||
56 | ret = -EINVAL; | ||
57 | } | ||
58 | return ret; | ||
54 | } | 59 | } |
55 | 60 | ||
56 | void arch_copy_kprobe(struct kprobe *p) | 61 | void arch_copy_kprobe(struct kprobe *p) |