Skip to content

Commit 110febc

Browse files
committed
ARC: fix CONFIG_HARDENED_USERCOPY
Currently enabling this triggers a warning | usercopy: Kernel memory overwrite attempt detected to kernel text (offset 155633, size 11)! | usercopy: BUG: failure at mm/usercopy.c:99/usercopy_abort()! | |gcc generated __builtin_trap |Path: /bin/busybox |CPU: 0 PID: 84 Comm: init Not tainted 5.4.22 | |[ECR ]: 0x00090005 => gcc generated __builtin_trap |[EFA ]: 0x9024fcaa |[BLINK ]: usercopy_abort+0x8a/0x8c |[ERET ]: memfd_fcntl+0x0/0x470 |[STAT32]: 0x80080802 : IE K |... |... |Stack Trace: | memfd_fcntl+0x0/0x470 | usercopy_abort+0x8a/0x8c | __check_object_size+0x10e/0x138 | copy_strings+0x1f4/0x38c | __do_execve_file+0x352/0x848 | EV_Trap+0xcc/0xd0 The issue is triggered by an allocation in "init reclaimed" region. ARC _stext emcompasses the init region (for historical reasons we wanted the init.text to be under .text as well). This however trips up __check_object_size()->check_kernel_text_object() which treats this as object bleeding into kernel text. Fix that by rezoning _stext to start from regular kernel .text and leave out .init altogether. Fixes: foss-for-synopsys-dwc-arc-processors#15 Reported-by: Evgeniy Didin <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Vineet Gupta <[email protected]>
1 parent 96f1b00 commit 110febc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arc/kernel/vmlinux.lds.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ SECTIONS
5757
.init.ramfs : { INIT_RAM_FS }
5858

5959
. = ALIGN(PAGE_SIZE);
60-
_stext = .;
6160

6261
HEAD_TEXT_SECTION
6362
INIT_TEXT_SECTION(L1_CACHE_BYTES)
@@ -83,6 +82,7 @@ SECTIONS
8382

8483
.text : {
8584
_text = .;
85+
_stext = .;
8686
TEXT_TEXT
8787
SCHED_TEXT
8888
CPUIDLE_TEXT

0 commit comments

Comments
 (0)