The branch stable/13 has been updated by jhb:

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

commit 402c6c331d73491e5cc711336a7ec23fcc87d03c
Author:     John Baldwin <[email protected]>
AuthorDate: 2023-08-22 04:00:26 +0000
Commit:     John Baldwin <[email protected]>
CommitDate: 2024-04-08 17:29:34 +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
    
    (cherry picked from commit 7ccaf76a27f138bde3f2b162a9c8ebb6216c05bc)
---
 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;

Reply via email to