Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 16 Jan 2018 12:07:49 -0600 (CST)
From: Christopher Lameter <cl@...ux.com>
To: Matthew Wilcox <willy@...radead.org>
cc: Kees Cook <keescook@...omium.org>, linux-kernel@...r.kernel.org, 
    David Windsor <dave@...lcore.net>, Pekka Enberg <penberg@...nel.org>, 
    David Rientjes <rientjes@...gle.com>, Joonsoo Kim <iamjoonsoo.kim@....com>, 
    Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org, 
    linux-xfs@...r.kernel.org, Linus Torvalds <torvalds@...ux-foundation.org>, 
    Alexander Viro <viro@...iv.linux.org.uk>, 
    Andy Lutomirski <luto@...nel.org>, Christoph Hellwig <hch@...radead.org>, 
    "David S. Miller" <davem@...emloft.net>, Laura Abbott <labbott@...hat.com>, 
    Mark Rutland <mark.rutland@....com>, 
    "Martin K. Petersen" <martin.petersen@...cle.com>, 
    Paolo Bonzini <pbonzini@...hat.com>, 
    Christian Borntraeger <borntraeger@...ibm.com>, 
    Christoffer Dall <christoffer.dall@...aro.org>, 
    Dave Kleikamp <dave.kleikamp@...cle.com>, Jan Kara <jack@...e.cz>, 
    Luis de Bethencourt <luisbg@...nel.org>, 
    Marc Zyngier <marc.zyngier@....com>, Rik van Riel <riel@...hat.com>, 
    Matthew Garrett <mjg59@...gle.com>, linux-fsdevel@...r.kernel.org, 
    linux-arch@...r.kernel.org, netdev@...r.kernel.org, 
    kernel-hardening@...ts.openwall.com
Subject: Re: kmem_cache_attr (was Re: [PATCH 04/36] usercopy: Prepare for
 usercopy whitelisting)

On Tue, 16 Jan 2018, Matthew Wilcox wrote:

> > Sure this data is never changed. It can be const.
>
> It's changed at initialisation.  Look:
>
> kmem_cache_create(const char *name, size_t size, size_t align,
>                   slab_flags_t flags, void (*ctor)(void *))
>         s = create_cache(cache_name, size, size,
>                          calculate_alignment(flags, align, size),
>                          flags, ctor, NULL, NULL);
>
> The 'align' that ends up in s->align, is not the user-specified align.
> It's also dependent on runtime information (cache_line_size()), so it
> can't be calculated at compile time.

Then we would need another align field in struct kmem_cache that takes the
changes value?

> 'flags' also gets mangled:
>         flags &= CACHE_CREATE_MASK;

Well ok then that also belongs into kmem_cache and the original value
stays in kmem_cache_attr.

> unsigned int would be my preference.

Great.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.