kernel - Add options SLAB_DEBUG to help debug memory corruption
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 15 Feb 2011 19:37:38 +0000 (11:37 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 15 Feb 2011 19:37:38 +0000 (11:37 -0800)
commitbbb201fd4d8144ecdb2817594a8eb79f1cd74062
treed252c0649acdf80829732921e8bfa9b2000d7b07
parent1365d5cde00414fde57ba7c5e54ddf11dd99b1c4
kernel - Add options SLAB_DEBUG to help debug memory corruption

* Adding options SLAB_DEBUG to your kernel config will reconfigure
  kmalloc(), krealloc(), and kstrdup() to record all allocation
  sources on a zone-by-zone basis, file and line number.

  A full kernel recompile is needed when you add or drop this option
  from your kernel config.

* Limited to 32 slots per slab.  Since slabs offer a narrow range of
  chunk sizes this will normally be sufficient.

* When a memory corruption related panic occurs kgdb can be used
  to determine who allocated out of the slab in question.
sys/conf/options
sys/kern/kern_slaballoc.c
sys/sys/malloc.h
sys/sys/slaballoc.h