Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1580448 > unrolled thread

Re: [BUGFIX PATCH 2/3] kprobes/arm: Skip single-stepping in recursing path if possible

Started by"Jon Medhurst (Tixy)" <tixy@linaro.org>
First post2017-02-14 11:10 +0100
Last post2017-02-14 16:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [BUGFIX PATCH 2/3] kprobes/arm: Skip single-stepping in  recursing path if possible "Jon Medhurst (Tixy)" <tixy@linaro.org> - 2017-02-14 11:10 +0100
    Re: [BUGFIX PATCH 2/3] kprobes/arm: Skip single-stepping in  recursing path if possible Masami Hiramatsu <mhiramat@kernel.org> - 2017-02-14 16:40 +0100

#1580448 — Re: [BUGFIX PATCH 2/3] kprobes/arm: Skip single-stepping in recursing path if possible

From"Jon Medhurst (Tixy)" <tixy@linaro.org>
Date2017-02-14 11:10 +0100
SubjectRe: [BUGFIX PATCH 2/3] kprobes/arm: Skip single-stepping in recursing path if possible
Message-ID<taIdz-sN-13@gated-at.bofh.it>
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. */
> 

[toc] | [next] | [standalone]


#1580610

FromMasami Hiramatsu <mhiramat@kernel.org>
Date2017-02-14 16:40 +0100
Message-ID<taNmW-3BD-15@gated-at.bofh.it>
In reply to#1580448
On Tue, 14 Feb 2017 10:07:17 +0000
"Jon Medhurst (Tixy)" <tixy@linaro.org> wrote:

> 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."

OK, Thanks!

> 
> 
> > 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. */
> > 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web