Re: [regression] nf_iterate(), BUG: unable to handle kernel NULL pointer dereference

Nick Piggin
2008-07-25T09:09:46Z

On Friday 25 July 2008 05:21, Matt Mackall wrote:
> On Thu, 2008-07-24 at 16:32 +0300, Pekka Enberg wrote:
> > On Thu, Jul 24, 2008 at 10:56:08PM +1000, Nick Piggin wrote:
> > > > > OTOH, skb allocation uses kmalloc don't they? So you could still
> > > > > use SLOB ksize for that I guess.
> >
> > On Thursday 24 July 2008 23:04, Herbert Xu wrote:
> > > > Yes I was referring to the data portion which is kmalloc'ed.
> > > > That is also why I'm interested in ksize because a priori we
> > > > don't know exactly how big it's going to be. However, we do
> > > > know that statistically 1500 will dominate.
> > > >
> > > > I'm not interested in ksize for kmem_cache at all. So in fact
> > > > we could have something simpler that's based on kmalloc's rounding
> > > > algorithm instead.
> >
> > ﻿On Thu, 2008-07-24 at 23:13 +1000, Nick Piggin wrote:
> > > Yes you could definitely have a function that returns allocated
> > > bytes for a given kmalloc size. Should be about as fast or faster
> > > than extracting the size from the kaddr...
> >
> > Yup, makes sense.
>
> On the other hand, I can imagine useful allocator changes where this
> would not be a constant of requested size. For instance, imagine we had
> a classless bucket allocator, but with a heuristic to try a larger
> bucket when it wasn't cheap/possible to allocate a right-sized object
> (because of memory pressure, etc.) and larger ones were available.
> This sort of thing is a pretty small change for SLAB/SLUB.

If that comes up, you could make the API take the pointer as well,
then just filter out the new argument in allocators that don't use
it.