linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] x86: fix kprobe_handler reenable preemption
@ 2007-12-18 23:18 Masami Hiramatsu
  2007-12-19  3:32 ` Masami Hiramatsu
  0 siblings, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2007-12-18 23:18 UTC (permalink / raw)
  To: Ananth N Mavinakayanahalli, Jim Keniston, Ingo Molnar
  Cc: Roland McGrath, prasanna, anil.s.keshavamurthy, davem,
	Harvey Harrison, systemtap-ml, LKML, Arjan van de Ven

Fix a preemption bug in kprobe_handler(). It has to call preempt_enable()
before returning.
I think this is critical on preemptive kernel.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
---
 arch/x86/kernel/kprobes.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: b/arch/x86/kernel/kprobes.c
===================================================================
--- a/arch/x86/kernel/kprobes.c	2007-12-18 12:51:00.000000000 -0500
+++ b/arch/x86/kernel/kprobes.c	2007-12-18 12:53:38.000000000 -0500
@@ -467,7 +467,8 @@
 				arch_disarm_kprobe(p);
 				regs->ip = (unsigned long)p->addr;
 				reset_current_kprobe();
-				return 1;
+				ret = 1;
+				goto no_kprobe;
 #endif
 			}
 			/* We have reentered the kprobe_handler(), since
@@ -481,7 +482,7 @@
 			kprobes_inc_nmissed_count(p);
 			prepare_singlestep(p, regs);
 			kcb->kprobe_status = KPROBE_REENTER;
-			return 1;
+			ret = 1;
 		} else {
 			if (*addr != BREAKPOINT_INSTRUCTION) {
 			/* The breakpoint instruction was removed by

-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com, masami.hiramatsu.pt@hitachi.com



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] x86: fix kprobe_handler reenable preemption
  2007-12-18 23:18 [PATCH 1/2] x86: fix kprobe_handler reenable preemption Masami Hiramatsu
@ 2007-12-19  3:32 ` Masami Hiramatsu
  2007-12-19 10:20   ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2007-12-19  3:32 UTC (permalink / raw)
  To: Ananth N Mavinakayanahalli, Jim Keniston, Ingo Molnar
  Cc: Roland McGrath, prasanna, anil.s.keshavamurthy, davem,
	Harvey Harrison, systemtap-ml, LKML, Arjan van de Ven

Hi

Masami Hiramatsu wrote:
> Fix a preemption bug in kprobe_handler(). It has to call preempt_enable()
> before returning.
> I think this is critical on preemptive kernel.

Sorry, this patch has a mistake.
> 
> Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
> ---
>  arch/x86/kernel/kprobes.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> Index: b/arch/x86/kernel/kprobes.c
> ===================================================================
> --- a/arch/x86/kernel/kprobes.c	2007-12-18 12:51:00.000000000 -0500
> +++ b/arch/x86/kernel/kprobes.c	2007-12-18 12:53:38.000000000 -0500
> @@ -467,7 +467,8 @@
>  				arch_disarm_kprobe(p);
>  				regs->ip = (unsigned long)p->addr;
>  				reset_current_kprobe();
> -				return 1;
> +				ret = 1;
> +				goto no_kprobe;
>  #endif
>  			}
>  			/* We have reentered the kprobe_handler(), since
> @@ -481,7 +482,7 @@
>  			kprobes_inc_nmissed_count(p);
>  			prepare_singlestep(p, regs);
>  			kcb->kprobe_status = KPROBE_REENTER;
> -			return 1;
> +			ret = 1;

Here, "return 1;" is correct. After single step is done, preemption is enabled
in post_kprobe_handler().

>  		} else {
>  			if (*addr != BREAKPOINT_INSTRUCTION) {
>  			/* The breakpoint instruction was removed by
> 

-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com, masami.hiramatsu.pt@hitachi.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] x86: fix kprobe_handler reenable preemption
  2007-12-19  3:32 ` Masami Hiramatsu
@ 2007-12-19 10:20   ` Ingo Molnar
  2007-12-19 16:03     ` Masami Hiramatsu
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2007-12-19 10:20 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: Ananth N Mavinakayanahalli, Jim Keniston, Roland McGrath,
	prasanna, anil.s.keshavamurthy, davem, Harvey Harrison,
	systemtap-ml, LKML, Arjan van de Ven


* Masami Hiramatsu <mhiramat@redhat.com> wrote:

> > -			return 1;
> > +			ret = 1;
> 
> Here, "return 1;" is correct. After single step is done, preemption is 
> enabled in post_kprobe_handler().

could you resend the fixed patch? (instead of me fixing it up by hand - 
which is error-prone)

also, this seems like .24 material as well - could you send the fix 
against -rc5 too?

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] x86: fix kprobe_handler reenable preemption
  2007-12-19 10:20   ` Ingo Molnar
@ 2007-12-19 16:03     ` Masami Hiramatsu
  0 siblings, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2007-12-19 16:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Ananth N Mavinakayanahalli, Jim Keniston, Roland McGrath,
	prasanna, anil.s.keshavamurthy, davem, Harvey Harrison,
	systemtap-ml, LKML, Arjan van de Ven

Hi Ingo,

Ingo Molnar wrote:
> * Masami Hiramatsu <mhiramat@redhat.com> wrote:
> 
>>> -			return 1;
>>> +			ret = 1;
>> Here, "return 1;" is correct. After single step is done, preemption is 
>> enabled in post_kprobe_handler().
> 
> could you resend the fixed patch? (instead of me fixing it up by hand - 
> which is error-prone)

Sure, I'll resend asap.

> 
> also, this seems like .24 material as well - could you send the fix 
> against -rc5 too?

-rc tree is fine. Actually, it was introduced by my cleanup patch.
Thanks!

> 
> 	Ingo

-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com, masami.hiramatsu.pt@hitachi.com



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-12-19 16:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-18 23:18 [PATCH 1/2] x86: fix kprobe_handler reenable preemption Masami Hiramatsu
2007-12-19  3:32 ` Masami Hiramatsu
2007-12-19 10:20   ` Ingo Molnar
2007-12-19 16:03     ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).