From: Christoph Lameter <clameter@sgi.com>
To: akpm@osdl.org
Cc: linux-mm@kvack.org, Christoph Lameter <clameter@sgi.com>
Subject: [SLUB 2/5] Add after object padding
Date: Thu, 12 Apr 2007 18:36:40 -0700 (PDT) [thread overview]
Message-ID: <20070413013640.17093.37934.sendpatchset@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20070413013633.17093.93334.sendpatchset@schroedinger.engr.sgi.com>
Without padding there is the danger that we do not notice writing
before the allocated object. So increase the slab size by another
word in the debug case. That will force the creation of some fill
space which SLUB will continue to check.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.21-rc6/mm/slub.c
===================================================================
--- linux-2.6.21-rc6.orig/mm/slub.c 2007-04-12 16:44:13.000000000 -0700
+++ linux-2.6.21-rc6/mm/slub.c 2007-04-12 16:45:18.000000000 -0700
@@ -484,7 +484,7 @@ static int check_object(struct kmem_cach
if (s->flags & SLAB_POISON) {
if (!active && (s->flags & __OBJECT_POISON) &&
(!check_bytes(p, POISON_FREE, s->objsize - 1) ||
- p[s->objsize -1] != POISON_END)) {
+ p[s->objsize - 1] != POISON_END)) {
object_err(s, page, p, "Poison check failed");
return 0;
}
@@ -1623,6 +1623,15 @@ static int calculate_sizes(struct kmem_c
*/
size += 2 * sizeof(struct track);
+ if (flags & DEBUG_DEFAULT_FLAGS)
+ /*
+ * Add some empty padding so that we can catch
+ * overwrites from earlier objects rather than let
+ * tracking information or the free pointer be
+ * corrupted if an user writes before the start
+ * of the object.
+ */
+ size += sizeof(void *);
/*
* Determine the alignment based on various parameters that the
* user specified (this is unecessarily complex due to the attempt
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2007-04-13 1:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-13 1:36 [SLUB 1/5] Fix validation Christoph Lameter
2007-04-13 1:36 ` Christoph Lameter [this message]
2007-04-13 1:36 ` [SLUB 3/5] Remove object activities out of checking functions Christoph Lameter
2007-04-13 1:36 ` [SLUB 4/5] Resiliency fixups Christoph Lameter
2007-04-13 1:58 ` Christoph Lameter
2007-04-13 1:36 ` [SLUB 5/5] Resiliency test Christoph Lameter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070413013640.17093.37934.sendpatchset@schroedinger.engr.sgi.com \
--to=clameter@sgi.com \
--cc=akpm@osdl.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox