aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/nospec-branch.h3
-rw-r--r--arch/x86/kernel/vmlinux.lds.S6
-rw-r--r--arch/x86/lib/retpoline.S2
3 files changed, 10 insertions, 1 deletions
diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
index 7b45d8424150..19ba5ad19c65 100644
--- a/arch/x86/include/asm/nospec-branch.h
+++ b/arch/x86/include/asm/nospec-branch.h
@@ -194,6 +194,9 @@ enum spectre_v2_mitigation {
194 SPECTRE_V2_IBRS, 194 SPECTRE_V2_IBRS,
195}; 195};
196 196
197extern char __indirect_thunk_start[];
198extern char __indirect_thunk_end[];
199
197/* 200/*
198 * On VMEXIT we must ensure that no RSB predictions learned in the guest 201 * On VMEXIT we must ensure that no RSB predictions learned in the guest
199 * can be followed in the host, by overwriting the RSB completely. Both 202 * can be followed in the host, by overwriting the RSB completely. Both
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 1e413a9326aa..9b138a06c1a4 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -124,6 +124,12 @@ SECTIONS
124 ASSERT(. - _entry_trampoline == PAGE_SIZE, "entry trampoline is too big"); 124 ASSERT(. - _entry_trampoline == PAGE_SIZE, "entry trampoline is too big");
125#endif 125#endif
126 126
127#ifdef CONFIG_RETPOLINE
128 __indirect_thunk_start = .;
129 *(.text.__x86.indirect_thunk)
130 __indirect_thunk_end = .;
131#endif
132
127 /* End of text section */ 133 /* End of text section */
128 _etext = .; 134 _etext = .;
129 } :text = 0x9090 135 } :text = 0x9090
diff --git a/arch/x86/lib/retpoline.S b/arch/x86/lib/retpoline.S
index cb45c6cb465f..d3415dc30f82 100644
--- a/arch/x86/lib/retpoline.S
+++ b/arch/x86/lib/retpoline.S
@@ -9,7 +9,7 @@
9#include <asm/nospec-branch.h> 9#include <asm/nospec-branch.h>
10 10
11.macro THUNK reg 11.macro THUNK reg
12 .section .text.__x86.indirect_thunk.\reg 12 .section .text.__x86.indirect_thunk
13 13
14ENTRY(__x86_indirect_thunk_\reg) 14ENTRY(__x86_indirect_thunk_\reg)
15 CFI_STARTPROC 15 CFI_STARTPROC