mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: "Jon Medhurst (Tixy)" <tixy@linaro.org>
Cc: Russell King <linux@armlinux.org.uk>,
	linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H . Peter Anvin" <hpa@zytor.com>, Wang Nan <wangnan0@huawei.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	"David A . Long" <dave.long@linaro.org>,
	Sandeepa Prabhu <sandeepa.s.prabhu@gmail.com>
Subject: Re: [BUGFIX PATCH 1/3] kprobes/arm: Allow to handle reentered kprobe on single-stepping
Date: Wed, 15 Feb 2017 00:32:59 +0900	[thread overview]
Message-ID: <20170215003259.5d4336af80bf185256042640@kernel.org> (raw)
In-Reply-To: <1487066503.2978.1.camel@linaro.org>

On Tue, 14 Feb 2017 10:01:43 +0000
"Jon Medhurst (Tixy)" <tixy@linaro.org> wrote:

> On Tue, 2017-02-14 at 00:03 +0900, Masami Hiramatsu wrote:
> > This is arm port of commit 6a5022a56ac3 ("kprobes/x86: Allow to
> > handle reentered kprobe on single-stepping")
> > 
> > Since the FIQ handlers can interrupt in the single stepping
> > (or preparing the single stepping, do_debug etc.), we should
> > consider a kprobe is hit in the NMI handler. Even in that
> > case, the kprobe is allowed to be reentered as same as the
> > kprobes hit in kprobe handlers
> > (KPROBE_HIT_ACTIVE or KPROBE_HIT_SSDONE).
> > 
> > The real issue will happen when a kprobe hit while another
> 
> Could to with 'is' being inserted above  ^^^
> (I know this is a copy of the x86 commit message)

Ah! yes, it should be corrected. 
> 
> > reentered kprobe is processing (KPROBE_REENTER), because
> > we already consumed a saved-area for the previous kprobe.
> > 
> > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > ---
> 
> Acked-by: Jon Medhurst <tixy@linaro.org>

Thank you!

> 
> >  arch/arm/probes/kprobes/core.c |    6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/arch/arm/probes/kprobes/core.c b/arch/arm/probes/kprobes/core.c
> > index a4ec240..264fedb 100644
> > --- a/arch/arm/probes/kprobes/core.c
> > +++ b/arch/arm/probes/kprobes/core.c
> > @@ -270,6 +270,7 @@ void __kprobes kprobe_handler(struct pt_regs *regs)
> >  			switch (kcb->kprobe_status) {
> >  			case KPROBE_HIT_ACTIVE:
> >  			case KPROBE_HIT_SSDONE:
> > +			case KPROBE_HIT_SS:
> >  				/* A pre- or post-handler probe got us here. */
> >  				kprobes_inc_nmissed_count(p);
> >  				save_previous_kprobe(kcb);
> > @@ -278,6 +279,11 @@ void __kprobes kprobe_handler(struct pt_regs *regs)
> >  				singlestep(p, regs, kcb);
> >  				restore_previous_kprobe(kcb);
> >  				break;
> > +			case KPROBE_REENTER:
> > +				/* A nested probe was hit in FIQ, it is a BUG */
> > +				pr_warn("Unrecoverable kprobe detected at %p.\n",
> > +					p->addr);
> > +				/* fall through */
> >  			default:
> >  				/* impossible cases */
> >  				BUG();
> > 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

  reply	other threads:[~2017-02-14 15:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13 15:02 [BUGFIX PATCH 0/3] kprobes/arm: Improve kprobes implementation on arm Masami Hiramatsu
2017-02-13 15:03 ` [BUGFIX PATCH 1/3] kprobes/arm: Allow to handle reentered kprobe on single-stepping Masami Hiramatsu
2017-02-14 10:01   ` Jon Medhurst (Tixy)
2017-02-14 15:32     ` Masami Hiramatsu [this message]
2017-02-13 15:04 ` [BUGFIX PATCH 2/3] kprobes/arm: Skip single-stepping in recursing path if possible Masami Hiramatsu
2017-02-14 10:07   ` Jon Medhurst (Tixy)
2017-02-14 15:31     ` Masami Hiramatsu
2017-02-13 15:05 ` [BUGFIX PATCH 3/3] kprobes/arm: Fix the return address of multiple kretprobes Masami Hiramatsu
2017-02-14 10:32   ` Jon Medhurst (Tixy)
2017-02-14 13:47     ` Jon Medhurst (Tixy)
2017-02-14 16:01       ` Masami Hiramatsu
2017-02-14 16:39         ` Jon Medhurst (Tixy)
2017-02-14 23:55           ` Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170215003259.5d4336af80bf185256042640@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=ananth@linux.vnet.ibm.com \
    --cc=catalin.marinas@arm.com \
    --cc=dave.long@linaro.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sandeepa.s.prabhu@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=tixy@linaro.org \
    --cc=wangnan0@huawei.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome