Skip to content

Commit 1f3b950

Browse files
jgoulywilldeacon
authored andcommitted
arm64: poe: fix stale POR_EL0 values for ptrace
If a process wrote to POR_EL0 and then crashed before a context switch happened, the coredump would contain an incorrect value for POR_EL0. The value read in poe_get() would be a stale value left in thread.por_el0. Fix this by reading the value from the system register, if the target thread is the current thread. This matches what gcs/fpsimd do. Fixes: 1751981 ("arm64/ptrace: add support for FEAT_POE") Reported-by: David Spickett <david.spickett@arm.com> Cc: stable@vger.kernel.org Signed-off-by: Joey Gouly <joey.gouly@arm.com> Cc: Kevin Brodsky <kevin.brodsky@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com> Acked-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Will Deacon <will@kernel.org>
1 parent a4e5927 commit 1f3b950

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

arch/arm64/kernel/ptrace.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,6 +1486,9 @@ static int poe_get(struct task_struct *target,
14861486
if (!system_supports_poe())
14871487
return -EINVAL;
14881488

1489+
if (target == current)
1490+
current->thread.por_el0 = read_sysreg_s(SYS_POR_EL0);
1491+
14891492
return membuf_write(&to, &target->thread.por_el0,
14901493
sizeof(target->thread.por_el0));
14911494
}

0 commit comments

Comments
 (0)