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


Groups > linux.kernel > #1581521

Re: [PATCH 1/3] powerpc: kprobes: fix handling of function offsets on ABIv2

From "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/3] powerpc: kprobes: fix handling of function offsets on ABIv2
Date 2017-02-15 19:00 +0100
Message-ID <tbc1Z-32F-33@gated-at.bofh.it> (permalink)
References <taGOu-7QG-9@gated-at.bofh.it> <tb9x7-1Fk-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2017/02/16 12:17AM, Masami Hiramatsu wrote:
> On Tue, 14 Feb 2017 14:08:01 +0530
> "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> wrote:
> 
> > commit 239aeba76409 ("perf powerpc: Fix kprobe and kretprobe handling
> > with kallsyms on ppc64le") changed how we use the offset field in struct
> > kprobe on ABIv2. perf now offsets from the GEP (Global entry point) if an
> > offset is specified and otherwise chooses the LEP (Local entry point).
> > 
> > Fix the same in kernel for kprobe API users. We do this by extending
> > kprobe_lookup_name() to accept an additional parameter to indicate the
> > offset specified with the kprobe registration. If offset is 0, we return
> > the local function entry and return the global entry point otherwise.
> > 

<snip>

> > diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> > index 83ad7e440417..9bc433575d98 100644
> > --- a/kernel/kprobes.c
> > +++ b/kernel/kprobes.c
> > @@ -63,7 +63,7 @@
> >   * so this must be overridable.
> >   */
> >  #ifndef kprobe_lookup_name
> > -#define kprobe_lookup_name(name, addr) \
> > +#define kprobe_lookup_name(name, addr, offset) \
> >  	addr = ((kprobe_opcode_t *)(kallsyms_lookup_name(name)))
> >  #endif
> 
> Hmm, it smells no good coding... I would like to use __weak function
> instead of this "#ifndef" trick.

Can't say I wasn't tempted. KPROBES_ON_FTRACE makes this worse. I will 
clean this up.

Thanks!
- Naveen

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


Thread

[PATCH 1/3] powerpc: kprobes: fix handling of function offsets on ABIv2 "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-02-14 09:40 +0100
  [PATCH 2/3] powerpc: kprobes: factor out code to emulate instruction into a helper "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-02-14 09:40 +0100
    Re: [PATCH 2/3] powerpc: kprobes: factor out code to emulate  instruction into a helper Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> - 2017-02-14 09:50 +0100
  Re: [PATCH 1/3] powerpc: kprobes: fix handling of function offsets  on ABIv2 Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> - 2017-02-14 09:50 +0100
  Re: [PATCH 1/3] powerpc: kprobes: fix handling of function offsets  on ABIv2 Masami Hiramatsu <mhiramat@kernel.org> - 2017-02-15 16:20 +0100
    Re: [PATCH 1/3] powerpc: kprobes: fix handling of function offsets  on ABIv2 "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-02-15 19:00 +0100

csiph-web