Hi,

On free, chunks (the pieces of a pages used for smaller allocations)
are junked and then validated after they leave the delayed free list.
So after free, a chunk always contains junk bytes. This means that if
we start with the right contents for a new page of chunks, we can
*validate* instead of *write* junk bytes when (re)-using a chunk.

Wiht this, we can detect write-after-free when a chunk is recycled,
not justy when a chunk is in the delayed free list.  We do a little
bit more work on initial allocation of a page of chunks and when
re-using (as I validate now even on junk level 1), so some performance
validation is needed. In my tests I did not see negative effects, even
some slight improvemt (likely because validating junk bytes is cheaper
than writing). But this needs tests to see if that is true in more
cases than my tests.

Also: some extra consistency checks for recallocaray(3) and fixes in
error messages to make them more consistent, with man page bits. Plus
regress additions.

Please test and review!

Thanks,

        -Otto

Reply via email to