git: 638c68897fbd - main - arm64 db_trace: Ensure trapframe pointer is suitably aligned.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 17 Aug 2023 18:32:44 UTC
The branch main has been updated by jhb:

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

commit 638c68897fbd7623cc0b6fc8e8c31cb124202a55
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-08-17 18:31:20 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-08-17 18:32:32 +0000

    arm64 db_trace: Ensure trapframe pointer is suitably aligned.
    
    Reviewed by:    jrtc27, markj
    Sponsored by:   DARPA
    Differential Revision:  https://reviews.freebsd.org/D41486
---
 sys/arm64/arm64/db_trace.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/arm64/arm64/db_trace.c b/sys/arm64/arm64/db_trace.c
index 8e8fedc1c5f9..cb1c0789b03f 100644
--- a/sys/arm64/arm64/db_trace.c
+++ b/sys/arm64/arm64/db_trace.c
@@ -93,7 +93,8 @@ db_stack_trace_cmd(struct thread *td, struct unwind_state *frame)
 			struct trapframe *tf;
 
 			tf = (struct trapframe *)(uintptr_t)frame->fp - 1;
-			if (!kstack_contains(td, (vm_offset_t)tf,
+			if (!__is_aligned(tf, _Alignof(*tf)) ||
+			    !kstack_contains(td, (vm_offset_t)tf,
 			    sizeof(*tf))) {
 				db_printf("--- invalid trapframe %p\n", tf);
 				break;