On Mon, Mar 20, 2023 at 2:19 PM Ard Biesheuvel ardb@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@vger.kernel.org # v2.6.9+ Signed-off-by: Ard Biesheuvel ardb@kernel.org
Looks right to me. Reviewed-by: Linus Walleij linus.walleij@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