Print this page
11927 Log, or optionally panic, on zero-length kmem allocations
Reviewed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Jason King <jason.brian.king@gmail.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man9f/kmem_alloc.9f.man.txt
          +++ new/usr/src/man/man9f/kmem_alloc.9f.man.txt
↓ open down ↓ 92 lines elided ↑ open up ↑
  93   93         freeing a null or invalid pointer, will corrupt the kernel heap and may
  94   94         cause the system to corrupt data or panic.
  95   95  
  96   96  
  97   97         The initial contents of memory allocated using kmem_alloc() are random
  98   98         garbage. This random garbage may include secure kernel data. Therefore,
  99   99         uninitialized kernel memory should be handled carefully. For example,
 100  100         never copyout(9F) a potentially uninitialized buffer.
 101  101  
 102  102  NOTES
 103      -       kmem_alloc(0, flag) always returns NULL.  kmem_free(NULL, 0) is legal.
      103 +       kmem_alloc(0, flag) always returns NULL, but if KM_SLEEP is set, this
      104 +       behavior is considered to be deprecated; the system may be configured
      105 +       to explicitly panic in this case in lieu of returning NULL.
      106 +       kmem_free(NULL, 0) is legal, however.
 104  107  
 105  108  
 106  109  
 107      -                               October 22, 2014                 KMEM_ALLOC(9F)
      110 +                               November 20, 2019                KMEM_ALLOC(9F)
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX