Ensure 'name' is not NULL before passing to strcmp().

This avoids a nested page fault when obtaining a stack trace in DDB if
the address from the first frame does not resolve to a known symbol.

MFC after:	1 week
Sponsored by:	Chelsio Communications
This commit is contained in:
jhb 2018-01-30 23:29:27 +00:00
parent 3df465f54f
commit b5c926aafe

View File

@ -336,7 +336,8 @@ db_backtrace(struct thread *td, struct trapframe *tf, struct amd64_frame *frame,
/* Probably an assembler symbol. */
actframe = (void *)(tf->tf_rsp - 8);
}
} else if (strcmp(name, "fork_trampoline") == 0) {
} else if (name != NULL &&
strcmp(name, "fork_trampoline") == 0) {
/*
* Don't try to walk back on a stack for a
* process that hasn't actually been run yet.