git: 00678f5e5c08 - main - dtrace/arm: Really trap translation faults

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 03 Sep 2026 15:05:35 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=00678f5e5c08ec7949e2f57d78faeaf266a0f17a

commit 00678f5e5c08ec7949e2f57d78faeaf266a0f17a
Author:     Benjamin Jacobs <freebsd@dev.thsi.be>
AuthorDate: 2026-09-03 13:52:24 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-09-03 15:05:03 +0000

    dtrace/arm: Really trap translation faults
    
    Fix the constant case label to properly handle translation faults
    caused by DTrace probes. Alignment errors are not expected to be
    generated, so stop handling them.
    
    While at it, correct an amd64-specific comment and add a comment
    regarding the missing faulting address which could be addressed by a
    later improvement.
    
    PR:             298064
    MFC after:      1 month
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D59281
---
 sys/cddl/dev/dtrace/arm/dtrace_subr.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sys/cddl/dev/dtrace/arm/dtrace_subr.c b/sys/cddl/dev/dtrace/arm/dtrace_subr.c
index 10e9281709b6..2cf308fb9f77 100644
--- a/sys/cddl/dev/dtrace/arm/dtrace_subr.c
+++ b/sys/cddl/dev/dtrace/arm/dtrace_subr.c
@@ -166,7 +166,7 @@ dtrace_gethrestime(void)
 	return (current_time.tv_sec * 1000000000UL + current_time.tv_nsec);
 }
 
-/* Function to handle DTrace traps during probes. See amd64/amd64/trap.c */
+/* Function to handle DTrace traps during probes. See arm/arm/trap-v6.c */
 int
 dtrace_trap(struct trapframe *frame, u_int type)
 {
@@ -187,8 +187,12 @@ dtrace_trap(struct trapframe *frame, u_int type)
 		 */
 		switch (type) {
 		/* Page fault. */
-		case FAULT_ALIGN:
+		case FAULT_PERM_L1:
+		case FAULT_PERM_L2:
+		case FAULT_TRAN_L1:
+		case FAULT_TRAN_L2:
 			/* Flag a bad address. */
+			/* XXX FAR is missing from the trapframe */
 			cpu_core[curcpu].cpuc_dtrace_flags |= CPU_DTRACE_BADADDR;
 			cpu_core[curcpu].cpuc_dtrace_illval = 0;