]> www.infradead.org Git - users/dwmw2/linux.git/commit
objtool/x86: Rewrite retpoline thunk calls
authorPeter Zijlstra <peterz@infradead.org>
Fri, 26 Mar 2021 15:12:15 +0000 (16:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Jul 2022 09:26:18 +0000 (11:26 +0200)
commit0b2c8bf4983bdefbb69337c7d68cbe7c2d47a61a
tree226f04f45c546a34db77aa950169cd93347e5e44
parented7783dca5baff4103c214214abf0a3aeb27a79f
objtool/x86: Rewrite retpoline thunk calls

commit 9bc0bb50727c8ac69fbb33fb937431cf3518ff37 upstream.

When the compiler emits: "CALL __x86_indirect_thunk_\reg" for an
indirect call, have objtool rewrite it to:

ALTERNATIVE "call __x86_indirect_thunk_\reg",
    "call *%reg", ALT_NOT(X86_FEATURE_RETPOLINE)

Additionally, in order to not emit endless identical
.altinst_replacement chunks, use a global symbol for them, see
__x86_indirect_alt_*.

This also avoids objtool from having to do code generation.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Link: https://lkml.kernel.org/r/20210326151300.320177914@infradead.org
[bwh: Backported to 5.10: include "arch_elf.h" instead of "arch/elf.h"]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/asm-prototypes.h
arch/x86/lib/retpoline.S
tools/objtool/arch/x86/decode.c