Skip to content

Commit 000f887

Browse files
nathanchancekees
authored andcommitted
vmlinux.lds.h: Fix placement of '.data..decrypted' section
Commit d4c6399 ("vmlinux.lds.h: Avoid orphan section with !SMP") fixed an orphan section warning by adding the '.data..decrypted' section to the linker script under the PERCPU_DECRYPTED_SECTION define but that placement introduced a panic with !SMP, as the percpu sections are not instantiated with that configuration so attempting to access variables defined with DEFINE_PER_CPU_DECRYPTED() will result in a page fault. Move the '.data..decrypted' section to the DATA_MAIN define so that the variables in it are properly instantiated at boot time with CONFIG_SMP=n. Cc: [email protected] Fixes: d4c6399 ("vmlinux.lds.h: Avoid orphan section with !SMP") Link: https://lore.kernel.org/[email protected]/ Debugged-by: Ard Biesheuvel <[email protected]> Reported-by: Zhao Wenhui <[email protected]> Tested-by: xiafukun <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 6f7630b commit 000f887

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/asm-generic/vmlinux.lds.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@
341341
#define DATA_DATA \
342342
*(.xiptext) \
343343
*(DATA_MAIN) \
344+
*(.data..decrypted) \
344345
*(.ref.data) \
345346
*(.data..shared_aligned) /* percpu related */ \
346347
MEM_KEEP(init.data*) \
@@ -989,7 +990,6 @@
989990
#ifdef CONFIG_AMD_MEM_ENCRYPT
990991
#define PERCPU_DECRYPTED_SECTION \
991992
. = ALIGN(PAGE_SIZE); \
992-
*(.data..decrypted) \
993993
*(.data..percpu..decrypted) \
994994
. = ALIGN(PAGE_SIZE);
995995
#else

0 commit comments

Comments
 (0)