emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Building Emacs on WSL


From: Fabrice Popineau
Subject: Re: Building Emacs on WSL
Date: Tue, 20 Dec 2016 21:03:35 +0100

Thanks Paul for taking care of this.


2016-12-20 20:35 GMT+01:00 Paul Eggert <address@hidden>:
On 12/20/2016 04:40 AM, Fabrice Popineau wrote:

(gdb) run  --batch  --load loadup bootstrap
Starting program: /mnt/d/Source/emacs/build-emacs-ubuntu/src/temacs --batch  --load loadup bootstrap
warning: Error disabling address space randomization: Succès

This is a warning from GDB, not from Emacs. GDB normally attempts to disable ASLR, to make debugging easier. Looking at the sequence of system calls in GDB 7.12, GDB calls 'personality' in some funky and undocumented ways, e.g., GDB assumes that errno is not changed when 'personality' succeeds.

Please compile and run the attached program under WSL, using the same flags you use to compile Emacs, and let me know what it does. On Fedora 24 x86-64, this program outputs:

personality (0xffffffff) returns 0x0, errno=0 (Success)
ADDR_NO_RANDOMIZE was clear
personality (pers | ADDR_NO_RANDOMIZE) returns 0x0, errno=0 (Success)
ADDR_NO_RANDOMIZE set successfully


I get the very same result here :

address@hidden:/tmp$ ./personality
personality (0xffffffff) returns 0x0, errno=0 (Success)
ADDR_NO_RANDOMIZE was clear
personality (pers | ADDR_NO_RANDOMIZE) returns 0x0, errno=0 (Success)
ADDR_NO_RANDOMIZE set successfully 
address@hidden:/tmp$

When run under GDB, the same program outputs:

personality (0xffffffff) returns 0x40000, errno=0 (Success)
ADDR_NO_RANDOMIZE was set

because GDB already disabled ASLR. You can look at GDB's file gdb/nat/linux-personality.c to see how GDB differs from Emacs in this area; perhaps there's something there that Emacs can use to figure out that it is running with a buggy kernel.

It seems it does not run the same way here:

address@hidden:/tmp$ gdb personality
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from personality...done.
(gdb) run
Starting program: /tmp/personality
warning: Error disabling address space randomization: Succès
warning: linux_ptrace_test_ret_to_nx: PTRACE_KILL waitpid returned -1: Appel système interrompu
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
personality (0xffffffff) returns 0x0, errno=0 (Success)
ADDR_NO_RANDOMIZE was clear
personality (pers | ADDR_NO_RANDOMIZE) returns 0x0, errno=0 (Success)
ADDR_NO_RANDOMIZE set successfully[Inferior 1 (process 19137) exited normally] 


there is a simple fix:

That fix cannot be installed as-is since ASLR needs to be disabled on ordinary GNU/Linux platforms. It appears that WSL pretends to support the Linux 'personality' system call and its ADDR_NO_RANDOMIZE flag, and that this support does not actually work and makes Emacs crash.

That looks like it.
I surely don't expect my "fix" to be included in master. 
It is only a quick way to make emacs master run under WSL for those who want to test it.
WSL (IMHO) is still a work in progress. 
Once Ubuntu 16.04 will be available, maybe we should consider it more seriously.
And even with 16.04, I wonder if it can compete with MSYS2/MinGW64. 
It needs to be rock solid for that.
I am worried by the fact that neither SBCL nor CCL (Common Lisp) run under WSL
and for a reason that maybe related to the same topic.

Regards,

Fabrice


--
Fabrice Popineau
-----------------------------
CentraleSupelec
Département Informatique
3, rue Joliot Curie
91192 Gif/Yvette Cedex
Tel direct : +33 (0) 169851950
Standard : +33 (0) 169851212
------------------------------


reply via email to

[Prev in Thread] Current Thread [Next in Thread]