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
This commit is contained in:
parent
526f2e221d
commit
6350b203b9
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user