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


Groups > linux.kernel > #1626502

Re: [PATCH v3 6/7] powerpc: kprobes: emulate instructions on kprobe handler re-entry

From "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 6/7] powerpc: kprobes: emulate instructions on kprobe handler re-entry
Date 2017-04-19 18:50 +0200
Message-ID <ty0XM-5M7-5@gated-at.bofh.it> (permalink)
References <txXnb-3yQ-3@gated-at.bofh.it> <txXnd-3yQ-71@gated-at.bofh.it> <txZ5F-4CC-41@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Excerpts from Masami Hiramatsu's message of April 19, 2017 20:13:
> 
> BTW, as I pointed, 5/7 and 6/7 should be merged since this actually
> makes meaningful change.

Yes, sorry if I wasn't clear in my previous reply in the (!) previous 
patch series.

Since this has to go through the powerpc tree, I followed this since I 
felt that Michael Ellerman prefers to keep functional changes separate 
from refactoring. I'm fine with either approach.

Michael?

Thanks!
- Naveen

> 
> Thank you,
> 
> On Wed, 19 Apr 2017 18:21:05 +0530
> "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> wrote:
> 
>> On kprobe handler re-entry, try to emulate the instruction rather than
>> single stepping always.
>> 
>> Acked-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
>> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
>> ---
>>  arch/powerpc/kernel/kprobes.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>> 
>> diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
>> index 46e8c1e03ce4..067e9863bfdf 100644
>> --- a/arch/powerpc/kernel/kprobes.c
>> +++ b/arch/powerpc/kernel/kprobes.c
>> @@ -276,6 +276,14 @@ int __kprobes kprobe_handler(struct pt_regs *regs)
>>  			kprobes_inc_nmissed_count(p);
>>  			prepare_singlestep(p, regs);
>>  			kcb->kprobe_status = KPROBE_REENTER;
>> +			if (p->ainsn.boostable >= 0) {
>> +				ret = try_to_emulate(p, regs);
>> +
>> +				if (ret > 0) {
>> +					restore_previous_kprobe(kcb);
>> +					return 1;
>> +				}
>> +			}
>>  			return 1;
>>  		} else {
>>  			if (*addr != BREAKPOINT_INSTRUCTION) {
>> -- 
>> 2.12.1
>> 
> 
> 
> -- 
> Masami Hiramatsu <mhiramat@kernel.org>
> 
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/7] powerpc: a few kprobe fixes and refactoring "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-04-19 15:00 +0200
  [PATCH v3 5/7] powerpc: kprobes: factor out code to emulate instruction into a helper "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-04-19 15:00 +0200
    Re: [PATCH v3 5/7] powerpc: kprobes: factor out code to emulate  instruction into a helper Masami Hiramatsu <mhiramat@kernel.org> - 2017-04-19 16:50 +0200
  [PATCH v3 1/7] kprobes: convert kprobe_lookup_name() to a function "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-04-19 15:00 +0200
  [PATCH v3 6/7] powerpc: kprobes: emulate instructions on kprobe handler re-entry "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-04-19 15:00 +0200
    Re: [PATCH v3 6/7] powerpc: kprobes: emulate instructions on kprobe  handler re-entry Masami Hiramatsu <mhiramat@kernel.org> - 2017-04-19 16:50 +0200
      Re: [PATCH v3 6/7] powerpc: kprobes: emulate instructions on kprobe  handler re-entry "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-04-19 18:50 +0200
        Re: [PATCH v3 6/7] powerpc: kprobes: emulate instructions on kprobe handler re-entry Michael Ellerman <mpe@ellerman.id.au> - 2017-04-20 08:20 +0200
          Re: [PATCH v3 6/7] powerpc: kprobes: emulate instructions on kprobe  handler re-entry Masami Hiramatsu <mhiramat@kernel.org> - 2017-04-21 15:50 +0200

csiph-web