Fix hibernate with HiPE

Paul Guyot pguyot@REDACTED
Sun Oct 10 15:16:34 CEST 2010


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).

Paul
-- 
Semiocast                    http://semiocast.com/
+33.175000290 - 62 bis rue Gay-Lussac, 75005 Paris



More information about the erlang-patches mailing list