arm64 db_trace: Ensure trapframe pointer is suitably aligned.

Reviewed by:	jrtc27, markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D41486
This commit is contained in:
John Baldwin 2023-08-17 11:31:20 -07:00
parent 18974bd616
commit 638c68897f

View file

@ -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;