riscv: Fixup bootup failure with HARDENED_USERCOPY
authorGuo Ren <guoren@linux.alibaba.com>
Tue, 6 Oct 2020 16:49:33 +0000 (16:49 +0000)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Wed, 7 Oct 2020 01:34:00 +0000 (18:34 -0700)
commit84814460eef9af0fb56a4698341c9cb7996a6312
treee10b394b9d0d3154a6553e11335144c610b4aa7c
parenta78c6f5956a949b496a5b087188dde52483edf51
riscv: Fixup bootup failure with HARDENED_USERCOPY

6184358da000 ("riscv: Fixup static_obj() fail") attempted to elide a lockdep
failure by rearranging our kernel image to place all initdata within [_stext,
_end], thus triggering lockdep to treat these as static objects.  These objects
are released and eventually reallocated, causing check_kernel_text_object() to
trigger a BUG().

This backs out the change to make [_stext, _end] all-encompassing, instead just
moving initdata.  This results in initdata being outside of [__init_begin,
__init_end], which means initdata can't be freed.

Link: https://lore.kernel.org/linux-riscv/1593266228-61125-1-git-send-email-guoren@kernel.org/T/#t
Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Reported-by: Aurelien Jarno <aurelien@aurel32.net>
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
[Palmer: Clean up commit text]
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/kernel/vmlinux.lds.S