This is the mail archive of the mailing list for the systemtap project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][fix] kprobe-booster disabling at preemptive kernel

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,

2nd Research Dept.
Hitachi, Ltd., Systems Development Laboratory

Signed-off-by: Masami Hiramatsu <>

 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;
-	unsigned pre_preempt_count = preempt_count();
-	unsigned pre_preempt_count = 1;

 	addr = (kprobe_opcode_t *)(regs->eip - sizeof(kprobe_opcode_t));

@@ -338,13 +333,15 @@ static int __kprobes kprobe_handler(stru
 		return 1;

-	if (pre_preempt_count && p->ainsn.boostable == 1 && !p->post_handler){
+	if (p->ainsn.boostable == 1 && !p->post_handler){
 		/* Boost up -- we can execute copied instructions directly */
 		regs->eip = (unsigned long)p->ainsn.insn;
 		return 1;
 	prepare_singlestep(p, regs);
 	kcb->kprobe_status = KPROBE_HIT_SS;
 	return 1;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]