lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 22 Jul 2006 13:06:01 +0200
From:	Heiko Carstens <heiko.carstens@...ibm.com>
To:	Andrew Morton <akpm@...l.org>
Cc:	Christoph Lameter <clameter@....com>, linux-kernel@...r.kernel.org
Subject: [patch] slab: always follow arch requested alignments

From: Heiko Carstens <heiko.carstens@...ibm.com>

In kmem_cache_create(): always check if BYTES_PER_WORD is less than
ARCH_SLAB_MINALIGN and disable debug options that would set the
alignment to BYTES_PER_WORD.
This will make sure that all slab caches will have at least an
ARCH_SLAB_MINALIGN alignment.

In addition make sure that a caller mandated align which is greater
than BYTES_PER_WORD also disables the same debug options.
This makes sure that ARCH_KMALLOC_MINALIGN also has an effect if
CONFIG_DEBUG_SLAB is set.

Cc: Christoph Lameter <clameter@....com>
Signed-off-by: Heiko Carstens <heiko.carstens@...ibm.com>
---

 mm/slab.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/mm/slab.c b/mm/slab.c
index 0f20843..1f6fc04 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2103,12 +2103,18 @@ #endif
 		if (ralign > BYTES_PER_WORD)
 			flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
 	}
+	if (BYTES_PER_WORD < ARCH_SLAB_MINALIGN)
+		flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
+
 	/* 3) caller mandated alignment: disables debug if necessary */
 	if (ralign < align) {
 		ralign = align;
 		if (ralign > BYTES_PER_WORD)
 			flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
 	}
+	if (align > BYTES_PER_WORD)
+		flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
+
 	/*
 	 * 4) Store it. Note that the debug code below can reduce
 	 *    the alignment to BYTES_PER_WORD.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ