git: bc394ad824f5 - stable/14 - arm: Fix handling of undefined instructions in kernel mode

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 18 Dec 2023 02:11:43 UTC
The branch stable/14 has been updated by markj:

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

commit bc394ad824f5f09b9ab659c445ed83ef36e7c313
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-12-11 14:08:08 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-12-18 02:07:47 +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
    
    (cherry picked from commit ecc2e6deae71b69a30bf3b7e3354aba002a37d69)
---
 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 2ebe8797c503..7f93cc231fe7 100644
--- a/sys/arm/arm/undefined.c
+++ b/sys/arm/arm/undefined.c
@@ -343,11 +343,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);