objtool: Find unused ENDBR instructions
authorPeter Zijlstra <peterz@infradead.org>
Tue, 8 Mar 2022 15:30:55 +0000 (16:30 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 15 Mar 2022 09:32:47 +0000 (10:32 +0100)
commit89bc853eae4ad125030ef99f207ba76c2f00a26e
tree7f3aa0f233858f04ee61872e4ae3a795433b4fa4
parent08f87a93c8ec709698edba66a5167077181fc978
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
arch/x86/kernel/vmlinux.lds.S
tools/objtool/check.c
tools/objtool/include/objtool/objtool.h
tools/objtool/objtool.c