[haiku-bugs] Re: [Haiku] #6312: slab: protection from wrong freed objects

  • From: "bonefish" <trac@xxxxxxxxxxxx>
  • Date: Tue, 13 Jul 2010 21:38:28 -0000

#6312: slab: protection from wrong freed objects
----------------------------+-----------------------------------------------
  Reporter:  lucian         |         Owner:  axeld         
      Type:  enhancement    |        Status:  new           
  Priority:  normal         |     Milestone:  R1            
 Component:  System/Kernel  |       Version:  R1/Development
Resolution:                 |      Keywords:                
Blocked By:                 |   Has a Patch:  1             
  Platform:  All            |      Blocking:                
----------------------------+-----------------------------------------------

Comment (by bonefish):

 A few remarks:
  - Coding style: No space after the cast operator.
  - The second check is not correct. Slabs can have a "color"
 (slab::offset) by which the objects are misaligned.
  - The first check is not quite correct either. Due to the slab color the
 lower bounds check can be stricter (though the second check would catch
 that). The upper bounds check should also consider the slab color, and the
 greatest valid object address is after `source->size - 1` objects only.
  - Since both checks are not exactly for free, they should be performed
 only for `KDEBUG >= 1`.
  - Generally, unless the situation is unrecoverable, one should try to
 gracefully continue after a `panic()`, i.e. `return` in this case.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/6312#comment:2>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: