diff options
author | Keshavamurthy Anil S <anil.s.keshavamurthy@intel.com> | 2005-06-27 18:17:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-27 18:23:54 -0400 |
commit | c7b645f934e52a54af58142d91fb51f881f8ce26 (patch) | |
tree | 97ef8305edf17c07b7e0cc63453548e99e84b8fd /arch/ia64/kernel/kprobes.c | |
parent | a528e21c235862cc1ae50e7809eb9116dc40ea0c (diff) |
[PATCH] kprobes/ia64: refuse kprobe on ivt code
Not safe to insert kprobes on IVT code.
This patch checks to see if the address on which Kprobes is being inserted is
in ivt code and if it is in ivt code then refuse to register kprobe.
Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Acked-by: David Mosberger <davidm@napali.hpl.hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/ia64/kernel/kprobes.c')
-rw-r--r-- | arch/ia64/kernel/kprobes.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c index ec2ceade12b0..3aa3167edbec 100644 --- a/arch/ia64/kernel/kprobes.c +++ b/arch/ia64/kernel/kprobes.c | |||
@@ -34,6 +34,7 @@ | |||
34 | 34 | ||
35 | #include <asm/pgtable.h> | 35 | #include <asm/pgtable.h> |
36 | #include <asm/kdebug.h> | 36 | #include <asm/kdebug.h> |
37 | #include <asm/sections.h> | ||
37 | 38 | ||
38 | extern void jprobe_inst_return(void); | 39 | extern void jprobe_inst_return(void); |
39 | 40 | ||
@@ -263,14 +264,27 @@ static inline void get_kprobe_inst(bundle_t *bundle, uint slot, | |||
263 | } | 264 | } |
264 | } | 265 | } |
265 | 266 | ||
267 | /* Returns non-zero if the addr is in the Interrupt Vector Table */ | ||
268 | static inline int in_ivt_functions(unsigned long addr) | ||
269 | { | ||
270 | return (addr >= (unsigned long)__start_ivt_text | ||
271 | && addr < (unsigned long)__end_ivt_text); | ||
272 | } | ||
273 | |||
266 | static int valid_kprobe_addr(int template, int slot, unsigned long addr) | 274 | static int valid_kprobe_addr(int template, int slot, unsigned long addr) |
267 | { | 275 | { |
268 | if ((slot > 2) || ((bundle_encoding[template][1] == L) && slot > 1)) { | 276 | if ((slot > 2) || ((bundle_encoding[template][1] == L) && slot > 1)) { |
269 | printk(KERN_WARNING "Attempting to insert unaligned kprobe at 0x%lx\n", | 277 | printk(KERN_WARNING "Attempting to insert unaligned kprobe " |
270 | addr); | 278 | "at 0x%lx\n", addr); |
271 | return -EINVAL; | 279 | return -EINVAL; |
272 | } | 280 | } |
273 | 281 | ||
282 | if (in_ivt_functions(addr)) { | ||
283 | printk(KERN_WARNING "Kprobes can't be inserted inside " | ||
284 | "IVT functions at 0x%lx\n", addr); | ||
285 | return -EINVAL; | ||
286 | } | ||
287 | |||
274 | if (slot == 1 && bundle_encoding[template][1] != L) { | 288 | if (slot == 1 && bundle_encoding[template][1] != L) { |
275 | printk(KERN_WARNING "Inserting kprobes on slot #1 " | 289 | printk(KERN_WARNING "Inserting kprobes on slot #1 " |
276 | "is not supported\n"); | 290 | "is not supported\n"); |