[haiku-development] Re: SLAB documentation
- From: Lucian Adrian Grijincu <lucian.grijincu@xxxxxxxxx>
- To: haiku-development@xxxxxxxxxxxxx
- Date: Sun, 11 Jul 2010 02:38:11 +0300
On Sun, Jul 11, 2010 at 2:25 AM, Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:
> Anyway, we should really improve the slab debugging features.
I think two approaches would detect the bugs I've described in that file.
A) adding some "canary values" around the links that form the
slab->free stack would be a starting point. In a build with some slab
debugging activated, before _push/_pop in the slab->free list you
should first check the canary values near that object. If the canary
has a value different than expected, assume and notify about an
invalid memory access.
B) because objects have the same sizes, the ->next link pointers that
form the slab->free stack can only have a certain set of values. If at
a point someone tries to insert an invalid link, detect it early and
report the culprit.
These approaches are independent (both can be activated, and both add
their own value).
I think the second approach is easier to implement, I can try and come
up with something if you're interested.
--
.
..: Lucian
Other related posts: