diff options
author | Peter Zijlstra <peterz@infradead.org> | 2022-03-08 16:30:55 +0100 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2022-03-15 10:32:47 +0100 |
commit | 89bc853eae4ad125030ef99f207ba76c2f00a26e (patch) | |
tree | 7f3aa0f233858f04ee61872e4ae3a795433b4fa4 /tools/objtool/objtool.c | |
parent | 08f87a93c8ec709698edba66a5167077181fc978 (diff) | |
download | linux-89bc853eae4ad125030ef99f207ba76c2f00a26e.tar.gz linux-89bc853eae4ad125030ef99f207ba76c2f00a26e.tar.bz2 linux-89bc853eae4ad125030ef99f207ba76c2f00a26e.zip |
objtool: Find unused ENDBR instructions
Find all ENDBR instructions which are never referenced and stick them
in a section such that the kernel can poison them, sealing the
functions from ever being an indirect call target.
This removes about 1-in-4 ENDBR instructions.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/20220308154319.763643193@infradead.org
Diffstat (limited to 'tools/objtool/objtool.c')
-rw-r--r-- | tools/objtool/objtool.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/objtool/objtool.c b/tools/objtool/objtool.c index bdf699f6552b..b09946f4e1d6 100644 --- a/tools/objtool/objtool.c +++ b/tools/objtool/objtool.c @@ -128,6 +128,7 @@ struct objtool_file *objtool_open_read(const char *_objname) INIT_LIST_HEAD(&file.retpoline_call_list); INIT_LIST_HEAD(&file.static_call_list); INIT_LIST_HEAD(&file.mcount_loc_list); + INIT_LIST_HEAD(&file.endbr_list); file.c_file = !vmlinux && find_section_by_name(file.elf, ".comment"); file.ignore_unreachables = no_unreachable; file.hints = false; |