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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 27 Jul 2006 19:25:56 -0700 (PDT)
From:	Christoph Lameter <clameter@....com>
To:	Pekka J Enberg <penberg@...helsinki.fi>
cc:	akpm@...l.org, heiko.carstens@...ibm.com, manfred@...orfullife.com,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] slab: respect architecture and caller mandated alignment

On Thu, 27 Jul 2006, Pekka J Enberg wrote:

> As explained by Heiko, on s390 (32-bit) ARCH_KMALLOC_MINALIGN is set to eight
> because their common I/O layer allocates data structures that need to have an
> eight byte alignment. This does not work when CONFIG_SLAB_DEBUG is enabled
> because kmem_cache_create will override alignment to BYTES_PER_WORD which is
> four.
> 
> So change kmem_cache_create to ensure cache alignment is always at minimum
> what the architecture or caller mandates even if slab debugging is enabled.

Note that this will disable SLAB_RED_ZONE and SLAB_STORE_USER 
for the following SLAB_DEBUG cases:

1. For all slabs if an arch sets ARCH_SLAB_MINALIGN > BYTES_PER_WORD

by:

      /* 2) arch mandated alignment: disables debug if necessary */
        if (ralign < ARCH_SLAB_MINALIGN) {
                ralign = ARCH_SLAB_MINALIGN;
                if (ralign > BYTES_PER_WORD)
                        flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
        }

ralign = BYTES_PER_WORD per your change for slab debug.
ARCH_SLAB_MINALIGN > BYTES_PER_WORD -> SLAB_RED_ZONE and SLAB_STORE_USER 
off.

2. For all general (kmalloc) slabs if an arch sets
   ARCH_KMALLOC_MINALIGN > BYTES_PER_WORD

by:

     /* 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);
        }

ralign = BYTES_PER_WORD by your change.
align = ARCH_KMALLOC_MINALIGN (passed by kmem_cache_init)
Therefore SLAB_RED_ZONE and SLAB_STORE_USER are always off.

F.e. S/390 will not be able to use slab debug for the general slabs.

You may want to document that change somewhere.


Note that it is not possible to do Redzoning and aligning at the same 
time. Redzoning adds a word before and after the object. If you would 
align it then you would align the whole thing which would result in an 
alignment visible to the slab user of alignment + sizeof(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