all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Fabrice Popineau <fabrice.popineau@centralesupelec.fr>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: Emacs developers <emacs-devel@gnu.org>,
	Angelo Graziosi <angelo.graziosi@alice.it>
Subject: Re: Building Emacs on WSL
Date: Tue, 20 Dec 2016 21:03:35 +0100	[thread overview]
Message-ID: <CAFgFV9N50dNeNem48gPbR-xXsNiwBbgpNeJ198EsbWooy451yA@mail.gmail.com> (raw)
In-Reply-To: <ba5281b4-a3eb-dbbb-aa2f-e79bda64a1a8@cs.ucla.edu>

[-- Attachment #1: Type: text/plain, Size: 4381 bytes --]

Thanks Paul for taking care of this.


2016-12-20 20:35 GMT+01:00 Paul Eggert <eggert@cs.ucla.edu>:

> 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 :

fabrice@LOBSANG:/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
fabrice@LOBSANG:/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:

fabrice@LOBSANG:/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
------------------------------

[-- Attachment #2: Type: text/html, Size: 6570 bytes --]

  reply	other threads:[~2016-12-20 20:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-11 17:42 Building Emacs on WSL Angelo Graziosi
2016-12-16 15:05 ` Angelo Graziosi
2016-12-16 15:30   ` Eli Zaretskii
2016-12-16 17:48     ` Paul Eggert
2016-12-16 21:05       ` Eli Zaretskii
2016-12-17  1:00         ` Angelo Graziosi
2016-12-17  8:02           ` Eli Zaretskii
2016-12-17  8:33             ` Angelo Graziosi
2016-12-17 10:55               ` Eli Zaretskii
2016-12-17 14:25           ` Eli Zaretskii
2016-12-17 15:46             ` Angelo Graziosi
2016-12-20 12:20   ` Fabrice Popineau
2016-12-20 12:40     ` Fabrice Popineau
2016-12-20 19:35       ` Paul Eggert
2016-12-20 20:03         ` Fabrice Popineau [this message]
2016-12-20 23:59           ` Angelo Graziosi
2016-12-21  3:20           ` Paul Eggert
2016-12-21  8:54             ` Angelo Graziosi
2016-12-21 18:00               ` Paul Eggert
2016-12-21 20:50                 ` Angelo Graziosi
2016-12-20 20:57         ` Angelo Graziosi
2016-12-21  9:00       ` Angelo Graziosi
2016-12-21 10:29         ` Fabrice Popineau
2016-12-20 21:19     ` Angelo Graziosi
2016-12-20 22:01       ` Fabrice Popineau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFgFV9N50dNeNem48gPbR-xXsNiwBbgpNeJ198EsbWooy451yA@mail.gmail.com \
    --to=fabrice.popineau@centralesupelec.fr \
    --cc=angelo.graziosi@alice.it \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.