arm64: Clear td_frame when returning to userspace

When returning from an exception to userspace clear the saved td_frame.
On the next exception this should point to the frame, however this is
not guaranteed.

To ensure the trap frame pointer is either valid or NULL clear it
before returning to userspace in the EL0 synchronous exception handler.

Reviewed by:	kib, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D44807
This commit is contained in:
Andrew Turner 2024-06-12 14:08:13 +01:00
parent 19782e5bef
commit 4eec584d79

View file

@ -252,9 +252,11 @@ ENTRY(handle_el0_sync)
KMSAN_ENTER
ldr x0, [x18, #PC_CURTHREAD]
mov x1, sp
mov x22, x0
str x1, [x0, #TD_FRAME]
bl do_el0_sync
do_ast
str xzr, [x22, #TD_FRAME]
KMSAN_LEAVE
restore_registers 0
ERET