The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] fix kmem_cache_size() for new slab poisoning
@ 2003-03-11 21:59 Christoph Hellwig
  0 siblings, 0 replies; only message in thread
From: Christoph Hellwig @ 2003-03-11 21:59 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel, linux-xfs

The new slab poisoning code broke kmem_cache_size(), it now returns
a too large size as the poisoning area after the object is includes.
XFS's kmem_zone_zalloc thus overwrites exactly that area and triggers
the new checks everytime such an object is freed again.

I don't recommend using XFS on BK-current without this patch applied :)


--- 1.68/mm/slab.c	Sat Mar  8 23:50:36 2003
+++ edited/mm/slab.c	Tue Mar 11 15:15:44 2003
@@ -2041,11 +2041,16 @@
 
 unsigned int kmem_cache_size(kmem_cache_t *cachep)
 {
+	unsigned int objlen = cachep->objsize;
+
 #if DEBUG
 	if (cachep->flags & SLAB_RED_ZONE)
-		return (cachep->objsize - 2*BYTES_PER_WORD);
+		objlen -= 2*BYTES_PER_WORD;
+	if (cachep->flags & SLAB_STORE_USER)
+		objlen -= BYTES_PER_WORD;
 #endif
-	return cachep->objsize;
+
+	return objlen;
 }
 
 kmem_cache_t * kmem_find_general_cachep (size_t size, int gfpflags)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-03-11 14:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-11 21:59 [PATCH] fix kmem_cache_size() for new slab poisoning Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox