[PATCH] ARM: decompressor: fix BSS size calculation for LLVM ld.lld

Guillaume Tucker guillaume.tucker at collabora.com
Sat Feb 6 08:16:02 EST 2021

On 05/02/2021 18:11, Ard Biesheuvel wrote:
> On Fri, 5 Feb 2021 at 19:00, Nick Desaulniers <ndesaulniers at google.com> wrote:
>> On Fri, Feb 5, 2021 at 12:52 AM Ard Biesheuvel <ardb at kernel.org> wrote:
>>> 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.
>>> Cc: Nick Desaulniers <ndesaulniers at google.com>
>>> Cc: Nathan Chancellor <nathan at kernel.org>
>>> Cc: Guillaume Tucker <guillaume.tucker at collabora.com>
>>> Link: https://lore.kernel.org/linux-arm-kernel/6c65bcef-d4e7-25fa-43cf-2c435bb61bb9@collabora.com/
>>> Signed-off-by: Ard Biesheuvel <ardb at kernel.org>
>> Reviewed-by: Nick Desaulniers <ndesaulniers at google.com>
>> Tested-by: Nick Desaulniers <ndesaulniers at google.com>
>> Thanks for debugging+fixing this, and Guillaume for the report.  It's
>> nice to see a fix so early; thinking back to last year before KernelCI
>> integration, we probably would have only noticed when CrOS went to
>> upgrade their rk3288 platform devices.
>> Some other tags that might be nice to apply:
>> Cc: stable at kernel.org
>> Fixes: 429f7a062e3b ("ARM: decompressor: fix BSS size calculation")
>> Reported-by: Guillaume Tucker <guillaume.tucker at collabora.com>
>> Reported-by: "kernelci.org bot" <bot at kernelci.org>
> Thanks. I'll add these tags and drop this patch into the patch system

Thanks!  You may even add:

  Tested-by: "kernelci.org bot" <bot at kernelci.org>

See some results here, showing it's all booting fine:


with this revision from your for-kernelci branch:


Best wishes,

More information about the linux-arm-kernel mailing list