The branch stable/15 has been updated by cognet:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=60dd46db19f473af7aa505c0d8dcf9bb69847019

commit 60dd46db19f473af7aa505c0d8dcf9bb69847019
Author:     Olivier Houchard <[email protected]>
AuthorDate: 2026-07-23 23:47:21 +0000
Commit:     Olivier Houchard <[email protected]>
CommitDate: 2026-08-04 10:27:09 +0000

    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 <[email protected]>
---
 sys/arm64/arm64/trap.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

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);

Reply via email to