diff options
author | marius <marius@FreeBSD.org> | 2008-08-22 19:05:47 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2008-08-22 19:05:47 +0000 |
commit | fc32a2339da17b85246f10b1da07e50caba4631a (patch) | |
tree | d3b13748193a8d48312d8480869760ea8c078476 /sys/sparc64 | |
parent | e1345537c46ab90a07b63e79b8141eb3c9a43bb1 (diff) | |
download | FreeBSD-src-fc32a2339da17b85246f10b1da07e50caba4631a.zip FreeBSD-src-fc32a2339da17b85246f10b1da07e50caba4631a.tar.gz |
Avoid misaligned access of struct frame.
MFC after: 3 days
Diffstat (limited to 'sys/sparc64')
-rw-r--r-- | sys/sparc64/sparc64/stack_machdep.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/sparc64/sparc64/stack_machdep.c b/sys/sparc64/sparc64/stack_machdep.c index bfaf248..68c2a51 100644 --- a/sys/sparc64/sparc64/stack_machdep.c +++ b/sys/sparc64/sparc64/stack_machdep.c @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> +#include <sys/endian.h> #include <sys/proc.h> #include <sys/stack.h> #include <sys/systm.h> @@ -45,13 +46,13 @@ __FBSDID("$FreeBSD$"); static void stack_capture(struct stack *st, uint64_t addr) { - struct frame *fp; vm_offset_t callpc; stack_zero(st); - fp = (struct frame *)(addr + SPOFF); while (1) { - callpc = fp->fr_pc; + addr += SPOFF; + callpc = + be64dec((void *)(addr + offsetof(struct frame, fr_pc))); if (!INKERNEL(callpc)) break; /* Don't bother traversing trap frames. */ @@ -62,7 +63,8 @@ stack_capture(struct stack *st, uint64_t addr) break; if (stack_put(st, callpc) == -1) break; - fp = (struct frame *)(fp->fr_fp + SPOFF); + addr = + be64dec((void *)(addr + offsetof(struct frame, fr_fp))); } } |