From owner-svn-src-all@FreeBSD.ORG  Wed Oct 12 18:46:48 2011
Return-Path: <owner-svn-src-all@FreeBSD.ORG>
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8B9BA106564A;
	Wed, 12 Oct 2011 18:46:48 +0000 (UTC)
	(envelope-from glebius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 715458FC18;
	Wed, 12 Oct 2011 18:46:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9CIkmHk079080;
	Wed, 12 Oct 2011 18:46:48 GMT (envelope-from glebius@svn.freebsd.org)
Received: (from glebius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9CIkmmN079078;
	Wed, 12 Oct 2011 18:46:48 GMT (envelope-from glebius@svn.freebsd.org)
Message-Id: <201110121846.p9CIkmmN079078@svn.freebsd.org>
From: Gleb Smirnoff <glebius@FreeBSD.org>
Date: Wed, 12 Oct 2011 18:46:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r226314 - head/share/man/man9
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for &quot;
	user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-all>,
	<mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all>
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-all>,
	<mailto:svn-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 12 Oct 2011 18:46:48 -0000

Author: glebius
Date: Wed Oct 12 18:46:48 2011
New Revision: 226314
URL: http://svn.freebsd.org/changeset/base/226314

Log:
  Document that memguard(9) now can guard uma(9) allocations.

Modified:
  head/share/man/man9/memguard.9

Modified: head/share/man/man9/memguard.9
==============================================================================
--- head/share/man/man9/memguard.9	Wed Oct 12 18:08:28 2011	(r226313)
+++ head/share/man/man9/memguard.9	Wed Oct 12 18:46:48 2011	(r226314)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 2, 2010
+.Dd October 12, 2011
 .Dt MEMGUARD 9
 .Os
 .Sh NAME
@@ -39,7 +39,6 @@ to help detect tamper-after-free scenari
 These problems are more and more common and likely with
 multithreaded kernels where race conditions are more prevalent.
 .Pp
-Currently,
 .Nm
 can take over
 .Fn malloc ,
@@ -47,8 +46,19 @@ can take over
 and
 .Fn free
 for a single malloc type.
+Alternatively
 .Nm
-can also guard all allocations larger than
+can take over
+.Fn uma_zalloc ,
+.Fn uma_zalloc_arg
+and
+.Fn uma_free
+for a single
+.Xr uma
+zone.
+Also
+.Nm
+can guard all allocations larger than
 .Dv PAGE_SIZE ,
 and can guard a random fraction of all allocations.
 There is also a knob to prevent allocations smaller than a specified
@@ -72,7 +82,10 @@ sysctl vm.memguard.desc=<memory_type>
 .Pp
 Where
 .Ar memory_type
-is a short description of the memory type to monitor.
+can be either a short description of the memory type to monitor,
+either name of
+.Xr uma 9
+zone.
 Only allocations from that
 .Ar memory_type
 made after
@@ -86,13 +99,28 @@ will potentially be guarded once the
 .Xr sysctl 8
 is set.
 Existing guarded allocations will still be properly released by
-.Xr free 9 .
+either
+.Xr free 9
+or
+.Xr uma_zfree 9 ,
+depending on what kind of allocation was taken over.
 .Pp
-The short description of a
+To determine short description of a
 .Xr malloc 9
-type is the second argument to
-.Xr MALLOC_DEFINE 9 ,
-so one has to find it in the kernel source.
+type one can either take it from the first column of
+.Xr vmstat 8 Fl m
+output, or to find it in the kernel source.
+It is the second argument to
+.Xr MALLOC_DEFINE 9
+macro.
+To determine name of
+.Xr uma 9
+zone one can either take it from the first column of
+.Xr vmstat 8 Fl z
+output, or to find it in the kernel source.
+It is the first argument to the
+.Xr uma_zcreate 9
+function.
 .Pp
 The
 .Va vm.memguard.divisor
@@ -142,12 +170,24 @@ or larger if
 .Va vm.memguard.options
 has the 2 bit set.
 This option is off by default.
+By default
+.Nm
+doesn't guard those
+.Xr uma 9
+zones that have been initialized with the
+.Dv UMA_ZONE_NOFREE
+flag set, since it can produce false positives on them.
+However, this safety measure can be turned off by setting bit 3
+of the
+.Va vm.memguard.options
+tunable.
 .Sh SEE ALSO
 .Xr sysctl 8 ,
 .Xr vmstat 8 ,
 .Xr contigmalloc 9 ,
 .Xr malloc 9 ,
-.Xr redzone 9
+.Xr redzone 9 ,
+.Xr uma 9
 .Sh HISTORY
 .Nm
 first appeared in
@@ -161,8 +201,6 @@ This manual page was originally written 
 .An Christian Brueffer Aq brueffer@FreeBSD.org .
 Additions have been made by
 .An Matthew Fleming Aq mdf@FreeBSD.org
+and
+.An Gleb Smirnoff Aq glebius@FreeBSD.org
 to both the implementation and the documentation.
-.Sh BUGS
-Currently, it is not possible to override UMA
-.Xr zone 9
-allocations.