x86/traps: avoid using current too early on boot
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 25 Jun 2015 12:57:04 +0000 (14:57 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 25 Jun 2015 12:57:04 +0000 (14:57 +0200)
Early on boot, current has the sentinel value 0xfffff000.  Blindly using it in
show_registers() causes a nested failure and no useful information printed
from an early crash.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/x86_64/traps.c

index 117a133b7f13c65eb9c57780505f5d1985a1f99e..61bd05347e29ba257dbc60c4f4dc0bb87f2742ed 100644 (file)
@@ -86,7 +86,7 @@ void show_registers(const struct cpu_user_regs *regs)
     struct cpu_user_regs fault_regs = *regs;
     unsigned long fault_crs[8];
     enum context context;
-    struct vcpu *v = current;
+    struct vcpu *v = system_state >= SYS_STATE_smp_boot ? current : NULL;
 
     if ( guest_mode(regs) && has_hvm_container_vcpu(v) )
     {