Blame SOURCES/github_7e393689_ppc64_bt_user_space.patch

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