[PATCH] kprobe-booster: disable in preemptible kernel
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Sun, 30 Jul 2006 10:03:21 +0000 (03:03 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 31 Jul 2006 20:28:38 +0000 (13:28 -0700)
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 <masami.hiramatsu.pt@hitachi.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Prasanna S Panchamukhi <prasanna@in.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/i386/kernel/kprobes.c

index de2e16e561c06796d62efe9191b0c388e4d93a83..afe6505ca0b3a78af53db084d60574540ea7361d 100644 (file)
@@ -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;