diff options
| author | Olivier Houchard <cognet@FreeBSD.org> | 2026-07-23 23:47:21 +0000 |
|---|---|---|
| committer | Olivier Houchard <cognet@FreeBSD.org> | 2026-08-04 10:27:09 +0000 |
| commit | 60dd46db19f473af7aa505c0d8dcf9bb69847019 (patch) | |
| tree | aebf9343af9a6727e84ccdc30ed665323806c3c2 | |
| parent | 410403d2e9ea5152206d18271e54c717b8b1fcb1 (diff) | |
arm64: Use the fault handler when one is provided
In align_abort() and tag_check_abort(), if we got a fault while in kernel,
do not panic if a fault handler has been provided. We may get such a fault
when trying to read or write userland data, it can at least happen with
_umtx_op() if an unaligned pointer is provided. Instead, just let the
fault handler deal with it.
MFC After: 1 week
Approved by: andrew
Differential Revision: https://reviews.freebsd.org/D58426
(cherry picked from commit c6f5d8fb269fd67a8206420b4e7d67a93bc80733)
Signed-off-by: Olivier Houchard <cognet@FreeBSD.org>
| -rw-r--r-- | sys/arm64/arm64/trap.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 867e5c57f8e5..ffd2d360f4a1 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -214,6 +214,17 @@ align_abort(struct thread *td, struct trapframe *frame, uint64_t esr, uint64_t far, int lower) { if (!lower) { + /* + * Accessing unaligned memory may fault when using atomics. + * Make sure we don't panic if we're doing an unaligned + * access to userland memory, as can happen with _umtx_op() + */ + if (td->td_intr_nesting_level == 0 && + td->td_pcb->pcb_onfault != 0) { + frame->tf_elr = td->td_pcb->pcb_onfault; + return; + } + print_registers(frame); print_gp_register("far", far); printf(" esr: 0x%.16lx\n", esr); |
