Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
MEMGUARD(9)		 BSD Kernel Developer's	Manual		   MEMGUARD(9)

NAME
     MemGuard -- memory	allocator for debugging	purposes

SYNOPSIS
     options DEBUG_MEMGUARD

DESCRIPTION
     MemGuard 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.

     Currently,	MemGuard can only take over malloc(), realloc()	and free() for
     a particular malloc type.	MemGuard takes over M_SUBPROC allocations by
     default.

FILES
     src/sys/kern/kern_malloc.c	 File to replace the malloc type in

EXAMPLES
     The following steps are necessary to use MemGuard:

     1.	  Put the DEBUG_MEMGUARD option	into your kernel config.

     2.	  Open src/sys/kern/kern_malloc.c in your favourite editor.  Look for
	  lines	containing "XXX	CHANGEME!" and replace M_SUBPROC with the ap-
	  propriate malloc type.  This might require additional	but small/sim-
	  ple code modifications (e.g.,	if the malloc type is declared out of
	  scope).

     3.	  Build	and install your kernel.  Tune the vm.memguard_divisor boot-
	  time tunable,	which is used to scale how much	of kmem_map you	want
	  to allot for MemGuard.  The default is 10, so	kmem_size/10 bytes
	  will be used.	 The kmem_size value can be obtained via the
	  vm.kmem_size sysctl(8) variable.

SEE ALSO
     sysctl(8),	vmstat(8), contigmalloc(9), malloc(9)

HISTORY
     MemGuard first appeared in	FreeBSD	6.0.

AUTHORS
     MemGuard was written by Bosko Milekic <bmilekic@FreeBSD.org>.  This man-
     ual page was written by Christian Brueffer	<brueffer@FreeBSD.org>.

BUGS
     Currently,	it is not possible to override UMA zone(9) allocations.

BSD			       February	22, 2005			   BSD

NAME | SYNOPSIS | DESCRIPTION | FILES | EXAMPLES | SEE ALSO | HISTORY | AUTHORS | BUGS

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=memguard&sektion=9&manpath=FreeBSD+6.0-RELEASE>

home | help