Blame SOURCES/github_7e393689_ppc64_bt_user_space.patch

7ef056
commit 7e3936895386ea6e85a6dc01bc5027f8133d12bb
7ef056
Author: Dave Anderson <anderson@redhat.com>
7ef056
Date:   Mon Sep 17 14:33:08 2018 -0400
7ef056
7ef056
    An addendum to crash commit 5fe78861ea1589084f6a2956a6ff63677c9269e1,
7ef056
    this patch for the PPC64 "bt" command prevents an invalid error
7ef056
    message from being displayed when an active non-panic task is
7ef056
    interrupted while running in user space.  Without the patch, the
7ef056
    command correctly indicates "Task is running in user space", dumps
7ef056
    the user-space exception frame, but then prints the invalid error
7ef056
    message "bt: invalid kernel virtual address: ffffffffffffff90 type:
7ef056
    Regs NIP value".
7ef056
    (anderson@redhat.com)
7ef056
7ef056
diff --git a/ppc64.c b/ppc64.c
7ef056
index 03fecd3..8badcde 100644
7ef056
--- a/ppc64.c
7ef056
+++ b/ppc64.c
7ef056
@@ -2254,6 +2254,7 @@ ppc64_vmcore_stack_frame(struct bt_info *bt_in, ulong *nip, ulong *ksp)
7ef056
 {
7ef056
 	struct ppc64_pt_regs *pt_regs;
7ef056
 	unsigned long unip;
7ef056
+	int in_user_space = FALSE;
7ef056
 
7ef056
 	pt_regs = (struct ppc64_pt_regs *)bt_in->machdep;
7ef056
 	if (!pt_regs || !pt_regs->gpr[1]) {
7ef056
@@ -2272,10 +2273,11 @@ ppc64_vmcore_stack_frame(struct bt_info *bt_in, ulong *nip, ulong *ksp)
7ef056
 			FAULT_ON_ERROR);
7ef056
 		*nip = unip;
7ef056
 	} else {
7ef056
-		if (IN_TASK_VMA(bt_in->task, *ksp))
7ef056
+		if (IN_TASK_VMA(bt_in->task, *ksp)) {
7ef056
 			fprintf(fp, "%0lx: Task is running in user space\n",
7ef056
 				bt_in->task);
7ef056
-		else
7ef056
+			in_user_space = TRUE;
7ef056
+		} else
7ef056
 			fprintf(fp, "%0lx: Invalid Stack Pointer %0lx\n",
7ef056
 				bt_in->task, *ksp);
7ef056
 		*nip = pt_regs->nip;
7ef056
@@ -2289,6 +2291,8 @@ ppc64_vmcore_stack_frame(struct bt_info *bt_in, ulong *nip, ulong *ksp)
7ef056
 	 * Print the collected regs for the active task
7ef056
 	 */
7ef056
 	ppc64_print_regs(pt_regs);
7ef056
+	if (in_user_space)
7ef056
+		return TRUE;
7ef056
 	if (!IS_KVADDR(*ksp))
7ef056
 		return FALSE;
7ef056