Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Aug 2010 17:43:47 +0000 (UTC)
From:      Matthew D Fleming <mdf@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r212063 - head/sys/vm
Message-ID:  <201008311743.o7VHhl1a037280@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008311743.o7VHhl1a037280>