OpenCloudOS-Kernel/tools/objtool
Peter Zijlstra 54262aa283 objtool: Fix sibling call detection
It turned out that we failed to detect some sibling calls;
specifically those without relocation records; like:

  $ ./objdump-func.sh defconfig-build/mm/kasan/generic.o __asan_loadN
  0000 0000000000000840 <__asan_loadN>:
  0000  840:      48 8b 0c 24             mov    (%rsp),%rcx
  0004  844:      31 d2                   xor    %edx,%edx
  0006  846:      e9 45 fe ff ff          jmpq   690 <check_memory_region>

So extend the cross-function jump to also consider those that are not
between known (or newly detected) parent/child functions, as
sibling-cals when they jump to the start of the function.

The second part of that condition is to deal with random jumps to the
middle of other function, as can be found in
arch/x86/lib/copy_user_64.S for example.

This then (with later patches applied) makes the above recognise the
sibling call:

  mm/kasan/generic.o: warning: objtool: __asan_loadN()+0x6: call to check_memory_region() with UACCESS enabled

Also make sure to set insn->call_dest for sibling calls so we can know
who we're calling. This is useful information when printing validation
warnings later.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
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
arch/x86 x86/unwind/orc: Detect the end of the stack 2018-06-21 16:34:56 +02:00
.gitignore objtool: Move synced files to their original relative locations 2017-11-07 10:48:23 +01:00
Build objtool: Add ORC unwind table generation 2017-07-18 10:57:43 +02:00
Makefile objtool: Query pkg-config for libelf location 2019-03-28 13:32:01 +01:00
arch.h objtool: Assume unannotated UD2 instructions are dead ends 2017-07-28 08:33:32 +02:00
builtin-check.c objtool: Add --backtrace support 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 --backtrace support 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 sibling call detection 2019-04-03 11:02:24 +02:00
check.h objtool: Rewrite add_ignores() 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: Handle function aliases 2019-04-03 11:02:24 +02:00
objtool.c objtool: Print top level commands on incorrect usage 2017-10-18 15:22:26 +02:00
orc.h objtool: Move synced files to their original relative locations 2017-11-07 10:48:23 +01: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
special.c x86/jump_table: Use relative references 2018-09-27 17:56:48 +02:00
special.h objtool: Add tool to perform compile-time stack metadata validation 2016-02-29 08:35:12 +01: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