Mark the return address of the call to ast() in the generic trap
handling code so the stack trace unwinders don't start trying to go into user-space. Found by trying to create core dumps with a KTR_COMPILE/KTR_GEOM kernel, which results in a stack_save() call in the ast() coredump path - this created a panic, and then calling 'trace' in ddb resulted in the black screen of death after printing out most of the backtrace.
This commit is contained in:
parent
866196b69d
commit
78cb82148f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=153685
@ -438,6 +438,8 @@ CNAME(trapexit):
|
||||
isync
|
||||
addi %r3,%r1,8
|
||||
bl CNAME(ast)
|
||||
.globl CNAME(asttrapexit) /* backtrace code sentinel #2 */
|
||||
CNAME(asttrapexit):
|
||||
b trapexit /* test ast ret value ? */
|
||||
1:
|
||||
FRAME_LEAVE(PC_TEMPSAVE)
|
||||
|
@ -97,6 +97,7 @@ struct db_variable db_regs[] = {
|
||||
struct db_variable *db_eregs = db_regs + sizeof (db_regs)/sizeof (db_regs[0]);
|
||||
|
||||
extern int trapexit[];
|
||||
extern int asttrapexit[];
|
||||
extern int end[];
|
||||
|
||||
/*
|
||||
@ -186,11 +187,13 @@ db_backtrace(struct thread *td, db_addr_t fp, int count)
|
||||
db_printf("0x%08x: ", stackframe);
|
||||
|
||||
/*
|
||||
* The trap code labels the return address from the
|
||||
* call to C code as 'trapexit'. Use this to determine
|
||||
* if the callframe has to traverse a saved trap context
|
||||
* The trap code labels the return addresses from the
|
||||
* call to C code as 'trapexit' and 'asttrapexit. Use this
|
||||
* to determine if the callframe has to traverse a saved
|
||||
* trap context
|
||||
*/
|
||||
if (lr + 4 == (db_addr_t) &trapexit) {
|
||||
if ((lr + 4 == (db_addr_t) &trapexit) ||
|
||||
(lr + 4 == (db_addr_t) &asttrapexit)) {
|
||||
const char *trapstr;
|
||||
struct trapframe *tf = (struct trapframe *)
|
||||
(stackframe+8);
|
||||
@ -312,7 +315,8 @@ stack_save(struct stack *st)
|
||||
* things are going wrong. Plus, prevents this shortened
|
||||
* version of code from accessing user-space frames
|
||||
*/
|
||||
if (callpc + 4 == (db_addr_t) &trapexit)
|
||||
if (callpc + 4 == (db_addr_t) &trapexit ||
|
||||
callpc + 4 == (db_addr_t) &asttrapexit)
|
||||
break;
|
||||
|
||||
if (stack_put(st, callpc) == -1)
|
||||
|
@ -438,6 +438,8 @@ CNAME(trapexit):
|
||||
isync
|
||||
addi %r3,%r1,8
|
||||
bl CNAME(ast)
|
||||
.globl CNAME(asttrapexit) /* backtrace code sentinel #2 */
|
||||
CNAME(asttrapexit):
|
||||
b trapexit /* test ast ret value ? */
|
||||
1:
|
||||
FRAME_LEAVE(PC_TEMPSAVE)
|
||||
|
Loading…
Reference in New Issue
Block a user