* [PATCH] vmlinux.lds.h: Fix placement of '.data..decrypted' section
@ 2022-11-08 17:49 Nathan Chancellor
2022-11-08 18:00 ` Kees Cook
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2022-11-08 17:49 UTC (permalink / raw)
To: Arnd Bergmann, Kees Cook
Cc: linux-arch, linux-kernel, Nathan Chancellor, stable,
Ard Biesheuvel, Zhao Wenhui, xiafukun
Commit d4c639990036 ("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: stable@vger.kernel.org
Fixes: d4c639990036 ("vmlinux.lds.h: Avoid orphan section with !SMP")
Link: https://lore.kernel.org/cbbd3548-880c-d2ca-1b67-5bb93b291d5f@huawei.com/
Debugged-by: Ard Biesheuvel <ardb@kernel.org>
Reported-by: Zhao Wenhui <zhaowenhui8@huawei.com>
Tested-by: xiafukun <xiafukun@huawei.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
include/asm-generic/vmlinux.lds.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index d06ada2341cb..3dc5824141cd 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -347,6 +347,7 @@
#define DATA_DATA \
*(.xiptext) \
*(DATA_MAIN) \
+ *(.data..decrypted) \
*(.ref.data) \
*(.data..shared_aligned) /* percpu related */ \
MEM_KEEP(init.data*) \
@@ -995,7 +996,6 @@
#ifdef CONFIG_AMD_MEM_ENCRYPT
#define PERCPU_DECRYPTED_SECTION \
. = ALIGN(PAGE_SIZE); \
- *(.data..decrypted) \
*(.data..percpu..decrypted) \
. = ALIGN(PAGE_SIZE);
#else
base-commit: f0c4d9fc9cc9462659728d168387191387e903cc
--
2.38.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] vmlinux.lds.h: Fix placement of '.data..decrypted' section
2022-11-08 17:49 [PATCH] vmlinux.lds.h: Fix placement of '.data..decrypted' section Nathan Chancellor
@ 2022-11-08 18:00 ` Kees Cook
0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2022-11-08 18:00 UTC (permalink / raw)
To: nathan, Arnd Bergmann
Cc: Kees Cook, linux-kernel, stable, linux-arch, xiafukun, ardb, zhaowenhui8
On Tue, 8 Nov 2022 10:49:34 -0700, Nathan Chancellor wrote:
> Commit d4c639990036 ("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.
>
> [...]
Applied to for-linus/hardening, thanks!
[1/1] vmlinux.lds.h: Fix placement of '.data..decrypted' section
https://git.kernel.org/kees/c/000f8870a47b
--
Kees Cook
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-08 18:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08 17:49 [PATCH] vmlinux.lds.h: Fix placement of '.data..decrypted' section Nathan Chancellor
2022-11-08 18:00 ` 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.