diff mbox series

arm64/ptrace: Flush FP state when setting ZT0

Message ID 20230803-arm64-fix-ptrace-zt0-flush-v1-1-72e854eaf96e@kernel.org (mailing list archive)
State New, archived
Headers show
Series arm64/ptrace: Flush FP state when setting ZT0 | expand

Commit Message

Mark Brown Aug. 3, 2023, 12:19 a.m. UTC
When setting ZT0 via ptrace we do not currently force a reload of the
floating point register state from memory, do that to ensure that the newly
set value gets loaded into the registers on next task execution.

The function was templated off the function for FPSIMD which due to our
providing the option of embedding a FPSIMD regset within the SVE regset
does not directly include the flush.

Fixes: f90b529bcbe5 ("arm64/sme: Implement ZT0 ptrace support")
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
---
 arch/arm64/kernel/ptrace.c | 2 ++
 1 file changed, 2 insertions(+)


---
base-commit: 5d0c230f1de8c7515b6567d9afba1f196fb4e2f4
change-id: 20230802-arm64-fix-ptrace-zt0-flush-d6d71b9f8461

Best regards,

Comments

Catalin Marinas Aug. 3, 2023, 5:28 p.m. UTC | #1
On Thu, 03 Aug 2023 01:19:06 +0100, Mark Brown wrote:
> When setting ZT0 via ptrace we do not currently force a reload of the
> floating point register state from memory, do that to ensure that the newly
> set value gets loaded into the registers on next task execution.
> 
> The function was templated off the function for FPSIMD which due to our
> providing the option of embedding a FPSIMD regset within the SVE regset
> does not directly include the flush.
> 
> [...]

Applied to arm64 (for-next/fixes), thanks!

[1/1] arm64/ptrace: Flush FP state when setting ZT0
      https://git.kernel.org/arm64/c/89a65c3f170e
diff mbox series

Patch

diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index d7f4f0d1ae12..740e81e9db04 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -1180,6 +1180,8 @@  static int zt_set(struct task_struct *target,
 	if (ret == 0)
 		target->thread.svcr |= SVCR_ZA_MASK;
 
+	fpsimd_flush_task_state(target);
+
 	return ret;
 }