diff options
author | Peter Zijlstra <peterz@infradead.org> | 2021-03-26 18:12:15 +0300 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2021-04-02 13:47:28 +0300 |
commit | 9bc0bb50727c8ac69fbb33fb937431cf3518ff37 (patch) | |
tree | 586a82e95847ae6c3f393728fb074b1d6df9ae71 /arch/x86/include/asm/asm-prototypes.h | |
parent | 50e7b4a1a1b264fc7df0698f2defb93cadf19a7b (diff) | |
download | linux-9bc0bb50727c8ac69fbb33fb937431cf3518ff37.tar.xz |
objtool/x86: Rewrite retpoline thunk calls
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
Diffstat (limited to 'arch/x86/include/asm/asm-prototypes.h')
-rw-r--r-- | arch/x86/include/asm/asm-prototypes.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/x86/include/asm/asm-prototypes.h b/arch/x86/include/asm/asm-prototypes.h index 0545b07895a5..4cb726c71ed8 100644 --- a/arch/x86/include/asm/asm-prototypes.h +++ b/arch/x86/include/asm/asm-prototypes.h @@ -19,11 +19,19 @@ extern void cmpxchg8b_emu(void); #ifdef CONFIG_RETPOLINE -#define DECL_INDIRECT_THUNK(reg) \ +#undef GEN +#define GEN(reg) \ extern asmlinkage void __x86_indirect_thunk_ ## reg (void); +#include <asm/GEN-for-each-reg.h> + +#undef GEN +#define GEN(reg) \ + extern asmlinkage void __x86_indirect_alt_call_ ## reg (void); +#include <asm/GEN-for-each-reg.h> #undef GEN -#define GEN(reg) DECL_INDIRECT_THUNK(reg) +#define GEN(reg) \ + extern asmlinkage void __x86_indirect_alt_jmp_ ## reg (void); #include <asm/GEN-for-each-reg.h> #endif /* CONFIG_RETPOLINE */ |