lkml.org 
[lkml]   [2011]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: flex_array related problems on selinux policy loading
On Wed, Jan 26, 2011 at 08:10:16AM -0800, Dave Hansen wrote:
> >
> > Btw. why the struct flex_array needs to have page size?
>
> It was designed as an alternative to _large_ allocations and we didn't
> expect people to want to use it for small things. But, it doesn't
> _need_ to stay that way, we just did it like that for simplicity.
>

Ok, I thought that. In case of selinux, the informations on how big
the array will be comes from the userspace. In the most cases, people
use big selinux policies like the selinux reference policy, these
arrays are quite big. But if somebody uses just a dummy policy, the
arrays are small or empty in some cases.

> > If we would make
> > flex_array of dynamic size, say metadata plus the maximum size of the array
> > in the case that the metadata and the array fit into a single page, and
> > metadata plus space for all the base pointers we need to dereference the
> > parts, if the metadata and array is beyond page size. With this, the struct
> > flex_array would have a reasonable size in any case, even if the array to
> > store is small or of zero size.
>
> Sounds like a good idea to me. Done right, it should only really affect
> the allocation path since we use kmalloc() already, and we can still
> plain kfree() it.
>

So lets do it like that. I'll propose another patch, may take some days.

Steffen


\
 
 \ /
  Last update: 2011-01-27 13:17    [W:0.132 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site