Skip to content

Commit 431a380

Browse files
committed
kstack_erase: Disable kstack_erase for all of arm compressed boot code
When building with CONFIG_KSTACK_ERASE=y and CONFIG_ARM_ATAG_DTB_COMPAT=y, the compressed boot environment encounters an undefined symbol error: ld.lld: error: undefined symbol: __sanitizer_cov_stack_depth >>> referenced by atags_to_fdt.c:135 This occurs because the compiler instruments the atags_to_fdt() function with sanitizer coverage calls, but the minimal compressed boot environment lacks access to sanitizer runtime support. The compressed boot environment already disables stack protector with -fno-stack-protector. Similarly disable sanitizer coverage by adding $(DISABLE_KSTACK_ERASE) to the general compiler flags (and remove it from the one place it was noticed before), which contains the appropriate flags to prevent sanitizer instrumentation. This follows the same pattern used in other early boot contexts where sanitizer runtime support is unavailable. Reported-by: Linux Kernel Functional Testing <[email protected]> Closes: https://lore.kernel.org/all/CA+G9fYtBk8qnpWvoaFwymCx5s5i-5KXtPGpmf=_+UKJddCOnLA@mail.gmail.com Reported-by: Nathan Chancellor <[email protected]> Closes: https://lore.kernel.org/all/20250726004313.GA3650901@ax162 Suggested-by: Nathan Chancellor <[email protected]> Tested-by: Nathan Chancellor <[email protected]> Signed-off-by: Kees Cook <[email protected]>
1 parent 8245d47 commit 431a380

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arm/boot/compressed/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ OBJS =
99

1010
HEAD = head.o
1111
OBJS += misc.o decompress.o
12-
CFLAGS_decompress.o += $(DISABLE_KSTACK_ERASE)
1312
ifeq ($(CONFIG_DEBUG_UNCOMPRESS),y)
1413
OBJS += debug.o
1514
AFLAGS_head.o += -DDEBUG
@@ -96,6 +95,7 @@ KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
9695

9796
ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin \
9897
-I$(srctree)/scripts/dtc/libfdt -fno-stack-protector \
98+
$(DISABLE_KSTACK_ERASE) \
9999
-I$(obj)
100100
ccflags-remove-$(CONFIG_FUNCTION_TRACER) += -pg
101101
asflags-y := -DZIMAGE

0 commit comments

Comments
 (0)