git: 7ccaf76a27f1 - main - riscv db_trace: Ensure trapframe pointer is suitably aligned.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 22 Aug 2023 04:04:19 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=7ccaf76a27f138bde3f2b162a9c8ebb6216c05bc
commit 7ccaf76a27f138bde3f2b162a9c8ebb6216c05bc
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-08-22 04:00:26 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-08-22 04:00:26 +0000
riscv db_trace: Ensure trapframe pointer is suitably aligned.
Suggested by: jrtc27
Reviewed by: jrtc27
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D41534
---
sys/riscv/riscv/db_trace.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sys/riscv/riscv/db_trace.c b/sys/riscv/riscv/db_trace.c
index 00ec1a750e33..12972839c29d 100644
--- a/sys/riscv/riscv/db_trace.c
+++ b/sys/riscv/riscv/db_trace.c
@@ -84,7 +84,8 @@ db_stack_trace_cmd(struct thread *td, struct unwind_state *frame)
struct trapframe *tf;
tf = (struct trapframe *)(uintptr_t)frame->sp;
- 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;