LoongArch: Fix lockdep static memory detection
authorHelge Deller <deller@gmx.de>
Wed, 20 Sep 2023 06:26:28 +0000 (14:26 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Wed, 20 Sep 2023 06:26:28 +0000 (14:26 +0800)
commit68ffa230daa0d35b7cce476098433d763d5fd42f
tree68cb85b50fabb03cb2b37a569307e0a857a837d4
parentce9ecca0238b140b88f43859b211c9fdfd8e5b70
LoongArch: Fix lockdep static memory detection

Since commit 0a6b58c5cd0d ("lockdep: fix static memory detection even
more") the lockdep code uses is_kernel_core_data(), is_kernel_rodata()
and init_section_contains() to verify if a lock is located inside a
kernel static data section.

This change triggers a failure on LoongArch, for which the vmlinux.lds.S
script misses to put the locks (as part of in the .data.rel symbols)
into the Linux data section.

This patch fixes the lockdep problem by moving *(.data.rel*) symbols
into the kernel data section (from _sdata to _edata).

Additionally, move other wrongly assigned symbols too:
- altinstructions into the _initdata section,
- PLT symbols behind the read-only section, and
- *(.la_abs) into the data section.

Cc: stable <stable@kernel.org> # v6.4+
Fixes: 0a6b58c5cd0d ("lockdep: fix static memory detection even more")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/kernel/vmlinux.lds.S