Commit a9ad965ea9a6d719daf333847a2ceb0e363994bd
Committed by
Linus Torvalds
1 parent
25c8716cb0
Exists in
master
and in
39 other branches
[PATCH] IA64: kprobe invalidate icache of jump buffer
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. Signed-off-by: bibo,mao <bibo.mao@intel.com> Acked-by: "Luck, Tony" <tony.luck@intel.com> Acked-by: Keshavamurthy Anil S <anil.s.keshavamurthy@intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 7 changed files with 15 additions and 0 deletions Side-by-side Diff
arch/ia64/kernel/kprobes.c
... | ... | @@ -448,11 +448,20 @@ |
448 | 448 | return 0; |
449 | 449 | } |
450 | 450 | |
451 | +void __kprobes flush_insn_slot(struct kprobe *p) | |
452 | +{ | |
453 | + unsigned long arm_addr; | |
454 | + | |
455 | + arm_addr = ((unsigned long)&p->opcode.bundle) & ~0xFULL; | |
456 | + flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t)); | |
457 | +} | |
458 | + | |
451 | 459 | void __kprobes arch_arm_kprobe(struct kprobe *p) |
452 | 460 | { |
453 | 461 | unsigned long addr = (unsigned long)p->addr; |
454 | 462 | unsigned long arm_addr = addr & ~0xFULL; |
455 | 463 | |
464 | + flush_insn_slot(p); | |
456 | 465 | memcpy((char *)arm_addr, &p->ainsn.insn.bundle, sizeof(bundle_t)); |
457 | 466 | flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t)); |
458 | 467 | } |
include/asm-i386/kprobes.h
... | ... | @@ -45,6 +45,7 @@ |
45 | 45 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry |
46 | 46 | #define ARCH_SUPPORTS_KRETPROBES |
47 | 47 | #define ARCH_INACTIVE_KPROBE_COUNT 0 |
48 | +#define flush_insn_slot(p) do { } while (0) | |
48 | 49 | |
49 | 50 | void arch_remove_kprobe(struct kprobe *p); |
50 | 51 | void kretprobe_trampoline(void); |
include/asm-ia64/kprobes.h
include/asm-powerpc/kprobes.h
include/asm-sparc64/kprobes.h
... | ... | @@ -13,6 +13,7 @@ |
13 | 13 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry |
14 | 14 | #define arch_remove_kprobe(p) do {} while (0) |
15 | 15 | #define ARCH_INACTIVE_KPROBE_COUNT 0 |
16 | +#define flush_insn_slot(p) do { } while (0) | |
16 | 17 | |
17 | 18 | /* Architecture specific copy of original instruction*/ |
18 | 19 | struct arch_specific_insn { |
include/asm-x86_64/kprobes.h
kernel/kprobes.c