104a3dc0eb
Glanced at by: simon
103 lines
3.0 KiB
Groff
103 lines
3.0 KiB
Groff
.\" Copyright (c) 2005 Christian Brueffer
|
|
.\" All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
.\" SUCH DAMAGE.
|
|
.\"
|
|
.\" $FreeBSD$
|
|
.\"
|
|
.Dd December 30, 2005
|
|
.Dt MEMGUARD 9
|
|
.Os
|
|
.Sh NAME
|
|
.Nm MemGuard
|
|
.Nd "memory allocator for debugging purposes"
|
|
.Sh SYNOPSIS
|
|
.Cd "options DEBUG_MEMGUARD"
|
|
.Sh DESCRIPTION
|
|
.Nm
|
|
is a simple and small replacement memory allocator designed
|
|
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 only take over
|
|
.Fn malloc ,
|
|
.Fn realloc
|
|
and
|
|
.Fn free
|
|
for a particular malloc type.
|
|
.Sh EXAMPLES
|
|
To use memguard for memory type compiled into the kernel, one has to add the
|
|
following line to the
|
|
.Pa /boot/loader.conf :
|
|
.Bd -literal -offset indent
|
|
vm.memguard.desc=<memory_type>
|
|
.Ed
|
|
.Pp
|
|
Where memory_type is a short description of memory type to monitor.
|
|
.Pp
|
|
To use memguard for memory type defined in a kernel module, one has to set
|
|
.Va vm.memguard.desc
|
|
.Xr sysctl 8
|
|
variable before loading the module:
|
|
.Bd -literal -offset indent
|
|
sysctl vm.memguard.desc=<memory_type>
|
|
.Ed
|
|
.Pp
|
|
The
|
|
.Va vm.memguard.divisor
|
|
boot-time tunable is used to scale how much of
|
|
.Va kmem_map
|
|
one wants to allocate for
|
|
.Nm .
|
|
The default is 10, so
|
|
.Va kmem_size Ns /10
|
|
bytes will be used.
|
|
The
|
|
.Va kmem_size
|
|
value can be obtained via the
|
|
.Va vm.kmem_size
|
|
.Xr sysctl 8
|
|
variable.
|
|
.Sh SEE ALSO
|
|
.Xr sysctl 8 ,
|
|
.Xr vmstat 8 ,
|
|
.Xr contigmalloc 9 ,
|
|
.Xr malloc 9
|
|
.Sh HISTORY
|
|
.Nm
|
|
first appeared in
|
|
.Fx 6.0 .
|
|
.Sh AUTHORS
|
|
.An -nosplit
|
|
.Nm
|
|
was written by
|
|
.An Bosko Milekic Aq bmilekic@FreeBSD.org .
|
|
This manual page was written by
|
|
.An Christian Brueffer Aq brueffer@FreeBSD.org .
|
|
.Sh BUGS
|
|
Currently, it is not possible to override UMA
|
|
.Xr zone 9
|
|
allocations.
|