XXX This is just a quick hack / demo. It would be nice to have
debugging for mismatched malloc types between alloc/free. A simple way
is to stash the mtp pointer alongside the malloc memory. This hacks
redzone to do that, because it already stashes stuff alongside the
malloc memory, has the pointer adjustments for doing so, stores a stack,
etc. I am hoping for review of the general idea, and of doing it with
redzone or not. Any better way?
Mismatched mtp in malloc/free causes malloc accounting bugs. Enhance
redzone so that it stashes a context cookie (the mtp pointer) on alloc
and checks it on free.
This is a bit of a misuse of redzone(9), but the machinery is already
available.