aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorShiyong Li <shi-yong.li@motorola.com>2010-04-12 01:48:21 -0400
committerPekka Enberg <penberg@cs.helsinki.fi>2010-04-14 13:52:45 -0400
commit5c5e3b33b7cb959a401f823707bee006caadd76e (patch)
treeaa3c77659d80d714e833a35bcfc20b72a9b6f368 /mm
parent0d0fb0f9c5fddef4a10242fe3337f00f528a3099 (diff)
slab: Fix missing DEBUG_SLAB last user
Even with SLAB_RED_ZONE and SLAB_STORE_USER enabled, kernel would NOT store redzone and last user data around allocated memory space if "arch cache line > sizeof(unsigned long long)". As a result, last user information is unexpectedly MISSED while dumping slab corruption log. This fix makes sure that redzone and last user tags get stored unless the required alignment breaks redzone's. Signed-off-by: Shiyong Li <shi-yong.li@motorola.com> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Diffstat (limited to 'mm')
-rw-r--r--mm/slab.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/mm/slab.c b/mm/slab.c
index bac0f4fcc216..525c66466469 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2220,8 +2220,8 @@ kmem_cache_create (const char *name, size_t size, size_t align,
2220 if (ralign < align) { 2220 if (ralign < align) {
2221 ralign = align; 2221 ralign = align;
2222 } 2222 }
2223 /* disable debug if necessary */ 2223 /* disable debug if not aligning with REDZONE_ALIGN */
2224 if (ralign > __alignof__(unsigned long long)) 2224 if (ralign & (__alignof__(unsigned long long) - 1))
2225 flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER); 2225 flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
2226 /* 2226 /*
2227 * 4) Store it. 2227 * 4) Store it.
@@ -2247,8 +2247,8 @@ kmem_cache_create (const char *name, size_t size, size_t align,
2247 */ 2247 */
2248 if (flags & SLAB_RED_ZONE) { 2248 if (flags & SLAB_RED_ZONE) {
2249 /* add space for red zone words */ 2249 /* add space for red zone words */
2250 cachep->obj_offset += sizeof(unsigned long long); 2250 cachep->obj_offset += align;
2251 size += 2 * sizeof(unsigned long long); 2251 size += align + sizeof(unsigned long long);
2252 } 2252 }
2253 if (flags & SLAB_STORE_USER) { 2253 if (flags & SLAB_STORE_USER) {
2254 /* user store requires one word storage behind the end of 2254 /* user store requires one word storage behind the end of