[PATCH v4 04/12] ARM: entry: Fix iWMMXT TIF flag handling

Linus Walleij linus.walleij at linaro.org
Tue Mar 21 07:32:21 PDT 2023


On Mon, Mar 20, 2023 at 2:19 PM Ard Biesheuvel <ardb at kernel.org> wrote:

> The conditional MOVS instruction that appears to have been added to test
> for the TIF_USING_IWMMXT thread_info flag only sets the N and Z
> condition flags and register R7, none of which are referenced in the
> subsequent code. This means that the instruction does nothing, which
> means that we might misidentify faulting FPE instructions as iWMMXT
> instructions on kernels that were built to support both.
>
> This seems to have been part of the original submission of the code, and
> so this has never worked as intended, and nobody ever noticed, and so we
> might decide to just leave this as-is. However, with the ongoing move
> towards multiplatform kernels, the issue becomes more likely to
> manifest, and so it is better to fix it.
>
> So check whether we are dealing with an undef exception regarding
> coprocessor index #0 or #1, and if so, load the thread_info flag and
> only dispatch it as a iWMMXT trap if the flag is set.
>
> Cc: <stable at vger.kernel.org> # v2.6.9+
> Signed-off-by: Ard Biesheuvel <ardb at kernel.org>

Looks right to me.
Reviewed-by: Linus Walleij <linus.walleij at linaro.org>

The code dates back before git history, but it was introduced in
Linux v2.6.9 and it looks like Nicolas Pitre wrote it so let's just
ping him and see what he remembers about this!

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list