arm64/fpsimd: Clear SME state in the target task when setting the VL
authorMark Brown <broonie@kernel.org>
Wed, 2 Aug 2023 23:46:39 +0000 (00:46 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Aug 2023 10:08:21 +0000 (12:08 +0200)
commit654c1dd350c746244e4dd4fe1fde577a2dc93d96
treeffdf78882cf907103a31618dda8b1eb99ce7e516
parentbae353469a282d4a0ac27f07a0ba5137ad1a049d
arm64/fpsimd: Clear SME state in the target task when setting the VL

commit c9bb40b7f786662e33d71afe236442b0b61f0446 upstream.

When setting SME vector lengths we clear TIF_SME to reenable SME traps,
doing a reallocation of the backing storage on next use. We do this using
clear_thread_flag() which operates on the current thread, meaning that when
setting the vector length via ptrace we may both not force traps for the
target task and force a spurious flush of any SME state that the tracing
task may have.

Clear the flag in the target task.

Fixes: e12310a0d30f ("arm64/sme: Implement ptrace support for streaming mode SVE registers")
Reported-by: David Spickett <David.Spickett@arm.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230803-arm64-fix-ptrace-tif-sme-v1-1-88312fd6fbfd@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/kernel/fpsimd.c