[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1801160913260.3908@nuc-kabylake>
Date: Tue, 16 Jan 2018 09:21:30 -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: kmem_cache_attr (was Re: [PATCH 04/36] usercopy: Prepare for usercopy
whitelisting)
On Sun, 14 Jan 2018, Matthew Wilcox wrote:
> > Hmmm... At some point we should switch kmem_cache_create to pass a struct
> > containing all the parameters. Otherwise the API will blow up with
> > additional functions.
>
> Obviously I agree with you. I'm inclined to not let that delay Kees'
> patches; we can fix the few places that use this API later. At this
> point, my proposal for the ultimate form would be:
Right. Thats why I said "at some point"....
>
> struct kmem_cache_attr {
> const char name[32];
Want to avoid the string reference mess that occurred in the past?
Is that really necessary? But it would limit the size of the name.
> void (*ctor)(void *);
> unsigned int useroffset;
> unsigned int user_size;
> };
>
> kmem_create_cache_attr(const struct kmem_cache_attr *attr, unsigned int size,
> unsigned int align, slab_flags_t flags)
>
> (my rationale is that everything in attr should be const, but size, align
> and flags all get modified by the slab code).
Thought about putting all the parameters into the kmem_cache_attr struct.
So
struct kmem_cache_attr {
char *name;
size_t size;
size_t align;
slab_flags_t flags;
unsigned int useroffset;
unsinged int usersize;
void (*ctor)(void *);
kmem_isolate_func *isolate;
kmem_migrate_func *migrate;
...
}
Powered by blists - more mailing lists