Blame SOURCES/github_f3a53059.patch

608733
commit f3a5305947077a65aea8091b05cdb542cea0d61a
608733
Author: Dave Anderson <anderson@redhat.com>
608733
Date:   Wed Oct 24 16:25:43 2018 -0400
608733
608733
    Modify the x86_64 "bt" behavior when a legitimate exception RIP value
608733
    cannot be referenced symbolically, such as when the exception occurs
608733
    while running in seccomp BPF filter code.  Without the patch, the
608733
    exception frame register dump is preceded by "[exception RIP: unknown
608733
    or invalid address]", and then followed by "bt: WARNING: possibly
608733
    bogus exception frame".  With the patch applied, the translation of
608733
    the exception RIP will show "[exception RIP: no symbolic reference]",
608733
    and there will be no warning message.
608733
    (anderson@redhat.com)
608733
608733
diff --git a/x86_64.c b/x86_64.c
608733
index 345122c..d145f96 100644
608733
--- a/x86_64.c
608733
+++ b/x86_64.c
608733
@@ -3259,6 +3259,18 @@ x86_64_in_alternate_stack(int cpu, ulong
608733
 	return FALSE;
608733
 }
608733
 
608733
+static char *
608733
+x86_64_exception_RIP_message(struct bt_info *bt, ulong rip)
608733
+{
608733
+	physaddr_t phys;
608733
+	
608733
+	if (IS_VMALLOC_ADDR(rip) && 
608733
+	    machdep->kvtop(bt->tc, rip, &phys, 0))
608733
+		return ("no symbolic reference");
608733
+ 
608733
+	return ("unknown or invalid address");
608733
+}
608733
+
608733
 #define STACK_TRANSITION_ERRMSG_E_I_P \
608733
 "cannot transition from exception stack to IRQ stack to current process stack:\n    exception stack pointer: %lx\n          IRQ stack pointer: %lx\n      process stack pointer: %lx\n         current stack base: %lx\n" 
608733
 #define STACK_TRANSITION_ERRMSG_E_P \
608733
@@ -3370,7 +3382,7 @@ x86_64_low_budget_back_trace_cmd(struct
608733
 				fprintf(ofp, (*gdb_output_radix == 16) ?
608733
 					"+0x%lx" : "+%ld", offset);
608733
 		} else
608733
-			fprintf(ofp, "unknown or invalid address");
608733
+			fprintf(ofp, "%s", x86_64_exception_RIP_message(bt, bt->instptr));
608733
 		fprintf(ofp, "]\n");
608733
 		if (KVMDUMP_DUMPFILE())
608733
 			kvmdump_display_regs(bt->tc->processor, ofp);
608733
@@ -4458,9 +4470,9 @@ x86_64_exception_frame(ulong flags, ulon
608733
 						    (*gdb_output_radix == 16) ? 
608733
 						    "+0x%lx" : "+%ld", 
608733
 						    offset);
608733
-				} else 
608733
-					fprintf(ofp, 
608733
-						"unknown or invalid address");
608733
+				} else
608733
+					fprintf(ofp, "%s", 
608733
+						x86_64_exception_RIP_message(bt, rip));
608733
 				fprintf(ofp, "]\n");
608733
 			}
608733
 		} else if (!(cs & 3)) {
608733
@@ -4472,7 +4484,7 @@ x86_64_exception_frame(ulong flags, ulon
608733
 						"+0x%lx" : "+%ld", offset);
608733
 				bt->eframe_ip = rip;
608733
 			} else
608733
-                		fprintf(ofp, "unknown or invalid address");
608733
+				fprintf(ofp, "%s", x86_64_exception_RIP_message(bt, rip));
608733
 			fprintf(ofp, "]\n");
608733
 		}
608733
 		fprintf(ofp, "    RIP: %016lx  RSP: %016lx  RFLAGS: %08lx\n", 
608733
@@ -4616,6 +4628,7 @@ x86_64_eframe_verify(struct bt_info *bt,
608733
 	int estack;
608733
 	struct syment *sp;
608733
 	ulong offset, exception;
608733
+	physaddr_t phys;
608733
 
608733
 	if ((rflags & RAZ_MASK) || !(rflags & 0x2))
608733
 		return FALSE;
608733
@@ -4682,6 +4695,12 @@ x86_64_eframe_verify(struct bt_info *bt,
608733
 			return TRUE;
608733
 	}
608733
 
608733
+	if ((cs == 0x10) && kvaddr) {
608733
+                if (IS_KVADDR(rsp) && IS_VMALLOC_ADDR(rip) && 
608733
+		    machdep->kvtop(bt->tc, rip, &phys, 0))
608733
+			return TRUE;
608733
+	}
608733
+
608733
         if ((cs == 0x33) && (ss == 0x2b)) {
608733
                 if (IS_UVADDR(rip, bt->tc) && IS_UVADDR(rsp, bt->tc))
608733
                         return TRUE;