summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2011-10-12 18:46:48 +0000
committerglebius <glebius@FreeBSD.org>2011-10-12 18:46:48 +0000
commite999aa7f371bd497d251ccb9d4b2a2e47b228751 (patch)
tree3e22670a02893217e77bf245eff428b292504269 /share
parent2522c42334ee2fd458372bfa8058df46b004a397 (diff)
downloadFreeBSD-src-e999aa7f371bd497d251ccb9d4b2a2e47b228751.zip
FreeBSD-src-e999aa7f371bd497d251ccb9d4b2a2e47b228751.tar.gz
Document that memguard(9) now can guard uma(9) allocations.
Diffstat (limited to 'share')
-rw-r--r--share/man/man9/memguard.966
1 files changed, 52 insertions, 14 deletions
diff --git a/share/man/man9/memguard.9 b/share/man/man9/memguard.9
index ed833ba..5c17148 100644
--- a/share/man/man9/memguard.9
+++ b/share/man/man9/memguard.9
@@ -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 scenarios.
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 by
.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.
OpenPOWER on IntegriCloud