[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: prevent call to xfree() in dump_irqs() while in an irq context


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Wed, 23 May 2012 10:33:07 +0000
  • Delivery-date: Wed, 23 May 2012 10:33:16 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
# Date 1337696925 -7200
# Node ID d718706de1f0667c4a4ee137b9ba18e5c7d9817c
# Parent  ab86fc0e2b452d30a223bb789c23c5321c45713f
x86: prevent call to xfree() in dump_irqs() while in an irq context

Because of c/s 24707:96987c324a4f, dump_irqs() can now be called in an
irq context when a bug condition is encountered. If this is the case,
ignore the call to xsm_show_irq_ssid() and the subsequent call to
xfree().

This prevents an assertion failure in xfree(), and should allow all the
debug information to be dumped, before failing with a BUG() because of
the underlying race condition we are attempting to reproduce.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Rather than using the non-obvious conditional around an xfree() that
would be passed NULL only in the inverse case (which could easily get
removed by a future change on the basis that calling xfree(NULL) is
benign), switch the order of checks in xfree() itself and only suppress
the call to XSM that could potentially call xmalloc().

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Keir Fraser <keir@xxxxxxx>
Committed-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r ab86fc0e2b45 -r d718706de1f0 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c        Tue May 22 11:55:02 2012 +0100
+++ b/xen/arch/x86/irq.c        Tue May 22 16:28:45 2012 +0200
@@ -2060,7 +2060,7 @@ static void dump_irqs(unsigned char key)
         if ( !irq_desc_initialized(desc) || desc->handler == &no_irq_type )
             continue;
 
-        ssid = xsm_show_irq_sid(irq);
+        ssid = in_irq() ? NULL : xsm_show_irq_sid(irq);
 
         spin_lock_irqsave(&desc->lock, flags);
 
diff -r ab86fc0e2b45 -r d718706de1f0 xen/common/xmalloc_tlsf.c
--- a/xen/common/xmalloc_tlsf.c Tue May 22 11:55:02 2012 +0100
+++ b/xen/common/xmalloc_tlsf.c Tue May 22 16:28:45 2012 +0200
@@ -604,11 +604,11 @@ void xfree(void *p)
 {
     struct bhdr *b;
 
-    ASSERT(!in_irq());
-
     if ( p == NULL )
         return;
 
+    ASSERT(!in_irq());
+
     /* Strip alignment padding. */
     b = (struct bhdr *)((char *) p - BHDR_OVERHEAD);
     if ( b->size & 1 )

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.