All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] x86/build: only align ENTRY_TEXT to PMD_SIZE if necessary
@ 2025-07-09 20:16 Hamza Mahfooz
  2025-07-09 20:16 ` [PATCH 2/2] x86/mm/64: free the gap between BSS_MAIN and BSS_DECRYPTED Hamza Mahfooz
  2025-07-10 13:14 ` [PATCH 1/2] x86/build: only align ENTRY_TEXT to PMD_SIZE if necessary Dave Hansen
  0 siblings, 2 replies; 6+ messages in thread
From: Hamza Mahfooz @ 2025-07-09 20:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Andy Lutomirski, Peter Zijlstra, David Woodhouse,
	Guenter Roeck, 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 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 4fa0be732af1..522297cebe7c 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -65,8 +65,13 @@ 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
 
 /*
  * This section contains data which will be mapped as decrypted. Memory
-- 
2.49.0


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

end of thread, other threads:[~2025-07-17  8:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-09 20:16 [PATCH 1/2] x86/build: only align ENTRY_TEXT to PMD_SIZE if necessary Hamza Mahfooz
2025-07-09 20:16 ` [PATCH 2/2] x86/mm/64: free the gap between BSS_MAIN and BSS_DECRYPTED Hamza Mahfooz
2025-07-10 13:15   ` Dave Hansen
2025-07-10 13:14 ` [PATCH 1/2] x86/build: only align ENTRY_TEXT to PMD_SIZE if necessary Dave Hansen
2025-07-16 21:19   ` Hamza Mahfooz
2025-07-17  8:32   ` Nikolay Borisov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.