aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64
diff options
context:
space:
mode:
authorKeshavamurthy Anil S <anil.s.keshavamurthy@intel.com>2005-06-27 18:17:16 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-27 18:23:54 -0400
commitc7b645f934e52a54af58142d91fb51f881f8ce26 (patch)
tree97ef8305edf17c07b7e0cc63453548e99e84b8fd /arch/ia64
parenta528e21c235862cc1ae50e7809eb9116dc40ea0c (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')
-rw-r--r--arch/ia64/kernel/kprobes.c18
-rw-r--r--arch/ia64/kernel/vmlinux.lds.S7
2 files changed, 22 insertions, 3 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
38extern void jprobe_inst_return(void); 39extern 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 */
268static 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
266static int valid_kprobe_addr(int template, int slot, unsigned long addr) 274static 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");
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index b9f0db4c1b04..a676e79e0681 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -8,6 +8,11 @@
8#define LOAD_OFFSET (KERNEL_START - KERNEL_TR_PAGE_SIZE) 8#define LOAD_OFFSET (KERNEL_START - KERNEL_TR_PAGE_SIZE)
9#include <asm-generic/vmlinux.lds.h> 9#include <asm-generic/vmlinux.lds.h>
10 10
11#define IVT_TEXT \
12 VMLINUX_SYMBOL(__start_ivt_text) = .; \
13 *(.text.ivt) \
14 VMLINUX_SYMBOL(__end_ivt_text) = .;
15
11OUTPUT_FORMAT("elf64-ia64-little") 16OUTPUT_FORMAT("elf64-ia64-little")
12OUTPUT_ARCH(ia64) 17OUTPUT_ARCH(ia64)
13ENTRY(phys_start) 18ENTRY(phys_start)
@@ -39,7 +44,7 @@ SECTIONS
39 44
40 .text : AT(ADDR(.text) - LOAD_OFFSET) 45 .text : AT(ADDR(.text) - LOAD_OFFSET)
41 { 46 {
42 *(.text.ivt) 47 IVT_TEXT
43 *(.text) 48 *(.text)
44 SCHED_TEXT 49 SCHED_TEXT
45 LOCK_TEXT 50 LOCK_TEXT