From 75451f0f2ef58abbdaef180b91de2e379c436766 Mon Sep 17 00:00:00 2001 From: Vyacheslav Cherkashin Date: Thu, 21 Mar 2013 15:37:12 +0400 Subject: [PATCH] [REFACTOR] remove current_kprobe from swap_uprobe module --- kprobe/arch/asm-arm/dbi_kprobes.c | 1 - kprobe/dbi_kprobes.c | 2 -- uprobe/arch/asm-arm/swap_uprobes.c | 28 ++++------------------------ 3 files changed, 4 insertions(+), 27 deletions(-) diff --git a/kprobe/arch/asm-arm/dbi_kprobes.c b/kprobe/arch/asm-arm/dbi_kprobes.c index df5e841..b07e576 100644 --- a/kprobe/arch/asm-arm/dbi_kprobes.c +++ b/kprobe/arch/asm-arm/dbi_kprobes.c @@ -371,7 +371,6 @@ void set_current_kprobe(struct kprobe *p, struct pt_regs *regs, struct kprobe_ct __get_cpu_var(current_kprobe) = p; DBPRINTF ("set_current_kprobe: p=%p addr=%p\n", p, p->addr); } -EXPORT_SYMBOL_GPL(set_current_kprobe); #ifdef TRAP_OVERHEAD_DEBUG static unsigned long trap_handler_counter_debug = 0; diff --git a/kprobe/dbi_kprobes.c b/kprobe/dbi_kprobes.c index 65352e2..c805548 100644 --- a/kprobe/dbi_kprobes.c +++ b/kprobe/dbi_kprobes.c @@ -129,13 +129,11 @@ void reset_current_kprobe (void) { __get_cpu_var (current_kprobe) = NULL; } -EXPORT_SYMBOL_GPL(reset_current_kprobe); struct kprobe_ctlblk *get_kprobe_ctlblk (void) { return (&__get_cpu_var (kprobe_ctlblk)); } -EXPORT_SYMBOL_GPL(get_kprobe_ctlblk); /* * This routine is called either: diff --git a/uprobe/arch/asm-arm/swap_uprobes.c b/uprobe/arch/asm-arm/swap_uprobes.c index 5fb0d85..3f2f53e 100644 --- a/uprobe/arch/asm-arm/swap_uprobes.c +++ b/uprobe/arch/asm-arm/swap_uprobes.c @@ -651,7 +651,6 @@ int trampoline_uprobe_handler(struct kprobe *p, struct pt_regs *regs) struct hlist_node *node, *tmp; unsigned long flags, orig_ret_address = 0; unsigned long trampoline_address = 0; - struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); if (thumb_mode(regs)) { trampoline_address = (unsigned long)(p->ainsn.insn) + 0x1b; @@ -700,19 +699,10 @@ int trampoline_uprobe_handler(struct kprobe *p, struct pt_regs *regs) } regs->ARM_pc = orig_ret_address; - - if(p) { - if (thumb_mode(regs) && !(regs->ARM_lr & 0x01)) { - regs->ARM_cpsr &= 0xFFFFFFDF; - } else if (user_mode(regs) && (regs->ARM_lr & 0x01)) { - regs->ARM_cpsr |= 0x20; - } - - if (kcb->kprobe_status == KPROBE_REENTER) { - restore_previous_kprobe(kcb); - } else { - reset_current_kprobe(); - } + if (thumb_mode(regs) && !(regs->ARM_lr & 0x01)) { + regs->ARM_cpsr &= 0xFFFFFFDF; + } else if (user_mode(regs) && (regs->ARM_lr & 0x01)) { + regs->ARM_cpsr |= 0x20; } spin_unlock_irqrestore(&kretprobe_lock, flags); @@ -770,7 +760,6 @@ static int uprobe_handler(struct pt_regs *regs) kprobe_opcode_t *addr = (kprobe_opcode_t *)(regs->ARM_pc); struct kprobe *p = NULL; int ret = 0, retprobe = 0; - struct kprobe_ctlblk *kcb; #ifdef SUPRESS_BUG_MESSAGES int swap_oops_in_progress; @@ -785,9 +774,6 @@ static int uprobe_handler(struct pt_regs *regs) goto no_uprobe_live; } - /* We're in an interrupt, but this is clear and BUG()-safe. */ - kcb = get_kprobe_ctlblk(); - if (p == NULL) { p = get_kprobe_by_insn_slot(addr, tgid, regs); if (p == NULL) { @@ -809,16 +795,10 @@ static int uprobe_handler(struct pt_regs *regs) } } - set_current_kprobe(p, NULL, NULL); - kcb->kprobe_status = KPROBE_HIT_ACTIVE; - if (retprobe) { ret = trampoline_uprobe_handler(p, regs); } else if (p->pre_handler) { ret = p->pre_handler(p, regs); - if(p->pre_handler != trampoline_uprobe_handler) { - reset_current_kprobe(); - } } if (ret) { -- 2.7.4