mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2025-11-25 18:39:21 +00:00
kselftest/arm64: Validate signal ucontext in place
In handle_input_signal_copyctx() we use ASSERT_GOOD_CONTEXT() to validate that the context we are saving meets expectations however we do this on the saved copy rather than on the actual signal context passed in. This breaks validation of EXTRA_CONTEXT since we attempt to validate the ABI requirement that the additional space supplied is immediately after the termination record in the standard context which will not be the case after it has been copied to another location. Fix this by doing the validation before we copy. Note that nothing actually looks inside the EXTRA_CONTEXT at present. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220829160703.874492-3-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
This commit is contained in:
parent
647d093380
commit
e40422c94e
@ -165,12 +165,15 @@ static bool handle_signal_ok(struct tdescr *td,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool handle_signal_copyctx(struct tdescr *td,
|
static bool handle_signal_copyctx(struct tdescr *td,
|
||||||
siginfo_t *si, void *uc)
|
siginfo_t *si, void *uc_in)
|
||||||
{
|
{
|
||||||
|
ucontext_t *uc = uc_in;
|
||||||
|
|
||||||
|
ASSERT_GOOD_CONTEXT(uc);
|
||||||
|
|
||||||
/* Mangling PC to avoid loops on original BRK instr */
|
/* Mangling PC to avoid loops on original BRK instr */
|
||||||
((ucontext_t *)uc)->uc_mcontext.pc += 4;
|
uc->uc_mcontext.pc += 4;
|
||||||
memcpy(td->live_uc, uc, td->live_sz);
|
memcpy(td->live_uc, uc, td->live_sz);
|
||||||
ASSERT_GOOD_CONTEXT(td->live_uc);
|
|
||||||
td->live_uc_valid = 1;
|
td->live_uc_valid = 1;
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"GOOD CONTEXT grabbed from sig_copyctx handler\n");
|
"GOOD CONTEXT grabbed from sig_copyctx handler\n");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user