diff options
author | grehan <grehan@FreeBSD.org> | 2005-10-30 07:56:10 +0000 |
---|---|---|
committer | grehan <grehan@FreeBSD.org> | 2005-10-30 07:56:10 +0000 |
commit | 6350b203b922f24ad697698b3d7453d349b74aaf (patch) | |
tree | e1aa11ffcac164b722bd79a76ad538b45bde30ae /sys/powerpc | |
parent | 526f2e221d6ccb8b55363cf225814dd2f9a7dec3 (diff) | |
download | FreeBSD-src-6350b203b922f24ad697698b3d7453d349b74aaf.zip FreeBSD-src-6350b203b922f24ad697698b3d7453d349b74aaf.tar.gz |
In stack_save, stop when a trap-frame is encountered. This prevents
trying to access user-space stack addresses when a user fault
is encountered, as occurs when GEOM KTR code is handling a page fault
and is using stack_save() to capture a trace for debug purposes.
It may be possible to walk beyond the trap-frame if it is a kernel fault,
as db_backtrace() does, but I don't think that complexity is needed in
this routine.
MFC after: 3 days
Diffstat (limited to 'sys/powerpc')
-rw-r--r-- | sys/powerpc/powerpc/db_trace.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/powerpc/powerpc/db_trace.c b/sys/powerpc/powerpc/db_trace.c index a30595c..131beef 100644 --- a/sys/powerpc/powerpc/db_trace.c +++ b/sys/powerpc/powerpc/db_trace.c @@ -305,6 +305,16 @@ stack_save(struct stack *st) callpc = *(vm_offset_t *)(stackframe + 4) - 4; if ((callpc & 3) || (callpc < 0x100)) break; + + /* + * Don't bother traversing trap-frames - there should + * be enough info down to the frame to work out where + * things are going wrong. Plus, prevents this shortened + * version of code from accessing user-space frames + */ + if (callpc + 4 == (db_addr_t) &trapexit) + break; + if (stack_put(st, callpc) == -1) break; } |