Messages in this thread Patch in this message | | | Date | Mon, 22 Nov 2021 18:03:04 +0100 | From | Peter Zijlstra <> | Subject | [RFC][PATCH 3/6] x86: Add ENDBR to IRET-to-Self |
| |
The IRET-to-Self chunks trigger forward code references without ENDBR, fix that.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> --- arch/x86/entry/entry_64.S | 2 ++ arch/x86/include/asm/sync_core.h | 2 ++ 2 files changed, 4 insertions(+)
--- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -39,6 +39,7 @@ #include <asm/trapnr.h> #include <asm/nospec-branch.h> #include <asm/fsgsbase.h> +#include <asm/ibt.h> #include <linux/err.h> #include "calling.h" @@ -1309,6 +1310,7 @@ SYM_CODE_START(asm_exc_nmi) iretq /* continues at repeat_nmi below */ UNWIND_HINT_IRET_REGS 1: + ENDBR #endif repeat_nmi: --- a/arch/x86/include/asm/sync_core.h +++ b/arch/x86/include/asm/sync_core.h @@ -6,6 +6,7 @@ #include <asm/processor.h> #include <asm/cpufeature.h> #include <asm/special_insns.h> +#include <asm/ibt.h> #ifdef CONFIG_X86_32 static inline void iret_to_self(void) @@ -34,6 +35,7 @@ static inline void iret_to_self(void) "pushq $1f\n\t" "iretq\n\t" "1:" + ASM_ENDBR : "=&r" (tmp), ASM_CALL_CONSTRAINT : : "cc", "memory"); } #endif /* CONFIG_X86_32 */
| |