* [PATCH] IA64 kprobe invalidate icache of jump buffer
@ 2006-07-03 2:37 bibo, mao
0 siblings, 0 replies; 2+ messages in thread
From: bibo, mao @ 2006-07-03 2:37 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Keshavamurthy, Anil S, Masami Hiramatsu,
Prasanna S Panchamukhi, Ananth N Mavinakayanahalli, Jim Keniston,
SystemTAP, bibo.mao
Hi,
Kprobe inserts breakpoint instruction in probepoint and then jumps
to instruction slot when breakpoint is hit, the instruction slot icache
must be consistent with dcache. Here is the patch which invalidates
instruction slot icache area.
Without this patch, in some machines there will be fault when executing
instruction slot where icache content is inconsistent with dcache.This patch
is based on 2.6.17 version.
Signed-off-by: bibo,mao <bibo.mao@intel.com>
thanks
bibo,mao
arch/ia64/kernel/kprobes.c | 9 +++++++++
include/asm-i386/kprobes.h | 1 +
include/asm-ia64/kprobes.h | 1 +
include/asm-powerpc/kprobes.h | 1 +
include/asm-sparc64/kprobes.h | 1 +
include/asm-x86_64/kprobes.h | 1 +
kernel/kprobes.c | 1 +
7 files changed, 15 insertions(+)
----------------------------------------------------------------------------
diff -Nruap 2.6.17.org/arch/ia64/kernel/kprobes.c 2.6.17/arch/ia64/kernel/kprobes.c
--- 2.6.17.org/arch/ia64/kernel/kprobes.c 2006-06-29 03:50:15.000000000 +0800
+++ 2.6.17/arch/ia64/kernel/kprobes.c 2006-07-03 02:43:16.000000000 +0800
@@ -449,11 +449,20 @@ int __kprobes arch_prepare_kprobe(struct
return 0;
}
+void __kprobes flush_insn_slot(struct kprobe *p)
+{
+ unsigned long arm_addr;
+
+ arm_addr = ((unsigned long)&p->opcode.bundle) & ~0xFULL;
+ flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t));
+}
+
void __kprobes arch_arm_kprobe(struct kprobe *p)
{
unsigned long addr = (unsigned long)p->addr;
unsigned long arm_addr = addr & ~0xFULL;
+ flush_insn_slot(p);
memcpy((char *)arm_addr, &p->ainsn.insn.bundle, sizeof(bundle_t));
flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t));
}
diff -Nruap 2.6.17.org/include/asm-i386/kprobes.h 2.6.17/include/asm-i386/kprobes.h
--- 2.6.17.org/include/asm-i386/kprobes.h 2006-06-29 03:50:18.000000000 +0800
+++ 2.6.17/include/asm-i386/kprobes.h 2006-06-30 02:32:17.000000000 +0800
@@ -44,6 +44,7 @@ typedef u8 kprobe_opcode_t;
#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry
#define ARCH_SUPPORTS_KRETPROBES
+#define flush_insn_slot(p) do { } while (0)
void arch_remove_kprobe(struct kprobe *p);
void kretprobe_trampoline(void);
diff -Nruap 2.6.17.org/include/asm-ia64/kprobes.h 2.6.17/include/asm-ia64/kprobes.h
--- 2.6.17.org/include/asm-ia64/kprobes.h 2006-03-27 14:41:22.000000000 +0800
+++ 2.6.17/include/asm-ia64/kprobes.h 2006-06-30 02:33:04.000000000 +0800
@@ -124,5 +124,6 @@ static inline void jprobe_return(void)
}
extern void invalidate_stacked_regs(void);
extern void flush_register_stack(void);
+extern void flush_insn_slot(struct kprobe *p);
#endif /* _ASM_KPROBES_H */
diff -Nruap 2.6.17.org/include/asm-powerpc/kprobes.h 2.6.17/include/asm-powerpc/kprobes.h
--- 2.6.17.org/include/asm-powerpc/kprobes.h 2006-03-27 14:41:22.000000000 +0800
+++ 2.6.17/include/asm-powerpc/kprobes.h 2006-06-30 02:32:34.000000000 +0800
@@ -50,6 +50,7 @@ typedef unsigned int kprobe_opcode_t;
IS_TWI(instr) || IS_TDI(instr))
#define ARCH_SUPPORTS_KRETPROBES
+#define flush_insn_slot(p) do { } while (0)
void kretprobe_trampoline(void);
extern void arch_remove_kprobe(struct kprobe *p);
diff -Nruap 2.6.17.org/include/asm-sparc64/kprobes.h 2.6.17/include/asm-sparc64/kprobes.h
--- 2.6.17.org/include/asm-sparc64/kprobes.h 2006-03-27 14:41:23.000000000 +0800
+++ 2.6.17/include/asm-sparc64/kprobes.h 2006-06-30 02:32:50.000000000 +0800
@@ -13,6 +13,7 @@ typedef u32 kprobe_opcode_t;
#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry
#define arch_remove_kprobe(p) do {} while (0)
+#define flush_insn_slot(p) do { } while (0)
/* Architecture specific copy of original instruction*/
struct arch_specific_insn {
diff -Nruap 2.6.17.org/include/asm-x86_64/kprobes.h 2.6.17/include/asm-x86_64/kprobes.h
--- 2.6.17.org/include/asm-x86_64/kprobes.h 2006-03-27 14:41:23.000000000 +0800
+++ 2.6.17/include/asm-x86_64/kprobes.h 2006-06-30 02:32:05.000000000 +0800
@@ -43,6 +43,7 @@ typedef u8 kprobe_opcode_t;
#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry
#define ARCH_SUPPORTS_KRETPROBES
+#define flush_insn_slot(p) do { } while (0)
void kretprobe_trampoline(void);
extern void arch_remove_kprobe(struct kprobe *p);
diff -Nruap 2.6.17.org/kernel/kprobes.c 2.6.17/kernel/kprobes.c
--- 2.6.17.org/kernel/kprobes.c 2006-06-29 03:50:19.000000000 +0800
+++ 2.6.17/kernel/kprobes.c 2006-07-03 02:42:37.000000000 +0800
@@ -388,6 +388,7 @@ static int __kprobes add_new_kprobe(stru
static inline void add_aggr_kprobe(struct kprobe *ap, struct kprobe *p)
{
copy_kprobe(p, ap);
+ flush_insn_slot(ap);
ap->addr = p->addr;
ap->pre_handler = aggr_pre_handler;
ap->post_handler = aggr_post_handler;
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [PATCH] IA64 kprobe invalidate icache of jump buffer
@ 2006-07-06 18:47 Keshavamurthy, Anil S
0 siblings, 0 replies; 2+ messages in thread
From: Keshavamurthy, Anil S @ 2006-07-06 18:47 UTC (permalink / raw)
To: Mao, Bibo, Andrew Morton
Cc: linux-kernel, Masami Hiramatsu, Prasanna S Panchamukhi,
Ananth N Mavinakayanahalli, Jim Keniston, SystemTAP
>-----Original Message-----
>From: Mao, Bibo
>Sent: Sunday, July 02, 2006 7:37 PM
>To: Andrew Morton
>Cc: linux-kernel@vger.kernel.org; Keshavamurthy, Anil S;
>Masami Hiramatsu; Prasanna S Panchamukhi; Ananth N
>Mavinakayanahalli; Jim Keniston; SystemTAP; Mao, Bibo
>Subject: [PATCH] IA64 kprobe invalidate icache of jump buffer
>
>Hi,
>
> Kprobe inserts breakpoint instruction in probepoint and then jumps
>to instruction slot when breakpoint is hit, the instruction slot icache
>must be consistent with dcache. Here is the patch which invalidates
>instruction slot icache area.
> Without this patch, in some machines there will be fault
>when executing
>instruction slot where icache content is inconsistent with
>dcache.This patch
>is based on 2.6.17 version.
>
>Signed-off-by: bibo,mao <bibo.mao@intel.com>
Acked-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-07-06 18:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-03 2:37 [PATCH] IA64 kprobe invalidate icache of jump buffer bibo, mao
-- strict thread matches above, loose matches on Subject: below --
2006-07-06 18:47 Keshavamurthy, Anil S
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox