objtool: Improve call destination function detection
authorJosh Poimboeuf <jpoimboe@redhat.com>
Tue, 18 Feb 2020 03:41:54 +0000 (21:41 -0600)
committerBorislav Petkov <bp@suse.de>
Fri, 21 Feb 2020 09:20:34 +0000 (10:20 +0100)
commit7acfe5315312fc56c2a94c9216448087b38ae909
treee3187f3209664e907dabf0fa7a0151d1a82e487f
parent113d4bc9048336ba7c3d2ad972dbad4aef6e148a
objtool: Improve call destination function detection

A recent clang change, combined with a binutils bug, can trigger a
situation where a ".Lprintk$local" STT_NOTYPE symbol gets created at the
same offset as the "printk" STT_FUNC symbol.  This confuses objtool:

  kernel/printk/printk.o: warning: objtool: ignore_loglevel_setup()+0x10: can't find call dest symbol at .text+0xc67

Improve the call destination detection by looking specifically for an
STT_FUNC symbol.

Reported-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Link: https://github.com/ClangBuiltLinux/linux/issues/872
Link: https://sourceware.org/bugzilla/show_bug.cgi?id=25551
Link: https://lkml.kernel.org/r/0a7ee320bc0ea4469bd3dc450a7b4725669e0ea9.1581997059.git.jpoimboe@redhat.com
tools/objtool/check.c
tools/objtool/elf.c
tools/objtool/elf.h