[PATCH] ARM: decompressor: clean decompressed kernel from cache twice on v7

Ard Biesheuvel ardb at kernel.org
Fri Feb 5 03:53:57 EST 2021


On Thu, 4 Feb 2021 at 14:03, Ard Biesheuvel <ardb at kernel.org> wrote:
>
> Commit 5a29552af92dbd62 ("ARM: 9052/1: decompressor: cover BSS in cache
> clean and reorder with MMU disable on v7") moved cleaning of the kernel
> image to after the point where the MMU and caches are disabled, which is
> more in line with the architectural requirements. Unfortunately, doing
> so caused a regression on Clang builds, crashing before any diagnostic
> output is printed.
>
> Given that the full cleaning the cache afterwards is required in any
> case, let's reinstate the original cache clean of just the decompressed
> image occurring beforehand, amounting to a partial revert of the commit
> in question. Doing so has been confirmed by the reporter of the
> regression to mitigate it.
>
> Fixes: 5a29552af92dbd62 ("ARM: 9052/1: decompressor: cover BSS in ...")
> Reported-by: "kernelci.org bot" <bot at kernelci.org>
> Signed-off-by: Ard Biesheuvel <ardb at kernel.org>

Please disregard this patch - this turns out to be an interoperability
issue with LLVM ld.lld

> ---
>  arch/arm/boot/compressed/head.S | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
> index 5c97d341de6b..4e49ac64bf49 100644
> --- a/arch/arm/boot/compressed/head.S
> +++ b/arch/arm/boot/compressed/head.S
> @@ -616,14 +616,18 @@ not_relocated:    mov     r0, #0
>                 @ operations on the range [R0, R1], making this prior call to
>                 @ cache_clean_flush() redundant. In other cases, the clean is
>                 @ performed by set/way and R0/R1 are ignored.
> +               @ However, not performing the redundant cache clean before
> +               @ turning the MMU and caches off has been observed to cause
> +               @ regressions, so on v7+ systems, the decompressed kernel image
> +               @ is cleaned twice.
>                 @
> -               mov     r0, #0
> -               mov     r1, #0
> +               get_inflated_image_size r6, r2, r3
> +               mov     r0, r4                  @ start of decompressed kernel
> +               add     r1, r0, r6              @ end of decompressed kernel
>                 bl      cache_clean_flush
>
> -               get_inflated_image_size r1, r2, r3
>                 ldr     r2, =_kernel_bss_size
> -               add     r1, r1, r2
> +               add     r1, r2, r6
>
>                 mov     r0, r4                  @ start of decompressed kernel
>                 add     r1, r1, r0              @ end of kernel BSS
> --
> 2.20.1
>



More information about the linux-arm-kernel mailing list