mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-04 15:40:44 +00:00
Stop using expressions in _Alignof()
_Alignof(expression) is a non-standard extension. This is not allowed in gnu11 and gnu17 which follow the C11 standard _Alignof(type). Reviewed by: arichardson, imp, jhb Fixes:4a9cd9fc22
amd64 db_trace: Reject unaligned frame pointers Fixes:7ccaf76a27
riscv db_trace: Ensure trapframe pointer is suitably aligned. Fixes:638c68897f
arm64 db_trace: Ensure trapframe pointer is suitably aligned. Differential Revision: https://reviews.freebsd.org/D43409
This commit is contained in:
parent
246e0457d9
commit
03d04bf494
|
@ -205,7 +205,8 @@ db_nextframe(db_addr_t *fp, db_addr_t *ip, struct thread *td)
|
|||
*/
|
||||
tf_addr = *fp + 16;
|
||||
|
||||
if (!__is_aligned(tf_addr, _Alignof(*tf)) || !INKERNEL(tf_addr)) {
|
||||
if (!__is_aligned(tf_addr, _Alignof(struct trapframe)) ||
|
||||
!INKERNEL(tf_addr)) {
|
||||
db_printf("--- invalid trapframe %p\n", (void *)tf_addr);
|
||||
*ip = 0;
|
||||
*fp = 0;
|
||||
|
|
|
@ -92,7 +92,7 @@ db_stack_trace_cmd(struct thread *td, struct unwind_state *frame)
|
|||
struct trapframe *tf;
|
||||
|
||||
tf = (struct trapframe *)(uintptr_t)frame->fp - 1;
|
||||
if (!__is_aligned(tf, _Alignof(*tf)) ||
|
||||
if (!__is_aligned(tf, _Alignof(struct trapframe)) ||
|
||||
!kstack_contains(td, (vm_offset_t)tf,
|
||||
sizeof(*tf))) {
|
||||
db_printf("--- invalid trapframe %p\n", tf);
|
||||
|
|
|
@ -83,7 +83,7 @@ db_stack_trace_cmd(struct thread *td, struct unwind_state *frame)
|
|||
struct trapframe *tf;
|
||||
|
||||
tf = (struct trapframe *)(uintptr_t)frame->sp;
|
||||
if (!__is_aligned(tf, _Alignof(*tf)) ||
|
||||
if (!__is_aligned(tf, _Alignof(struct trapframe)) ||
|
||||
!kstack_contains(td, (vm_offset_t)tf,
|
||||
sizeof(*tf))) {
|
||||
db_printf("--- invalid trapframe %p\n", tf);
|
||||
|
|
Loading…
Reference in a new issue