From: Kris Van Hees Date: Tue, 16 May 2017 02:42:30 +0000 (-0400) Subject: dtrace: adjust FBT entry probe dection for OL7 X-Git-Tag: v4.1.12-102.0.20170529_2200~57^2~16 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ee6513d58c43302144fe275f0e25151ba66e7fe4;p=users%2Fjedix%2Flinux-maple.git dtrace: adjust FBT entry probe dection for OL7 On OL7, function prologues can be prefixed by a (5-byte) call instruction on x86_64, which breaks the logic to determine if we can place an FBT entry probe on that function. The new logic accounts for the possibility that the anticipated prologue does not show up as first instruction of the function. Orabug: 25921361 Signed-off-by: Kris Van Hees Reviewed-by: Nick Alcock --- diff --git a/arch/x86/kernel/dtrace_fbt.c b/arch/x86/kernel/dtrace_fbt.c index 4d6c0777f67e1..923d108206284 100644 --- a/arch/x86/kernel/dtrace_fbt.c +++ b/arch/x86/kernel/dtrace_fbt.c @@ -79,7 +79,7 @@ void dtrace_fbt_init(fbt_add_probe_fn fbt_add_probe) kallsyms_iter_reset(&sym, 0); while (kallsyms_iter_update(&sym, pos++)) { asm_instr_t *addr, *end; - int state = 0; + int state = 0, insc = 0; void *efbp = NULL; void *fbtp = NULL; @@ -148,11 +148,13 @@ void dtrace_fbt_init(fbt_add_probe_fn fbt_add_probe) while (addr < end) { struct insn insn; + insc++; + switch (state) { case 0: /* start of function */ if (*addr == FBT_PUSHL_EBP) state = 1; - else + else if (insc > 2) state = 2; break; case 1: /* push %rbp seen */