Skip to content

Commit 8a846ff

Browse files
author
Dave Anderson
committed
Fix for infrequent failures of the x86 "bt" command to handle cases
where a user space task with "resume_userspace" or "entry_INT80_32" at the top of the stack, or which was interrupted by the crash NMI while handling a timer interrupt. Without the patch, the backtrace would be proceeded with the error message "bt: cannot resolve stack trace", and then dump the text symbols found on the stack and all possible exception frames. ([email protected])
1 parent 483f98d commit 8a846ff

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

lkcd_x86_trace.c

+15-4
Original file line numberDiff line numberDiff line change
@@ -1953,13 +1953,24 @@ find_trace(
19531953
static int
19541954
kernel_entry_from_user_space(sframe_t *curframe, struct bt_info *bt)
19551955
{
1956+
ulong stack_segment;
1957+
19561958
if (is_kernel_thread(bt->tc->task))
19571959
return FALSE;
19581960

1959-
if (((curframe->fp + 4 + SIZE(pt_regs)) == GET_STACKTOP(bt->task)) &&
1960-
!is_kernel_thread(bt->tc->task))
1961-
return TRUE;
1962-
else if (userspace_return(curframe->fp+4, bt))
1961+
stack_segment = GET_STACK_ULONG(curframe->fp + 4 + SIZE(pt_regs) - sizeof(kaddr_t));
1962+
1963+
if ((curframe->fp + 4 + SIZE(pt_regs)) == GET_STACKTOP(bt->task)) {
1964+
if ((stack_segment == 0x7b) || (stack_segment == 0x2b))
1965+
return TRUE;
1966+
}
1967+
1968+
if ((curframe->fp + 4 + SIZE(pt_regs) + 8) == GET_STACKTOP(bt->task)) {
1969+
if ((stack_segment == 0x7b) || (stack_segment == 0x2b))
1970+
return TRUE;
1971+
}
1972+
1973+
if (userspace_return(curframe->fp+4, bt))
19631974
return TRUE;
19641975
else
19651976
return FALSE;

0 commit comments

Comments
 (0)