[erlang-patches] Fix hibernate with HiPE

Mikael Pettersson mikpe@REDACTED
Sun Oct 10 19:32:20 CEST 2010


Paul Guyot writes:
 > Hello,
 > 
 > The "Fix hibernate with HiPE" patch I previously submitted and that is currently on 'pu' can actually lead to a segfault.
 > The 'pu' commit is here:
 > http://github.com/erlang/otp/commit/b1d738d7548151b37d264757ea7830b79275edad
 > 
 > Please also apply this commit:
 > http://github.com/pguyot/otp/commit/57f4c9ccac45f06ec47846a117908a2dd54962b3
 > 
 > Or just fetch the two commits at once:
 > git fetch git://github.com/pguyot/otp.git fix-hibernate-with-hipe branch
 > 
 > Indeed, the initial commits empties the stack when hibernating by setting the stack pointer to the beginning of the stack (or the end, depending on the native stack direction). But popping arguments when returning from the TRAP condition can actually lead to a segfault because it would access memory beyond the stack zone.
 > 
 > With the new commit:
 > - memory used by the native stack is freed (since this is the point of hibernating), and all stack-related pointers are set to NULL;
 > - when returning from TRAP, if the native stack pointer (nsp) is NULL, no argument is popped (since there is nothing to pop).

Looking at the patch via github's awful web interface it looks like
it will cause the 'is_recursive' variable to be conditionally defined
and possibly used uninitialized (at least as far as GCC will be able
to tell).  Thus, NAK for now.

I would have provided the fix but you didn't include the patch in the
email so I can't.


More information about the erlang-patches mailing list