git: ecc2e6deae71 - main - arm: Fix handling of undefined instructions in kernel mode

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 11 Dec 2023 14:16:36 UTC
The branch main has been updated by markj:

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

commit ecc2e6deae71b69a30bf3b7e3354aba002a37d69
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-12-11 14:08:08 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-12-11 14:08:08 +0000

    arm: Fix handling of undefined instructions in kernel mode
    
    Only panic if no undefined instruction handler matched the exception.
    This can arise in practice if the VFP is enabled lazily.
    
    While here, fix the panic string to not include a newline.
    
    Reviewed by:    andrew
    Obtained from:  Stormshield
    Sponsored by:   Klara, Inc.
    Sponsored by:   Stormshield
    Differential Revision:  https://reviews.freebsd.org/D42970
---
 sys/arm/arm/undefined.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/arm/arm/undefined.c b/sys/arm/arm/undefined.c
index 706033f5d570..dc29b55ae596 100644
--- a/sys/arm/arm/undefined.c
+++ b/sys/arm/arm/undefined.c
@@ -342,11 +342,11 @@ undefinedinstruction(struct trapframe *frame)
 #else
 			printf("No debugger in kernel.\n");
 #endif
-			return;
-		}
-		else
-			panic("Undefined instruction in kernel (0x%08x).\n",
+		} else if (uh == NULL) {
+			panic("Undefined instruction in kernel (0x%08x)",
 			    fault_instruction);
+		}
+		return;
 	}
 
 	userret(td, frame);