Author: mdf
Date: Tue Aug 31 17:43:47 2010
New Revision: 212063
URL: http://svn.freebsd.org/changeset/base/212063

Log:
  Have memguard(9) crash with an easier-to-debug message on double-free.
  
  Reviewed by:    zml
  MFC after:      3 weeks

Modified:
  head/sys/vm/memguard.c

Modified: head/sys/vm/memguard.c
==============================================================================
--- head/sys/vm/memguard.c      Tue Aug 31 17:38:20 2010        (r212062)
+++ head/sys/vm/memguard.c      Tue Aug 31 17:43:47 2010        (r212063)
@@ -247,9 +247,13 @@ SYSINIT(memguard, SI_SUB_KLD, SI_ORDER_A
 static u_long *
 v2sizep(vm_offset_t va)
 {
+       vm_paddr_t pa;
        struct vm_page *p;
 
-       p = PHYS_TO_VM_PAGE(pmap_kextract(va));
+       pa = pmap_kextract(va);
+       if (pa == 0)
+               panic("MemGuard detected double-free of %p", (void *)va);
+       p = PHYS_TO_VM_PAGE(pa);
        KASSERT(p->wire_count != 0 && p->queue == PQ_NONE,
            ("MEMGUARD: Expected wired page %p in vtomgfifo!", p));
        return ((u_long *)&p->pageq.tqe_next);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to