cvs commit: src/sys/conf NOTES files options src/sys/kern kern_malloc.c src/sys/vm memguard.c memguard.h

Bosko Milekic bmilekic at
Sun Jul 3 01:06:53 GMT 2005

bmilekic    2005-01-21 18:09:17 UTC

  FreeBSD src repository

  Modified files:
    sys/conf             NOTES files options 
    sys/kern             kern_malloc.c 
  Added files:
    sys/vm               memguard.c memguard.h 
  Bring in MemGuard, a very simple and small replacement allocator
  designed to help detect tamper-after-free scenarios, a problem more
  and more common and likely with multithreaded kernels where race
  conditions are more prevalent.
  Currently MemGuard can only take over malloc()/realloc()/free() for
  particular (a) malloc type(s) and the code brought in with this
  change manually instruments it to take over M_SUBPROC allocations
  as an example.  If you are planning to use it, for now you must:
          1) Put "options DEBUG_MEMGUARD" in your kernel config.
          2) Edit src/sys/kern/kern_malloc.c manually, look for
             "XXX CHANGEME" and replace the M_SUBPROC comparison with
             the appropriate malloc type (this might require additional
             but small/simple code modification if, say, the malloc type
             is declared out of scope).
          3) Build and install your kernel.  Tune vm.memguard_divisor
             boot-time tunable which is used to scale how much of kmem_map
             you want to allott for MemGuard's use.  The default is 10,
             so kmem_size/10.
          1) Bring in a memguard(9) man page.
          2) Better instrumentation (e.g., boot-time) of MemGuard taking
             over malloc types.
          3) Teach UMA about MemGuard to allow MemGuard to override zone
             allocations too.
          4) Improve MemGuard if necessary.
  This work is partly based on some old patches from Ian Dowse.
  Revision  Changes    Path
  1.1296    +7 -0      src/sys/conf/NOTES
  1.985     +1 -0      src/sys/conf/files
  1.490     +3 -0      src/sys/conf/options
  1.138     +53 -0     src/sys/kern/kern_malloc.c
  1.1       +222 -0    src/sys/vm/memguard.c (new)
  1.1       +31 -0     src/sys/vm/memguard.h (new)

More information about the cvs-all mailing list