[4/4] ntdll: partially support HEAP_DISABLE_COALESCE_ON_FREE, allows us to detect use-after-free

Dan Kegel dank at kegel.com
Tue Nov 24 20:20:34 CST 2009


This adds something like support for
HEAP_DISABLE_COALESCE_ON_FREE.
If the GlobalFlags registry entry has the
200000 bit set, freed blocks are set
aside for a while rather than immediately
being released for reuse.  This allows
us to poison them and check for use-after-free
or double-free errors, and report them as heap corruption.

If you're running Valgrind, you get an immediate error
and stack trace for any of these heap corruption events,
which was the motivation for the patch series.
But the patches are useful even without valgrind.

The number of blocks kept out of circulation is
5000 by default, but can be set via an environment
variable.  It ought to have a limit on number of bytes,
too, but this seemed enough for the moment.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-ntdll-partial-support-HEAP_DISABLE_COALESCE_ON_FREE.patch
Type: text/x-patch
Size: 15959 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20091124/70aa7da7/attachment-0001.bin>


More information about the wine-patches mailing list