[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20170215175805.GF3169@naverao1-tp.localdomain>
Date: Wed, 15 Feb 2017 23:28:05 +0530
From: "Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>
To: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Ananth N Mavinakayanahalli <ananth@...ux.vnet.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH 1/3] powerpc: kprobes: fix handling of function offsets
on ABIv2
On 2017/02/16 12:17AM, Masami Hiramatsu wrote:
> On Tue, 14 Feb 2017 14:08:01 +0530
> "Naveen N. Rao" <naveen.n.rao@...ux.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
Powered by blists - more mailing lists