|
|
241913 |
commit 9b6f4d4e4f2649b05459be4ecf48a42661163fd1
|
|
|
241913 |
Author: Stan Cox <scox@redhat.com>
|
|
|
241913 |
Date: Fri Feb 25 14:09:26 2022 -0500
|
|
|
241913 |
|
|
|
241913 |
PR28557: module probe insertion on modern kernels
|
|
|
241913 |
|
|
|
241913 |
Similar to commit 0425c60d7 but for return probes. Try to fully relocate
|
|
|
241913 |
addresses, before letting the kernel try it with symbols / kallsyms.
|
|
|
241913 |
|
|
|
241913 |
diff --git a/runtime/linux/kprobes.c b/runtime/linux/kprobes.c
|
|
|
241913 |
index d59935d06..09f0e0665 100644
|
|
|
241913 |
--- a/runtime/linux/kprobes.c
|
|
|
241913 |
+++ b/runtime/linux/kprobes.c
|
|
|
241913 |
@@ -269,15 +269,17 @@ stapkp_prepare_kretprobe(struct stap_kprobe_probe *skp)
|
|
|
241913 |
struct kretprobe *krp = &skp->kprobe->u.krp;
|
|
|
241913 |
unsigned long addr = 0;
|
|
|
241913 |
|
|
|
241913 |
- if (! skp->symbol_name) {
|
|
|
241913 |
- addr = stapkp_relocate_addr(skp);
|
|
|
241913 |
- if (addr == 0)
|
|
|
241913 |
- return 1;
|
|
|
241913 |
- krp->kp.addr = (void *) addr;
|
|
|
241913 |
+ // PR28557 Try a pass resolving the address now with the currently
|
|
|
241913 |
+ // known module/section addresses within our own stap-symbols tables.
|
|
|
241913 |
+ addr = stapkp_relocate_addr(skp);
|
|
|
241913 |
+ if (addr != 0) {
|
|
|
241913 |
+ krp->kp.addr = (void*) addr;
|
|
|
241913 |
}
|
|
|
241913 |
- else {
|
|
|
241913 |
+ // fall back to kallsyms-based or kernel kprobes-delegated symbolic
|
|
|
241913 |
+ // registration
|
|
|
241913 |
+ else if (skp->symbol_name) {
|
|
|
241913 |
if (USE_KALLSYMS_ON_EACH_SYMBOL && krp->kp.addr == 0)
|
|
|
241913 |
- return 1;
|
|
|
241913 |
+ return 4;
|
|
|
241913 |
else if (!USE_KALLSYMS_ON_EACH_SYMBOL) {
|
|
|
241913 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
|
|
|
241913 |
if (krp->kp.symbol_name == NULL)
|