diff options
author | Mark Brown <broonie@kernel.org> | 2023-02-02 20:30:44 +0300 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2023-02-07 21:33:46 +0300 |
commit | 6012b8202022d9eec0c09cbb3212e49ccd273438 (patch) | |
tree | cafbd60d4a8132a91fa481b4ffb545e5e1c84ba2 /tools/testing/selftests/arm64 | |
parent | a7db82f18cd3d85ea8ef70fca5946b441187ed6d (diff) | |
download | linux-6012b8202022d9eec0c09cbb3212e49ccd273438.tar.xz |
kselftest/arm64: Copy whole EXTRA context
When copying the EXTRA context our calculation of the amount of data we
need to copy is incorrect, we only calculate the amount of data needed
within uc_mcontext.__reserved, not taking account of the fixed portion
of the context. Add in the offset of the reserved data so that we copy
everything we should.
This will only cause test failures in cases where the last context in the
EXTRA context is smaller than the missing data since we don't currently
validate any of the register data and all the buffers we copy into are
statically allocated so default to zero meaning that if we walk beyond the
end of what we copied we'll encounter what looks like a context with magic
and length both 0 which is a valid terminator record.
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230201-arm64-kselftest-full-extra-v1-1-93741f32dd29@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'tools/testing/selftests/arm64')
-rw-r--r-- | tools/testing/selftests/arm64/signal/test_signals_utils.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/testing/selftests/arm64/signal/test_signals_utils.c b/tools/testing/selftests/arm64/signal/test_signals_utils.c index 308e229e58ab..746a4f70f082 100644 --- a/tools/testing/selftests/arm64/signal/test_signals_utils.c +++ b/tools/testing/selftests/arm64/signal/test_signals_utils.c @@ -192,8 +192,10 @@ static bool handle_signal_copyctx(struct tdescr *td, * in the copy, this was previously validated in * ASSERT_GOOD_CONTEXT(). */ - to_copy = offset + sizeof(struct extra_context) + 16 + - extra->size; + to_copy = __builtin_offsetof(ucontext_t, + uc_mcontext.__reserved); + to_copy += offset + sizeof(struct extra_context) + 16; + to_copy += extra->size; copied_extra = (struct extra_context *)&(td->live_uc->uc_mcontext.__reserved[offset]); } else { copied_extra = NULL; |