Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Feb 2024 16:45:05 GMT
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 890008575a43 - stable/14 - arm64: Raise a SIGBUS on a user external abort
Message-ID:  <202402191645.41JGj5xe095266@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=890008575a436c050a679e1d9e43d05489ee42ac

commit 890008575a436c050a679e1d9e43d05489ee42ac
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2023-09-29 13:55:48 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-02-19 13:10:39 +0000

    arm64: Raise a SIGBUS on a user external abort
    
    When userspace triggers an external abort allow it to handle the abort
    by raising a SIGBUS.
    
    Reviewed by:    markj, kib
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D42018
    
    (cherry picked from commit a69450102ff1fe1466077a021a16bb265274d3a2)
---
 sys/arm64/arm64/trap.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c
index 2dda8cfc4c20..6534fd2283a1 100644
--- a/sys/arm64/arm64/trap.c
+++ b/sys/arm64/arm64/trap.c
@@ -225,19 +225,25 @@ static void
 external_abort(struct thread *td, struct trapframe *frame, uint64_t esr,
     uint64_t far, int lower)
 {
+	if (lower) {
+		call_trapsignal(td, SIGBUS, BUS_OBJERR, (void *)far,
+		    ESR_ELx_EXCEPTION(frame->tf_esr));
+		userret(td, frame);
+		return;
+	}
 
 	/*
 	 * Try to handle synchronous external aborts caused by
 	 * bus_space_peek() and/or bus_space_poke() functions.
 	 */
-	if (!lower && test_bs_fault((void *)frame->tf_elr)) {
+	if (test_bs_fault((void *)frame->tf_elr)) {
 		frame->tf_elr = (uint64_t)generic_bs_fault;
 		return;
 	}
 
 	print_registers(frame);
 	print_gp_register("far", far);
-	panic("Unhandled EL%d external data abort", lower ? 0: 1);
+	panic("Unhandled external data abort");
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402191645.41JGj5xe095266>