[PATCH][fix] kprobe-booster disabling at preemptive kernel
Masami Hiramatsu
masami.hiramatsu.pt@hitachi.com
Sun Jul 16 15:13:00 GMT 2006
Hi, Andrew
Here is a patch to disable the kprobe-booster in the case of
preemptive 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.
Best Regards,
--
Masami HIRAMATSU
2nd Research Dept.
Hitachi, Ltd., Systems Development Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
kprobes.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --exclude=CVS -Narup a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
--- a/arch/i386/kernel/kprobes.c 2006-07-10 12:11:43.000000000 +0900
+++ b/arch/i386/kernel/kprobes.c 2006-07-10 15:41:17.000000000 +0900
@@ -256,11 +256,6 @@ static int __kprobes kprobe_handler(stru
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(stru
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;
More information about the Systemtap
mailing list