]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dtrace: make FBT entry probe detection less restrictive on x86_64
authorKris Van Hees <kris.van.hees@oracle.com>
Tue, 16 May 2017 03:05:41 +0000 (23:05 -0400)
committerKris Van Hees <kris.van.hees@oracle.com>
Tue, 23 May 2017 13:44:30 +0000 (09:44 -0400)
The logic on x86_64 to determine whether we can probe a function is
too restrictive.  By placing the probe on the "push %rbp" instruction
we can cover more functions, in case the "mov %rsp,%rbp" instruction
does not follow it immediately.

Orabug: 25949030
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Reviewed-by: Tomas Jedlicka <tomas.jedlicka@oracle.com>
arch/x86/kernel/dtrace_fbt.c

index 923d10820628458626e471321acf0fedab4a0cf3..e84344e53d3821ba0889c7bb1a4ef17230ee81a6 100644 (file)
@@ -152,33 +152,27 @@ void dtrace_fbt_init(fbt_add_probe_fn fbt_add_probe)
 
                        switch (state) {
                        case 0: /* start of function */
-                               if (*addr == FBT_PUSHL_EBP)
-                                       state = 1;
-                               else if (insc > 2)
-                                       state = 2;
-                               break;
-                       case 1: /* push %rbp seen */
-                               if (*addr == FBT_MOV_RSP_RBP_1 &&
-                                   *(addr + 1) == FBT_MOV_RSP_RBP_2 &&
-                                   *(addr + 2) == FBT_MOV_RSP_RBP_3)
+                               if (*addr == FBT_PUSHL_EBP) {
                                        fbt_add_probe(
                                                dtrace_kmod, sym.name,
                                                FBT_ENTRY, *addr, addr, NULL);
-                               state = 2;
+                                       state = 1;
+                               } else if (insc > 2)
+                                       state = 2;
                                break;
-                       case 2: /* look for ret */
+                       case 1: /* look for ret */
                                if (*addr == FBT_RET &&
                                    (*(addr + 1) == FBT_PUSHL_EBP ||
                                     *(addr + 1) == FBT_NOP)) {
                                        fbt_add_probe(
                                                dtrace_kmod, sym.name,
                                                FBT_RETURN, *addr, addr, fbtp);
-                                       state = 3;
+                                       state = 2;
                                }
                                break;
                        }
 
-                       if (state == 3)
+                       if (state == 2)
                                break;
 
                        kernel_insn_init(&insn, addr, MAX_INSN_SIZE);