git: 6204391e99ca - main - arm64: Check TDP_NOFAULTING in a data abort

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Thu, 24 Oct 2024 10:36:37 UTC
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=6204391e99ca4da6a3cbce6b36b02f47da40802c

commit 6204391e99ca4da6a3cbce6b36b02f47da40802c
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-10-24 09:49:02 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-10-24 10:20:48 +0000

    arm64: Check TDP_NOFAULTING in a data abort
    
    As with other architectures when the TDP_NOFAULTING flag is set we
    shouldn't panic when td_critnest is non-zero or if the witness check
    fails.
    
    The EFI runtime service functions will soon set this flag to handle
    exceptions in the services.
    
    Reviewed by:    markj
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D46815
---
 sys/arm64/arm64/trap.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c
index fa1132305067..d6e316e7ae0a 100644
--- a/sys/arm64/arm64/trap.c
+++ b/sys/arm64/arm64/trap.c
@@ -338,8 +338,9 @@ data_abort(struct thread *td, struct trapframe *frame, uint64_t esr,
 		    td->td_md.md_spinlock_count);
 	}
 #endif
-	if (td->td_critnest != 0 || WITNESS_CHECK(WARN_SLEEPOK |
-	    WARN_GIANTOK, NULL, "Kernel page fault") != 0) {
+	if ((td->td_pflags & TDP_NOFAULTING) == 0 &&
+	    (td->td_critnest != 0 || WITNESS_CHECK(WARN_SLEEPOK |
+	    WARN_GIANTOK, NULL, "Kernel page fault") != 0)) {
 		print_registers(frame);
 		print_gp_register("far", far);
 		printf(" esr: 0x%.16lx\n", esr);