git: 8b9f8a7e763d - stable/14 - arm64: Clear td_frame when returning to userspace
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 02 Sep 2024 08:50:43 UTC
The branch stable/14 has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=8b9f8a7e763dfc533ce2abd5b48d1ba9f54165e2
commit 8b9f8a7e763dfc533ce2abd5b48d1ba9f54165e2
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-06-12 13:08:13 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-09-02 08:48:17 +0000
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
(cherry picked from commit 4eec584d79c1e8375d863c7eec7229ac7ec3f13b)
---
sys/arm64/arm64/exception.S | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sys/arm64/arm64/exception.S b/sys/arm64/arm64/exception.S
index b1990fc71281..0df440863632 100644
--- a/sys/arm64/arm64/exception.S
+++ b/sys/arm64/arm64/exception.S
@@ -214,9 +214,11 @@ ENTRY(handle_el0_sync)
save_registers 0
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]
restore_registers 0
ERET
END(handle_el0_sync)