kselftest/arm64: Fix validation of EXTRA_CONTEXT signal context location
authorMark Brown <broonie@kernel.org>
Mon, 29 Aug 2022 16:06:57 +0000 (17:06 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 7 Sep 2022 13:25:46 +0000 (14:25 +0100)
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>
Link: https://lore.kernel.org/r/20220829160703.874492-5-broonie@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
tools/testing/selftests/arm64/signal/testcases/testcases.c

index d98828cb542be22ae5ced4a6c64250a2e80dd945..16dc916939f9f5e21b12a17577cb6258283d7d22 100644 (file)
@@ -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;