linux/tools/objtool/include/objtool
Josh Poimboeuf ed1cb76ebd objtool: Detect non-relocated text references
When kernel IBT is enabled, objtool detects all text references in order
to determine which functions can be indirectly branched to.

In text, such references look like one of the following:

   mov    $0x0,%rax        R_X86_64_32S     .init.text+0x7e0a0
   lea    0x0(%rip),%rax   R_X86_64_PC32    autoremove_wake_function-0x4

Either way the function pointer is denoted by a relocation, so objtool
just reads that.

However there are some "lea xxx(%rip)" cases which don't use relocations
because they're referencing code in the same translation unit.  Objtool
doesn't have visibility to those.

The only currently known instances of that are a few hand-coded asm text
references which don't actually need ENDBR.  So it's not actually a
problem at the moment.

However if we enable -fpie, the compiler would start generating them and
there would definitely be bugs in the IBT sealing.

Detect non-relocated text references and handle them appropriately.

[ Note: I removed the manual static_call_tramp check -- that should
  already be handled by the noendbr check. ]

Reported-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
2024-10-17 15:13:06 -07:00
..
arch.h objtool: Detect non-relocated text references 2024-10-17 15:13:06 -07:00
builtin.h objtool: Add verbose option for disassembling affected functions 2023-05-16 06:31:51 -07:00
cfi.h objtool: Allow stack operations in UNWIND_HINT_UNDEFINED regions 2023-06-07 10:03:11 -07:00
check.h x86,objtool: Separate unret validation from unwind hints 2023-03-23 23:18:58 +01:00
elf.h objtool: Handle frame pointer related instructions 2024-09-17 22:23:09 +08:00
endianness.h objtool: Use target file endianness instead of a compiled constant 2022-11-18 19:00:15 +11:00
objtool.h objtool: Remove instruction::list 2023-02-23 09:21:44 +01:00
orc.h objtool/x86: Separate arch-specific and generic parts 2024-03-11 22:23:47 +08:00
special.h objtool: Optimize layout of struct special_alt 2023-02-01 09:15:24 -08:00
warn.h objtool: Include backtrace in verbose mode 2023-05-16 06:31:52 -07:00