mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/2] x86/build: only align ENTRY_TEXT to PMD_SIZE if necessary
@ 2026-06-23 15:24 Hamza Mahfooz
  2026-06-23 15:24 ` [PATCH v2 2/2] x86/mm/64: free the gap between BSS_MAIN and BSS_DECRYPTED Hamza Mahfooz
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hamza Mahfooz @ 2026-06-23 15:24 UTC (permalink / raw)
  To: x86
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Andy Lutomirski, Peter Zijlstra, Ard Biesheuvel,
	Nathan Chancellor, linux-kernel, Hamza Mahfooz, Jared White

PTI requires the begin and end of ENTRY_TEXT be aligned to PMD_SIZE.
SRSO requires srso_alias_untrain_ret to be 2M aligned. This costs
between 2-4 MiB of RAM (depending on the size of the preceding section).
So, only align when PTI is enabled or SRSO is enabled.

Co-developed-by: Jared White <jaredwhite@microsoft.com>
Signed-off-by: Jared White <jaredwhite@microsoft.com>
Signed-off-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
---
 arch/x86/kernel/vmlinux.lds.S | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 4711a35e706c..53519fa7c772 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -65,8 +65,14 @@ const_cpu_current_top_of_stack = cpu_current_top_of_stack;
 		__end_rodata_hpage_align = .;			\
 		__end_rodata_aligned = .;
 
+#if defined(CONFIG_MITIGATION_PAGE_TABLE_ISOLATION) || defined(CONFIG_MITIGATION_SRSO)
 #define ALIGN_ENTRY_TEXT_BEGIN	. = ALIGN(PMD_SIZE);
 #define ALIGN_ENTRY_TEXT_END	. = ALIGN(PMD_SIZE);
+#else
+#define ALIGN_ENTRY_TEXT_BEGIN
+#define ALIGN_ENTRY_TEXT_END
+#endif
+
 #else
 
 #define X86_ALIGN_RODATA_BEGIN
-- 
2.54.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-10  9:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-23 15:24 [PATCH v2 1/2] x86/build: only align ENTRY_TEXT to PMD_SIZE if necessary Hamza Mahfooz
2026-06-23 15:24 ` [PATCH v2 2/2] x86/mm/64: free the gap between BSS_MAIN and BSS_DECRYPTED Hamza Mahfooz
2026-07-09 22:36   ` Borislav Petkov
2026-07-09 23:14 ` [tip: x86/cleanups] x86/build: Only align ENTRY_TEXT to PMD_SIZE if necessary tip-bot2 for Hamza Mahfooz
2026-07-10  9:30 ` [tip: x86/build] " tip-bot2 for Hamza Mahfooz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®