linux/tools/objtool
Josh Poimboeuf e6f393bc93 objtool: Fix function fallthrough detection
When a function falls through to the next function due to a compiler
bug, objtool prints some obscure warnings.  For example:

  drivers/regulator/core.o: warning: objtool: regulator_count_voltages()+0x95: return with modified stack frame
  drivers/regulator/core.o: warning: objtool: regulator_count_voltages()+0x0: stack state mismatch: cfa1=7+32 cfa2=7+8

Instead it should be printing:

  drivers/regulator/core.o: warning: objtool: regulator_supply_is_couple() falls through to next function regulator_count_voltages()

This used to work, but was broken by the following commit:

  13810435b9 ("objtool: Support GCC 8's cold subfunctions")

The padding nops at the end of a function aren't actually part of the
function, as defined by the symbol table.  So the 'func' variable in
validate_branch() is getting cleared to NULL when a padding nop is
encountered, breaking the fallthrough detection.

If the current instruction doesn't have a function associated with it,
just consider it to be part of the previously detected function by not
overwriting the previous value of 'func'.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: <stable@vger.kernel.org>
Fixes: 13810435b9 ("objtool: Support GCC 8's cold subfunctions")
Link: http://lkml.kernel.org/r/546d143820cd08a46624ae8440d093dd6c902cae.1557766718.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2019-05-13 20:31:17 +02:00
..
arch/x86 objtool: Add Direction Flag validation 2019-04-03 11:02:24 +02:00
Documentation x86/asm: Fix inline asm call constraints for Clang 2017-09-23 15:06:20 +02:00
.gitignore objtool: Move synced files to their original relative locations 2017-11-07 10:48:23 +01:00
arch.h objtool: Add Direction Flag validation 2019-04-03 11:02:24 +02:00
Build objtool: Add ORC unwind table generation 2017-07-18 10:57:43 +02:00
builtin-check.c objtool: Add UACCESS validation 2019-04-03 11:02:24 +02:00
builtin-orc.c objtool: Use existing global variables for options 2018-02-21 09:05:04 +01:00
builtin.h objtool: Add UACCESS validation 2019-04-03 11:02:24 +02:00
cfi.h objtool: Handle GCC stack pointer adjustment bug 2017-08-30 10:48:41 +02:00
check.c objtool: Fix function fallthrough detection 2019-05-13 20:31:17 +02:00
check.h objtool: Add Direction Flag validation 2019-04-03 11:02:24 +02:00
elf.c objtool: Handle function aliases 2019-04-03 11:02:24 +02:00
elf.h objtool: Add UACCESS validation 2019-04-03 11:02:24 +02:00
Makefile objtool: Query pkg-config for libelf location 2019-03-28 13:32:01 +01:00
objtool.c objtool: Print top level commands on incorrect usage 2017-10-18 15:22:26 +02:00
orc_dump.c x86/unwind/orc: Detect the end of the stack 2018-06-21 16:34:56 +02:00
orc_gen.c x86/unwind/orc: Detect the end of the stack 2018-06-21 16:34:56 +02:00
orc.h objtool: Move synced files to their original relative locations 2017-11-07 10:48:23 +01:00
special.c objtool: Add UACCESS validation 2019-04-03 11:02:24 +02:00
special.h objtool: Add UACCESS validation 2019-04-03 11:02:24 +02:00
sync-check.sh objtool: Move kernel headers/code sync check to a script 2017-11-07 10:48:34 +01:00
warn.h objtool: Add --backtrace support 2019-04-03 11:02:24 +02:00