From: Paul Eggert <eggert@cs.ucla.edu>
To: Fabrice Popineau <fabrice.popineau@centralesupelec.fr>,
Angelo Graziosi <angelo.graziosi@alice.it>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: Building Emacs on WSL
Date: Tue, 20 Dec 2016 11:35:31 -0800 [thread overview]
Message-ID: <ba5281b4-a3eb-dbbb-aa2f-e79bda64a1a8@cs.ucla.edu> (raw)
In-Reply-To: <CAFgFV9PN6VB73tkFaQfQRBEEKwR3VGeCrXs2d3nnn85Zpe_GvQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1665 bytes --]
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
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.
>
> 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.
[-- Attachment #2: personality.c --]
[-- Type: text/plain, Size: 834 bytes --]
#include <sys/personality.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
static int
print_personality (unsigned long persona, char const *msg)
{
int pers, err;
errno = 0;
pers = personality (persona);
err = errno;
printf ("personality (%s) returns 0x%x, errno=%d (%s)\n",
msg, pers, err, strerror (err));
errno = err;
return pers;
}
int
main (void)
{
int pers;
pers = print_personality (0xffffffff, "0xffffffff");
if (pers & ADDR_NO_RANDOMIZE)
printf ("ADDR_NO_RANDOMIZE was set\n");
else
{
printf ("ADDR_NO_RANDOMIZE was clear\n");
pers = print_personality (pers | ADDR_NO_RANDOMIZE,
"pers | ADDR_NO_RANDOMIZE");
if (0 <= personality)
printf ("ADDR_NO_RANDOMIZE set successfully");
else
printf ("ADDR_NO_RANDOMIZE could not be set");
}
return 0;
}
next prev parent reply other threads:[~2016-12-20 19:35 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 [this message]
2016-12-20 20:03 ` Fabrice Popineau
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=ba5281b4-a3eb-dbbb-aa2f-e79bda64a1a8@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=angelo.graziosi@alice.it \
--cc=emacs-devel@gnu.org \
--cc=fabrice.popineau@centralesupelec.fr \
/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.