* [PATCH] vmlinux.lds.h: Handle decrypted data section with !SMP
@ 2021-05-06 0:14 Nathan Chancellor
2021-05-06 18:15 ` Nick Desaulniers
2021-06-04 18:03 ` Kees Cook
0 siblings, 2 replies; 3+ messages in thread
From: Nathan Chancellor @ 2021-05-06 0:14 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86, Kees Cook
Cc: Arnd Bergmann, Nick Desaulniers, linux-kernel, clang-built-linux,
Nathan Chancellor, kernel test robot
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: ac26963a1175 ("percpu: Introduce DEFINE_PER_CPU_DECRYPTED")
Link: https://github.com/ClangBuiltLinux/linux/issues/1360
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
I took the simple fix route with this patch since I highly doubt someone
is actually running a CONFIG_AMD_MEM_ENCRYPT=y + CONFIG_SMP=n kernel. If
this section should actually be in .data, I can respin.
include/asm-generic/vmlinux.lds.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 40a9c101565e..17325416e2de 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -960,6 +960,7 @@
#ifdef CONFIG_AMD_MEM_ENCRYPT
#define PERCPU_DECRYPTED_SECTION \
. = ALIGN(PAGE_SIZE); \
+ *(.data..decrypted) \
*(.data..percpu..decrypted) \
. = ALIGN(PAGE_SIZE);
#else
base-commit: 8404c9fbc84b741f66cff7d4934a25dd2c344452
--
2.31.1.442.g7e39198978
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] vmlinux.lds.h: Handle decrypted data section with !SMP
2021-05-06 0:14 [PATCH] vmlinux.lds.h: Handle decrypted data section with !SMP Nathan Chancellor
@ 2021-05-06 18:15 ` Nick Desaulniers
2021-06-04 18:03 ` Kees Cook
1 sibling, 0 replies; 3+ messages in thread
From: Nick Desaulniers @ 2021-05-06 18:15 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov,
maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
Kees Cook, Arnd Bergmann, LKML, clang-built-linux,
kernel test robot, Brijesh Singh, Tejun Heo
On Wed, May 5, 2021 at 5:28 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> 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: ac26963a1175 ("percpu: Introduce DEFINE_PER_CPU_DECRYPTED")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1360
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Thanks for the patch; LGTM.
Reviewed-by:Nick Desaulniers <ndesaulniers@google.com>
Tested-by: Nick Desaulniers <ndesaulniers@google.com> # build
> ---
>
> I took the simple fix route with this patch since I highly doubt someone
> is actually running a CONFIG_AMD_MEM_ENCRYPT=y + CONFIG_SMP=n kernel. If
> this section should actually be in .data, I can respin.
>
> include/asm-generic/vmlinux.lds.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index 40a9c101565e..17325416e2de 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -960,6 +960,7 @@
> #ifdef CONFIG_AMD_MEM_ENCRYPT
> #define PERCPU_DECRYPTED_SECTION \
> . = ALIGN(PAGE_SIZE); \
> + *(.data..decrypted) \
> *(.data..percpu..decrypted) \
> . = ALIGN(PAGE_SIZE);
> #else
>
> base-commit: 8404c9fbc84b741f66cff7d4934a25dd2c344452
> --
> 2.31.1.442.g7e39198978
>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] vmlinux.lds.h: Handle decrypted data section with !SMP
2021-05-06 0:14 [PATCH] vmlinux.lds.h: Handle decrypted data section with !SMP Nathan Chancellor
2021-05-06 18:15 ` Nick Desaulniers
@ 2021-06-04 18:03 ` Kees Cook
1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2021-06-04 18:03 UTC (permalink / raw)
To: Borislav Petkov, Thomas Gleixner, Ingo Molnar, Nathan Chancellor, x86
Cc: Kees Cook, kernel test robot, Arnd Bergmann, Nick Desaulniers,
clang-built-linux, linux-kernel
On Wed, 5 May 2021 17:14:11 -0700, Nathan Chancellor wrote:
> 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
>
> [...]
Applied to for-next/orphans, thanks!
[1/1] vmlinux.lds.h: Avoid orphan section with !SMP
https://git.kernel.org/kees/c/d4c639990036
--
Kees Cook
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-04 18:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06 0:14 [PATCH] vmlinux.lds.h: Handle decrypted data section with !SMP Nathan Chancellor
2021-05-06 18:15 ` Nick Desaulniers
2021-06-04 18:03 ` Kees Cook
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.