Fix hibernate with HiPE

Paul Guyot <>
Sun Oct 10 15:16:34 CEST 2010


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:

Please also apply this commit:

Or just fetch the two commits at once:
git fetch 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).

+33.175000290 - 62 bis rue Gay-Lussac, 75005 Paris

More information about the erlang-patches mailing list