aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/kprobes.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/kprobes.c')
-rw-r--r--kernel/kprobes.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 692fbf75ab49..e8e0ae8a6e14 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -261,7 +261,7 @@ static inline void free_rp_inst(struct kretprobe *rp)
261static inline void add_aggr_kprobe(struct kprobe *ap, struct kprobe *p) 261static inline void add_aggr_kprobe(struct kprobe *ap, struct kprobe *p)
262{ 262{
263 ap->addr = p->addr; 263 ap->addr = p->addr;
264 ap->opcode = p->opcode; 264 memcpy(&ap->opcode, &p->opcode, sizeof(kprobe_opcode_t));
265 memcpy(&ap->ainsn, &p->ainsn, sizeof(struct arch_specific_insn)); 265 memcpy(&ap->ainsn, &p->ainsn, sizeof(struct arch_specific_insn));
266 266
267 ap->pre_handler = aggr_pre_handler; 267 ap->pre_handler = aggr_pre_handler;
@@ -304,10 +304,8 @@ static int register_aggr_kprobe(struct kprobe *old_p, struct kprobe *p)
304/* kprobe removal house-keeping routines */ 304/* kprobe removal house-keeping routines */
305static inline void cleanup_kprobe(struct kprobe *p, unsigned long flags) 305static inline void cleanup_kprobe(struct kprobe *p, unsigned long flags)
306{ 306{
307 *p->addr = p->opcode; 307 arch_disarm_kprobe(p);
308 hlist_del(&p->hlist); 308 hlist_del(&p->hlist);
309 flush_icache_range((unsigned long) p->addr,
310 (unsigned long) p->addr + sizeof(kprobe_opcode_t));
311 spin_unlock_irqrestore(&kprobe_lock, flags); 309 spin_unlock_irqrestore(&kprobe_lock, flags);
312 arch_remove_kprobe(p); 310 arch_remove_kprobe(p);
313} 311}
@@ -344,10 +342,8 @@ int register_kprobe(struct kprobe *p)
344 hlist_add_head(&p->hlist, 342 hlist_add_head(&p->hlist,
345 &kprobe_table[hash_ptr(p->addr, KPROBE_HASH_BITS)]); 343 &kprobe_table[hash_ptr(p->addr, KPROBE_HASH_BITS)]);
346 344
347 p->opcode = *p->addr; 345 arch_arm_kprobe(p);
348 *p->addr = BREAKPOINT_INSTRUCTION; 346
349 flush_icache_range((unsigned long) p->addr,
350 (unsigned long) p->addr + sizeof(kprobe_opcode_t));
351out: 347out:
352 spin_unlock_irqrestore(&kprobe_lock, flags); 348 spin_unlock_irqrestore(&kprobe_lock, flags);
353rm_kprobe: 349rm_kprobe: