Skip to content

Commit d4c6399

Browse files
nathanchancekees
authored andcommitted
vmlinux.lds.h: Avoid orphan section with !SMP
With x86_64_defconfig and the following configs, there is an orphan section warning: CONFIG_SMP=n CONFIG_AMD_MEM_ENCRYPT=y CONFIG_HYPERVISOR_GUEST=y CONFIG_KVM=y CONFIG_PARAVIRT=y ld: warning: orphan section `.data..decrypted' from `arch/x86/kernel/cpu/vmware.o' being placed in section `.data..decrypted' ld: warning: orphan section `.data..decrypted' from `arch/x86/kernel/kvm.o' being placed in section `.data..decrypted' These sections are created with DEFINE_PER_CPU_DECRYPTED, which ultimately turns into __PCPU_ATTRS, which in turn has a section attribute with a value of PER_CPU_BASE_SECTION + the section name. When CONFIG_SMP is not set, the base section is .data and that is not currently handled in any linker script. Add .data..decrypted to PERCPU_DECRYPTED_SECTION, which is included in PERCPU_INPUT -> PERCPU_SECTION, which is include in the x86 linker script when either CONFIG_X86_64 or CONFIG_SMP is unset, taking care of the warning. Fixes: ac26963 ("percpu: Introduce DEFINE_PER_CPU_DECRYPTED") Link: ClangBuiltLinux#1360 Reported-by: kernel test robot <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Tested-by: Nick Desaulniers <[email protected]> # build Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d94b93a commit d4c6399

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

include/asm-generic/vmlinux.lds.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,7 @@
960960
#ifdef CONFIG_AMD_MEM_ENCRYPT
961961
#define PERCPU_DECRYPTED_SECTION \
962962
. = ALIGN(PAGE_SIZE); \
963+
*(.data..decrypted) \
963964
*(.data..percpu..decrypted) \
964965
. = ALIGN(PAGE_SIZE);
965966
#else

0 commit comments

Comments
 (0)