[PATCH] arm64: sme: Use STR P to clear FFR context field in streaming SVE mode

Anders Roxell anders.roxell at linaro.org
Wed Jun 28 23:43:26 PDT 2023


On Wed, 28 Jun 2023 at 17:56, Will Deacon <will at kernel.org> wrote:
>
> The FFR is a predicate register which can vary between 16 and 256 bits
> in size depending upon the configured vector length. When saving the
> SVE state in streaming SVE mode, the FFR register is inaccessible and
> so commit 9f5848665788 ("arm64/sve: Make access to FFR optional") simply
> clears the FFR field of the in-memory context structure. Unfortunately,
> it achieves this using an unconditional 8-byte store and so if the SME
> vector length is anything other than 64 bytes in size we will either
> fail to clear the entire field or, worse, we will corrupt memory
> immediately following the structure. This has led to intermittent kfence
> splats in CI [1] and can trigger kmalloc Redzone corruption messages
> when running the 'fp-stress' kselftest:

Tested-by: Anders Roxell <anders.roxell at linaro.org>

I applied your patch on next-20230628 and ran the kselftest-arm64
tests over night...
I've not been able to reproduce "BUG: KFENCE: memory corruption in
fpsimd_release_task".

Cheers,
Anders



More information about the linux-arm-kernel mailing list