From: Kris Van Hees Date: Tue, 16 May 2017 03:05:41 +0000 (-0400) Subject: dtrace: make FBT entry probe detection less restrictive on x86_64 X-Git-Tag: v4.1.12-102.0.20170529_2200~57^2~15 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=65eca0f3c5984c5d1f360afc4bb52a31379d415a;p=users%2Fjedix%2Flinux-maple.git dtrace: make FBT entry probe detection less restrictive on x86_64 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 Reviewed-by: Tomas Jedlicka --- diff --git a/arch/x86/kernel/dtrace_fbt.c b/arch/x86/kernel/dtrace_fbt.c index 923d108206284..e84344e53d382 100644 --- a/arch/x86/kernel/dtrace_fbt.c +++ b/arch/x86/kernel/dtrace_fbt.c @@ -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);