Thread (8 messages) flat view 8 messages, 3 authors, 2017-02-15

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

From: Naveen N. Rao <hidden>
Date: 2017-02-15 17:58:16
Also in: lkml

On 2017/02/16 12:17AM, Masami Hiramatsu wrote:
On Tue, 14 Feb 2017 14:08:01 +0530
"Naveen N. Rao" [off-list ref] wrote:
quoted
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>
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help