aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/kernel/vmlinux.lds.S
diff options
context:
space:
mode:
authorGravatar Borislav Petkov (AMD) <bp@alien8.de> 2023-05-15 16:07:26 +0200
committerGravatar Borislav Petkov (AMD) <bp@alien8.de> 2023-05-17 12:14:21 +0200
commitf220125b999b2c9694149c6bda2798d8096f47ed (patch)
tree7cee09cfdcadf0a27866192d98be136f3a388130 /arch/x86/kernel/vmlinux.lds.S
parentx86/cpu: Remove X86_FEATURE_NAMES (diff)
downloadlinux-f220125b999b2c9694149c6bda2798d8096f47ed.tar.gz
linux-f220125b999b2c9694149c6bda2798d8096f47ed.tar.bz2
linux-f220125b999b2c9694149c6bda2798d8096f47ed.zip
x86/retbleed: Add __x86_return_thunk alignment checks
Add a linker assertion and compute the 0xcc padding dynamically so that __x86_return_thunk is always cacheline-aligned. Leave the SYM_START() macro in as the untraining doesn't need ENDBR annotations anyway. Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Link: https://lore.kernel.org/r/20230515140726.28689-1-bp@alien8.de
Diffstat (limited to 'arch/x86/kernel/vmlinux.lds.S')
-rw-r--r--arch/x86/kernel/vmlinux.lds.S4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 25f155205770..03c885d3640f 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -508,4 +508,8 @@ INIT_PER_CPU(irq_stack_backing_store);
"fixed_percpu_data is not at start of per-cpu area");
#endif
+#ifdef CONFIG_RETHUNK
+. = ASSERT((__x86_return_thunk & 0x3f) == 0, "__x86_return_thunk not cacheline-aligned");
+#endif
+
#endif /* CONFIG_X86_64 */