Here's a patch which stops a couple of crashes we encountered in
alloca checking. The failures were brought on by using libunwind with
the included test16 test case, but are not specific to libunwind.
The test causes infinite recursion on ARM. One of several places was
in __mp_getaddrs, which highlighted the fact that this routine
unnecessarily copies the stackinfo; the copy has been moved to where
it is necessary. Libunwind's stackinfo is unfortunately quite large
because we need to save the unwind cursor; it's big enough that the
compiler generates a call to memcpy.
Also discovered during debugging, checkalloca can crash if unwinding
failed for one of the mentioned frames. This happened in my case
because libunwind refuses to invoke recursively while in mid-unwind.
The final fix for the bug is the memhead.recur check in checkalloca.
The check can always wait until we return to user code. This is the
bit that makes calls to memcpy inside mpatrol, including
compiler-generated ones like for stackinfo above, not lead to an
infinitely deep stack.
Again, hope this is useful!
(Just curious: do you expect there will be another release of mpatrol
in the foreseeable future?)
--
Daniel Jacobowitz
CodeSourcery