From c39df470e04822965d945473d831786ab79dd4cd Mon Sep 17 00:00:00 2001 From: Masami Hiramatsu Date: Sun, 30 Jul 2006 03:03:21 -0700 Subject: [PATCH] kprobe-booster: disable in preemptible kernel The kprobe-booster's safety check against preemption does not work well now, because the preemption count has been modified by read_rcu_lock() in atomic_notifier_call_chain() before we check it. So, I'd like to prevent boosting kprobe temporarily if the kernel is preemptable. Now we are searching for the good solution. Signed-off-by: Masami Hiramatsu Cc: Ananth N Mavinakayanahalli Cc: Prasanna S Panchamukhi Cc: Anil S Keshavamurthy Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/i386/kernel/kprobes.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c index de2e16e561c..afe6505ca0b 100644 --- a/arch/i386/kernel/kprobes.c +++ b/arch/i386/kernel/kprobes.c @@ -256,11 +256,6 @@ static int __kprobes kprobe_handler(struct pt_regs *regs) int ret = 0; kprobe_opcode_t *addr; struct kprobe_ctlblk *kcb; -#ifdef CONFIG_PREEMPT - unsigned pre_preempt_count = preempt_count(); -#else - unsigned pre_preempt_count = 1; -#endif addr = (kprobe_opcode_t *)(regs->eip - sizeof(kprobe_opcode_t)); @@ -338,13 +333,15 @@ static int __kprobes kprobe_handler(struct pt_regs *regs) return 1; ss_probe: - if (pre_preempt_count && p->ainsn.boostable == 1 && !p->post_handler){ +#ifndef CONFIG_PREEMPT + if (p->ainsn.boostable == 1 && !p->post_handler){ /* Boost up -- we can execute copied instructions directly */ reset_current_kprobe(); regs->eip = (unsigned long)p->ainsn.insn; preempt_enable_no_resched(); return 1; } +#endif prepare_singlestep(p, regs); kcb->kprobe_status = KPROBE_HIT_SS; return 1; -- cgit v1.2.3