public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jon Medhurst (Tixy)" <tixy@linaro.org>
To: Masami Hiramatsu <mhiramat@kernel.org>,
	Russell King <linux@armlinux.org.uk>
Cc: 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 2/3] kprobes/arm: Skip single-stepping in recursing path if possible
Date: Tue, 14 Feb 2017 10:07:17 +0000	[thread overview]
Message-ID: <1487066837.2978.4.camel@linaro.org> (raw)
In-Reply-To: <148699827839.8505.1518065390542643677.stgit@devbox>

On Tue, 2017-02-14 at 00:04 +0900, Masami Hiramatsu wrote:
> Kprobes/arm skips single-stepping (moreover handling the event)
> if the conditional instruction must not be executed. This
> also apply the rule when we hit the recursing kprobe, so
> that kprobe does not count nmissed up in that case.

Perhaps that last sentence would read better if written something like:

"This also applies that rule when we hit a recursing kprobe, so that the
nmissed count isn't incremented in that case."


> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>

Acked-by: Jon Medhurst <tixy@linaro.org>

> ---
>  arch/arm/probes/kprobes/core.c |   19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/arm/probes/kprobes/core.c b/arch/arm/probes/kprobes/core.c
> index 264fedb..84989ae 100644
> --- a/arch/arm/probes/kprobes/core.c
> +++ b/arch/arm/probes/kprobes/core.c
> @@ -265,7 +265,15 @@ void __kprobes kprobe_handler(struct pt_regs *regs)
>  #endif
>  
>  	if (p) {
> -		if (cur) {
> +		if (!p->ainsn.insn_check_cc(regs->ARM_cpsr)) {
> +			/*
> +			 * Probe hit but conditional execution check failed,
> +			 * so just skip the instruction and continue as if
> +			 * nothing had happened.
> +			 * In this case, we can skip recursing check too.
> +			 */
> +			singlestep_skip(p, regs);
> +		} else if (cur) {
>  			/* Kprobe is pending, so we're recursing. */
>  			switch (kcb->kprobe_status) {
>  			case KPROBE_HIT_ACTIVE:
> @@ -288,7 +296,7 @@ void __kprobes kprobe_handler(struct pt_regs *regs)
>  				/* impossible cases */
>  				BUG();
>  			}
> -		} else if (p->ainsn.insn_check_cc(regs->ARM_cpsr)) {
> +		} else {
>  			/* Probe hit and conditional execution check ok. */
>  			set_current_kprobe(p);
>  			kcb->kprobe_status = KPROBE_HIT_ACTIVE;
> @@ -309,13 +317,6 @@ void __kprobes kprobe_handler(struct pt_regs *regs)
>  				}
>  				reset_current_kprobe();
>  			}
> -		} else {
> -			/*
> -			 * Probe hit but conditional execution check failed,
> -			 * so just skip the instruction and continue as if
> -			 * nothing had happened.
> -			 */
> -			singlestep_skip(p, regs);
>  		}
>  	} else if (cur) {
>  		/* We probably hit a jprobe.  Call its break handler. */
> 

  reply	other threads:[~2017-02-14 10:07 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
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) [this message]
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=1487066837.2978.4.camel@linaro.org \
    --to=tixy@linaro.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=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sandeepa.s.prabhu@gmail.com \
    --cc=tglx@linutronix.de \
    --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