Frank Hofmann wrote:

> On Mon, 16 Jun 2008, Juergen Keil wrote:
> 

> > IIRC a bug like ``kmem_free(NULL, size)'' somewhere in the kernel can have 
the
> > effect that a subsequent ``kmem_alloc(size, KM_SLEEP)'' somewhere else in 
the
> > kernel will return with a NULL pointer!  (Assuming you run release bits)
> 
> If this is so, then it's a bug and should be fixed. Quote kmem_alloc(9F):
> 
> NOTES
>       kmem_alloc(0, flag) always returns NULL. kmem_free(NULL,  0)
>       is legal.
> 
> That's manpage - consider it a spec ...

Well, it says kmem_free with a ptr == NULL and size == 0 is legal;
but what about ptr == NULL and size > 0?


Quick test with ::call in kmdb, when booted with kmem_flags=0xf:

- kmem_alloc::call 8 0
  kmem_free::call <value_returned_from_the_above_kmem_alloc> 8
  
  works, as expected

- kmem_free::call 0 8

  kmdb fails this call, with "caught a trap"

_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to