Problem reported by Angelo Graziosi in:
http://lists.gnu.org/archive/html/emacs-devel/2016-12/msg00822.html
* src/sysdep.c (disable_address_randomization):
Detect buggy platforms where 'personality' always returns 0.
bool
disable_address_randomization (void)
{
- bool disabled = false;
int pers = personality (0xffffffff);
- disabled = (! (pers & ADDR_NO_RANDOMIZE)
- && 0 <= personality (pers | ADDR_NO_RANDOMIZE));
- return disabled;
+ if (pers < 0)
+ return false;
+ int desired_pers = pers | ADDR_NO_RANDOMIZE;
+
+ /* Call 'personality' twice, to detect buggy platforms like WSL
+ where 'personality' always returns 0. */
+ return (pers != desired_pers
+ && personality (desired_pers) == pers
+ && personality (0xffffffff) == desired_pers);
}
#endif