linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kselftest/arm64: Fix validation of EXTRA_CONTEXT signal contexts
@ 2022-08-01 22:59 Mark Brown
  2022-08-01 23:06 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2022-08-01 22:59 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Shuah Khan
  Cc: linux-arm-kernel, linux-kselftest, Mark Brown

Currently in validate_extra_context() we assert both that the extra data
pointed to by the EXTRA_CONTEXT is 16 byte aligned and that it immediately
follows the struct _aarch64_ctx providing the terminator for the linked
list of contexts in the signal frame. Since struct _aarch64_ctx is an 8
byte structure which must be 16 byte aligned these cannot both be true. As
documented in sigcontext.h and implemented by the kernel the extra data
should be at the next 16 byte aligned address after the terminator so fix
the validation to match.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 tools/testing/selftests/arm64/signal/testcases/testcases.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/arm64/signal/testcases/testcases.c b/tools/testing/selftests/arm64/signal/testcases/testcases.c
index b2cce9afaaf3..0b3c9b4b1d39 100644
--- a/tools/testing/selftests/arm64/signal/testcases/testcases.c
+++ b/tools/testing/selftests/arm64/signal/testcases/testcases.c
@@ -42,7 +42,7 @@ bool validate_extra_context(struct extra_context *extra, char **err)
 		*err = "Extra DATAP misaligned";
 	else if (extra->size & 0x0fUL)
 		*err = "Extra SIZE misaligned";
-	else if (extra->datap != (uint64_t)term + sizeof(*term))
+	else if (extra->datap != (uint64_t)term + 0x10UL)
 		*err = "Extra DATAP misplaced (not contiguous)";
 	if (*err)
 		return false;
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] kselftest/arm64: Fix validation of EXTRA_CONTEXT signal contexts
  2022-08-01 22:59 [PATCH] kselftest/arm64: Fix validation of EXTRA_CONTEXT signal contexts Mark Brown
@ 2022-08-01 23:06 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2022-08-01 23:06 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Shuah Khan
  Cc: linux-arm-kernel, linux-kselftest


[-- Attachment #1.1: Type: text/plain, Size: 920 bytes --]

On Mon, Aug 01, 2022 at 11:59:26PM +0100, Mark Brown wrote:

> Currently in validate_extra_context() we assert both that the extra data
> pointed to by the EXTRA_CONTEXT is 16 byte aligned and that it immediately
> follows the struct _aarch64_ctx providing the terminator for the linked

I just realised that this is a very similar subject to another fix I
sent for this stuff a few hours ago.  Both fixes are needed, the code
really is quite buggy.  I've tweaked the subjects locally in case I need
to resend - this one is:

kselftest/arm64: Fix validation of EXTRA_CONTEXT signal contexts

and the other is:

kselftest/arm64: Fix validatation termination record after EXTRA_CONTEXT

The good news is that with the patches I've now posted we no longer get
any spurious failures, though further patches (which should emerge after
the merge window) will be required to actually validate the data inside
an EXTRA_CONTEXT.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-08-01 23:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-01 22:59 [PATCH] kselftest/arm64: Fix validation of EXTRA_CONTEXT signal contexts Mark Brown
2022-08-01 23:06 ` Mark Brown

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).