SLAB_POISON in patch-2.2.10ac6

Stephen C. Tweedie (sct@redhat.com)
Fri, 2 Jul 1999 13:18:52 +0100


Hi Alan,

Whoops, you missed something in the ac6 build. It isn't enough to
enable SLAB_DEBUG_SUPPORT: for pool poisoning to be enabled you have to
use SLAB_POISON when creating the slab cache. The patch below (against
straight 2.2.10) enables it for all kmalloc slabs.

Anyone seeing fs corruption on 2.2.10 is invited to drop this in to
enable extra debugging. It basically causes all kmalloc()s to be filled
with a predetermined pattern (all 0x5a), and kfree() to be filled with
all 0xa5. If we see those patterns cropping up in the oops messages
then it will be a sure sign of somebody trying to access freeded memory,
and we stand a much better chance of tracking the culprit down.

--Stephen

--- mm/slab.c~ Tue Nov 24 17:21:12 1998
+++ mm/slab.c Fri Jul 2 13:13:56 1999
@@ -125,7 +125,7 @@
* SLAB_SELFTEST - 1 to perform a few tests, mainly for development.
*/
#define SLAB_MGMT_CHECKS 1
-#define SLAB_DEBUG_SUPPORT 0
+#define SLAB_DEBUG_SUPPORT 1
#define SLAB_STATS 0
#define SLAB_SELFTEST 0

@@ -471,7 +471,7 @@
* allow tighter packing of the smaller caches. */
if (!(sizes->cs_cachep =
kmem_cache_create(*names++, sizes->cs_size,
- 0, SLAB_HWCACHE_ALIGN, NULL, NULL)))
+ 0, SLAB_HWCACHE_ALIGN|SLAB_POISON, NULL, NULL)))
goto panic_time;
if (!found) {
/* Inc off-slab bufctl limit until the ceiling is hit. */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/