Skip to contentSkip to conversation

x86/mm: Guard adding .bbs..decrypted section with CONFIG_AMD_MEM_ENCRYPT

PATCH Superseded Lepton Wu 1 participant 2 messages Nov 6, 2023

Subsystems (2)
lore
Share & tools
lore

Lepton Wu

author
#0 lore raw

PATCH 1/1 x86/mm: Guard adding .bbs..decrypted section with CONFIG_AMD_MEM_ENCRYPT

commit b3f0907c71e0 ("x86/mm: Add .bss..decrypted section to hold shared variables") usage on some kernels without CONFIG_AMD_MEM_ENCRYPT. Fix it by guarding it with CONFIG_AMD_MEM_ENCRYP.

---
 arch/x86/kernel/vmlinux.lds.S | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/x86/kernel/vmlinux.lds.S +8 -0
index 54a5596adaa6..d39798a23f86 100644
@@ -69,6 +69,8 @@ jiffies = jiffies_64;
 #define ALIGN_ENTRY_TEXT_BEGIN	. = ALIGN(PMD_SIZE);
 #define ALIGN_ENTRY_TEXT_END	. = ALIGN(PMD_SIZE);
 
+#ifdef CONFIG_AMD_MEM_ENCRYPT
+
 /*
  * This section contains data which will be mapped as decrypted. Memory
  * encryption operates on a page basis. Make this section PMD-aligned
@@ -88,6 +90,12 @@ jiffies = jiffies_64;
 
 #else
 
+#define BSS_DECRYPTED
+
+#endif
+
+#else
+
 #define X86_ALIGN_RODATA_BEGIN
 #define X86_ALIGN_RODATA_END					\
 		. = ALIGN(PAGE_SIZE);				\
Signature · 1 line
2.42.0.869.gea05f2083d-goog
author
#1 lore raw

PATCH v2 1/1 x86/mm: Guard adding .bbs..decrypted section with CONFIG_AMD_MEM_ENCRYPT

commit b3f0907c71e0 ("x86/mm: Add .bss..decrypted section to hold shared variables") adds almost 2M memory usage on some kernels without CONFIG_AMD_MEM_ENCRYPT. Fix it by guarding it with CONFIG_AMD_MEM_ENCRYPT.

---
 arch/x86/kernel/vmlinux.lds.S | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/x86/kernel/vmlinux.lds.S +8 -0
index 54a5596adaa6..d39798a23f86 100644
@@ -69,6 +69,8 @@ jiffies = jiffies_64;
 #define ALIGN_ENTRY_TEXT_BEGIN	. = ALIGN(PMD_SIZE);
 #define ALIGN_ENTRY_TEXT_END	. = ALIGN(PMD_SIZE);
 
+#ifdef CONFIG_AMD_MEM_ENCRYPT
+
 /*
  * This section contains data which will be mapped as decrypted. Memory
  * encryption operates on a page basis. Make this section PMD-aligned
@@ -88,6 +90,12 @@ jiffies = jiffies_64;
 
 #else
 
+#define BSS_DECRYPTED
+
+#endif
+
+#else
+
 #define X86_ALIGN_RODATA_BEGIN
 #define X86_ALIGN_RODATA_END					\
 		. = ALIGN(PAGE_SIZE);				\
Signature · 1 line
2.42.0.869.gea05f2083d-goog