Commit 82108b57 authored by Mark Brown's avatar Mark Brown Committed by Lee Jones
Browse files

UPSTREAM: arm64/fpsimd: Ensure SME storage is allocated after SVE VL changes



When we reconfigure the SVE vector length we discard the backing storage
for the SVE vectors and then reallocate on next SVE use, leaving the SME
specific state alone. This means that we do not enable SME traps if they
were already disabled. That means that userspace code can enter streaming
mode without trapping, putting the task in a state where if we try to save
the state of the task we will fault.

Since the ABI does not specify that changing the SVE vector length disturbs
SME state, and since SVE code may not be aware of SME code in the process,
we shouldn't simply discard any ZA state. Instead immediately reallocate
the storage for SVE, and disable SME if we change the SVE vector length
while there is no SME state active.

Disabling SME traps on SVE vector length changes would make the overall
code more complex since we would have a state where we have valid SME state
stored but might get a SME trap.

Bug: 254441685
Fixes: 9e4ab6c8 ("arm64/sme: Implement vector length configuration prctl()s")
Reported-by: default avatarDavid Spickett <David.Spickett@arm.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230720-arm64-fix-sve-sme-vl-change-v2-1-8eea06b82d57@kernel.org


Signed-off-by: default avatarWill Deacon <will@kernel.org>
(cherry picked from commit d4d5be94)
Signed-off-by: default avatarLee Jones <joneslee@google.com>
Change-Id: Ia988b31b7582d40aa26fc2186becb3cc7920cb47
parent 8afe474a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment