]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dtrace: support passing offset as arg0 to FBT return probes
authorKris Van Hees <kris.van.hees@oracle.com>
Tue, 16 May 2017 03:25:09 +0000 (23:25 -0400)
committerKris Van Hees <kris.van.hees@oracle.com>
Tue, 23 May 2017 13:44:33 +0000 (09:44 -0400)
FBT return probes pass the offset from the function start (in bytes)
as arg0.  To make that possible, we pass the offset value in the call
to fbt_add_probe.  For FBT entry probes we pass 0 (which is ignored).

Orabug: 25949086
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Acked-by: Nick Alcock <nick.alcock@oracle.com>
arch/sparc/kernel/dtrace_fbt.c
arch/x86/kernel/dtrace_fbt.c
include/linux/dtrace_fbt.h

index 5ab8e363aebf5f7d4aa63925107d95ab841210d1..2178e7736f7f39ff5b89a02ad59bbaac3b1eed67 100644 (file)
@@ -280,7 +280,7 @@ void dtrace_fbt_init(fbt_add_probe_fn fbt_add_probe)
                                continue;
 
                        fbt_add_probe(dtrace_kmod, sym.name, FBT_ENTRY, 32,
-                                     addr + 1, NULL);
+                                     addr + 1, 0, NULL);
                } else
                        continue;
        }
index e84344e53d3821ba0889c7bb1a4ef17230ee81a6..43f0b83af80cfb5ac8ff8905f2d20cbe0a2314be 100644 (file)
@@ -155,7 +155,8 @@ void dtrace_fbt_init(fbt_add_probe_fn fbt_add_probe)
                                if (*addr == FBT_PUSHL_EBP) {
                                        fbt_add_probe(
                                                dtrace_kmod, sym.name,
-                                               FBT_ENTRY, *addr, addr, NULL);
+                                               FBT_ENTRY, *addr, addr, 0,
+                                               NULL);
                                        state = 1;
                                } else if (insc > 2)
                                        state = 2;
@@ -164,9 +165,13 @@ void dtrace_fbt_init(fbt_add_probe_fn fbt_add_probe)
                                if (*addr == FBT_RET &&
                                    (*(addr + 1) == FBT_PUSHL_EBP ||
                                     *(addr + 1) == FBT_NOP)) {
+                                       uintptr_t       off;
+
+                                       off = addr - (asm_instr_t *)sym.value;
                                        fbt_add_probe(
                                                dtrace_kmod, sym.name,
-                                               FBT_RETURN, *addr, addr, fbtp);
+                                               FBT_RETURN, *addr, addr, off,
+                                               fbtp);
                                        state = 2;
                                }
                                break;
index 3bc8b771386f915db7032ac606e7ca55c26cd1be..a7789eb84ec090ba5105915c1385f5053ffc635f 100644 (file)
@@ -26,7 +26,7 @@ extern unsigned long dtrace_fbt_nfuncs __attribute__((weak));
 #define FBT_RETURN     1
 
 typedef void *(*fbt_add_probe_fn)(struct module *, char *, int, int,
-                                 asm_instr_t *, void *);
+                                 asm_instr_t *, uintptr_t, void *);
 extern void dtrace_fbt_init(fbt_add_probe_fn);
 
 #endif /* _LINUX_DTRACE_FBT_H */