linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64/ptrace: Flush FP state when setting ZT0
@ 2023-08-03  0:19 Mark Brown
  2023-08-03 17:28 ` Catalin Marinas
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2023-08-03  0:19 UTC (permalink / raw)
  To: Oleg Nesterov, Catalin Marinas, Will Deacon
  Cc: linux-arm-kernel, linux-kernel, Mark Brown, stable

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(+)

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;
 }
 

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

Best regards,
-- 
Mark Brown <broonie@kernel.org>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] arm64/ptrace: Flush FP state when setting ZT0
  2023-08-03  0:19 [PATCH] arm64/ptrace: Flush FP state when setting ZT0 Mark Brown
@ 2023-08-03 17:28 ` Catalin Marinas
  0 siblings, 0 replies; 2+ messages in thread
From: Catalin Marinas @ 2023-08-03 17:28 UTC (permalink / raw)
  To: Oleg Nesterov, Will Deacon, Mark Brown
  Cc: linux-arm-kernel, linux-kernel, stable

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

-- 
Catalin


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-03 17:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-03  0:19 [PATCH] arm64/ptrace: Flush FP state when setting ZT0 Mark Brown
2023-08-03 17:28 ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).