Date: Wed, 12 Oct 2011 18:46:48 +0000 (UTC) From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r226314 - head/share/man/man9 Message-ID: <201110121846.p9CIkmmN079078@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201110121846.p9CIkmmN079078>