Skip to content

Commit 8481446

Browse files
guoren83palmer-dabbelt
authored andcommitted
riscv: Fixup bootup failure with HARDENED_USERCOPY
6184358 ("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/[email protected]/T/#t Signed-off-by: Guo Ren <[email protected]> Reported-by: Aurelien Jarno <[email protected]> Tested-by: Aurelien Jarno <[email protected]> [Palmer: Clean up commit text] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent a78c6f5 commit 8481446

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/riscv/kernel/vmlinux.lds.S

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@ SECTIONS
2222
/* Beginning of code and text segment */
2323
. = LOAD_OFFSET;
2424
_start = .;
25-
_stext = .;
2625
HEAD_TEXT_SECTION
2726
. = ALIGN(PAGE_SIZE);
2827

2928
__init_begin = .;
3029
INIT_TEXT_SECTION(PAGE_SIZE)
31-
INIT_DATA_SECTION(16)
3230
. = ALIGN(8);
3331
__soc_early_init_table : {
3432
__soc_early_init_table_start = .;
@@ -55,6 +53,7 @@ SECTIONS
5553
. = ALIGN(SECTION_ALIGN);
5654
.text : {
5755
_text = .;
56+
_stext = .;
5857
TEXT_TEXT
5958
SCHED_TEXT
6059
CPUIDLE_TEXT
@@ -67,6 +66,8 @@ SECTIONS
6766
_etext = .;
6867
}
6968

69+
INIT_DATA_SECTION(16)
70+
7071
/* Start of data section */
7172
_sdata = .;
7273
RO_DATA(SECTION_ALIGN)

0 commit comments

Comments
 (0)