Skip to content

Commit c4e792d

Browse files
ardbiesheuvelRussell King
authored andcommitted
ARM: 9056/1: decompressor: fix BSS size calculation for LLVM ld.lld
The LLVM ld.lld linker uses a different symbol type for __bss_start, resulting in the calculation of KBSS_SZ to be thrown off. Up until now, this has gone unnoticed as it only affects the appended DTB case, but pending changes for ARM in the way the decompressed kernel is cleaned from the caches has uncovered this problem. On a ld.lld build: $ nm vmlinux |grep bss_ c1c22034 D __bss_start c1c86e98 B __bss_stop resulting in $ readelf -s arch/arm/boot/compressed/vmlinux | grep bss_size 433: c1c86e98 0 NOTYPE GLOBAL DEFAULT ABS _kernel_bss_size which is obviously incorrect, and may cause the cache clean to access unmapped memory, or cause the size calculation to wrap, resulting in no cache clean to be performed at all. Fix this by updating the sed regex to take D type symbols into account. Link: https://lore.kernel.org/linux-arm-kernel/[email protected]/ Link: https://lore.kernel.org/linux-arm-kernel/[email protected]/ Cc: <[email protected]> # v4.19+ Reviewed-by: Nick Desaulniers <[email protected]> Tested-by: Nick Desaulniers <[email protected]> Reported-by: Guillaume Tucker <[email protected]> Reported-by: "kernelci.org bot" <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent a38fd87 commit c4e792d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm/boot/compressed/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ asflags-y := -DZIMAGE
118118

119119
# Supply kernel BSS size to the decompressor via a linker symbol.
120120
KBSS_SZ = $(shell echo $$(($$($(NM) $(obj)/../../../../vmlinux | \
121-
sed -n -e 's/^\([^ ]*\) [AB] __bss_start$$/-0x\1/p' \
122-
-e 's/^\([^ ]*\) [AB] __bss_stop$$/+0x\1/p') )) )
121+
sed -n -e 's/^\([^ ]*\) [ABD] __bss_start$$/-0x\1/p' \
122+
-e 's/^\([^ ]*\) [ABD] __bss_stop$$/+0x\1/p') )) )
123123
LDFLAGS_vmlinux = --defsym _kernel_bss_size=$(KBSS_SZ)
124124
# Supply ZRELADDR to the decompressor via a linker symbol.
125125
ifneq ($(CONFIG_AUTO_ZRELADDR),y)

0 commit comments

Comments
 (0)