linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kselftest/arm64: Don't open code SVE_PT_SIZE() in fp-ptrace
@ 2025-08-12 14:49 Mark Brown
  2025-08-30 10:39 ` Catalin Marinas
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2025-08-12 14:49 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Shuah Khan
  Cc: linux-arm-kernel, linux-kselftest, linux-kernel, Mark Brown

In fp-trace when allocating a buffer to write SVE register data we open
code the addition of the header size to the VL depeendent register data
size, which lead to an underallocation bug when we cut'n'pasted the code
for FPSIMD format writes. Use the SVE_PT_SIZE() macro that the kernel
UAPI provides for this.

Fixes: b84d2b27954f ("kselftest/arm64: Test FPSIMD format data writes via NT_ARM_SVE in fp-ptrace")
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 tools/testing/selftests/arm64/fp/fp-ptrace.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/arm64/fp/fp-ptrace.c b/tools/testing/selftests/arm64/fp/fp-ptrace.c
index 124bc883365e..cdd7a45c045d 100644
--- a/tools/testing/selftests/arm64/fp/fp-ptrace.c
+++ b/tools/testing/selftests/arm64/fp/fp-ptrace.c
@@ -1187,7 +1187,7 @@ static void sve_write_sve(pid_t child, struct test_config *config)
 	if (!vl)
 		return;
 
-	iov.iov_len = SVE_PT_SVE_OFFSET + SVE_PT_SVE_SIZE(vq, SVE_PT_REGS_SVE);
+	iov.iov_len = SVE_PT_SIZE(vq, SVE_PT_REGS_SVE);
 	iov.iov_base = malloc(iov.iov_len);
 	if (!iov.iov_base) {
 		ksft_print_msg("Failed allocating %lu byte SVE write buffer\n",
@@ -1234,8 +1234,7 @@ static void sve_write_fpsimd(pid_t child, struct test_config *config)
 	if (!vl)
 		return;
 
-	iov.iov_len = SVE_PT_SVE_OFFSET + SVE_PT_SVE_SIZE(vq,
-							  SVE_PT_REGS_FPSIMD);
+	iov.iov_len = SVE_PT_SIZE(vq, SVE_PT_REGS_FPSIMD);
 	iov.iov_base = malloc(iov.iov_len);
 	if (!iov.iov_base) {
 		ksft_print_msg("Failed allocating %lu byte SVE write buffer\n",

---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250808-arm64-fp-trace-macro-02ede083da51

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


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

* Re: [PATCH] kselftest/arm64: Don't open code SVE_PT_SIZE() in fp-ptrace
  2025-08-12 14:49 [PATCH] kselftest/arm64: Don't open code SVE_PT_SIZE() in fp-ptrace Mark Brown
@ 2025-08-30 10:39 ` Catalin Marinas
  0 siblings, 0 replies; 2+ messages in thread
From: Catalin Marinas @ 2025-08-30 10:39 UTC (permalink / raw)
  To: Will Deacon, Shuah Khan, Mark Brown
  Cc: linux-arm-kernel, linux-kselftest, linux-kernel

On Tue, 12 Aug 2025 15:49:27 +0100, Mark Brown wrote:
> In fp-trace when allocating a buffer to write SVE register data we open
> code the addition of the header size to the VL depeendent register data
> size, which lead to an underallocation bug when we cut'n'pasted the code
> for FPSIMD format writes. Use the SVE_PT_SIZE() macro that the kernel
> UAPI provides for this.
> 
> 
> [...]

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

[1/1] kselftest/arm64: Don't open code SVE_PT_SIZE() in fp-ptrace
      https://git.kernel.org/arm64/c/d82aa5d3501b

-- 
Catalin


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

end of thread, other threads:[~2025-08-30 10:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-12 14:49 [PATCH] kselftest/arm64: Don't open code SVE_PT_SIZE() in fp-ptrace Mark Brown
2025-08-30 10:39 ` 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).