Commit a01bb2fc authored by Nathan Chancellor's avatar Nathan Chancellor Committed by sanglipeng
Browse files

vmlinux.lds.h: Fix placement of '.data..decrypted' section

stable inclusion
from stable-v5.10.155
commit 516f9f23008b1e3033df7944f5d616b95076acd3
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7M5F4

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=516f9f23008b1e3033df7944f5d616b95076acd3

--------------------------------

commit 000f8870 upstream.

Commit d4c63999 ("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: d4c63999 ("vmlinux.lds.h: Avoid orphan section with !SMP")
Link: https://lore.kernel.org/cbbd3548-880c-d2ca-1b67-5bb93b291d5f@huawei.com/


Debugged-by: default avatarArd Biesheuvel <ardb@kernel.org>
Reported-by: default avatarZhao Wenhui <zhaowenhui8@huawei.com>
Tested-by: default avatarxiafukun <xiafukun@huawei.com>
Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20221108174934.3384275-1-nathan@kernel.org


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 7910082f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment