From: Eli Zaretskii <eliz@gnu.org>
To: Ken Brown <kbrown@cornell.edu>, Paul Eggert <eggert@cs.ucla.edu>
Cc: angelo.graziosi@alice.it, emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master 0c94b84: * nt/inc/ms-w32.h (execve) [MINGW_W64]: Make commentary more accurate.
Date: Fri, 02 Sep 2016 09:53:18 +0300 [thread overview]
Message-ID: <83vayeeqsh.fsf@gnu.org> (raw)
In-Reply-To: <518bc279-ee83-356a-51af-fd348d32aa4f@cornell.edu> (message from Ken Brown on Thu, 1 Sep 2016 15:57:00 -0400)
> From: Ken Brown <kbrown@cornell.edu>
> Cc: Angelo Graziosi <angelo.graziosi@alice.it>
> Date: Thu, 1 Sep 2016 15:57:00 -0400
>
> On 9/1/2016 1:16 PM, Eli Zaretskii wrote:
> > + However, using the prototype with intptr_t causes GCC to emit
> > + warnings. Fortunately, execve is not used in the MinGW build, but
> > + the code that references it is still compiled. */
>
> Wouldn't it be easier to prevent that code from being compiled?
It would for the Windows build, but it would add one (actually more,
see below) #ifdef WINDOWSNT into the mainline code. AFAIR, Paul
(CC'ed) wanted to keep those to a minimum, so I preferred not to ifdef
away the code.
> I think the following would suffice:
>
> --- a/src/sysdep.c
> +++ b/src/sysdep.c
> @@ -146,6 +146,7 @@ disable_address_randomization (void)
> }
> #endif
>
> +#ifndef WINDOWSNT
> /* Execute the program in FILE, with argument vector ARGV and environ
> ENVP. Return an error number if unsuccessful. This is like execve
> except it reenables ASLR in the executed program if necessary, and
> @@ -170,6 +171,7 @@ emacs_exec_file (char const *file, char *const
> *argv, char *const *envp)
>
> return err;
> }
> +#endif /* not WINDOWSNT */
That whole function is not used on Windows, so if we are to do this,
the following fragment of main in emacs.c should also be ifdefed away:
/* True if address randomization interferes with memory allocation. */
# ifdef __PPC64__
bool disable_aslr = true;
# else
bool disable_aslr = dumping;
# endif
if (disable_aslr && disable_address_randomization ())
{
/* Set this so the personality will be reverted before execs
after this one. */
xputenv ("EMACS_HEAP_EXEC=true");
/* Address randomization was enabled, but is now disabled.
Re-execute Emacs to get a clean slate. */
execvp (argv[0], argv);
/* If the exec fails, warn and then try anyway. */
perror (argv[0]);
}
If Paul doesn't mind (nor anyone else), we can certainly do that.
Thanks.
next prev parent reply other threads:[~2016-09-02 6:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20160901171604.9042.16589@vcs.savannah.gnu.org>
[not found] ` <20160901171604.8DF4D22016A@vcs.savannah.gnu.org>
2016-09-01 19:57 ` [Emacs-diffs] master 0c94b84: * nt/inc/ms-w32.h (execve) [MINGW_W64]: Make commentary more accurate Ken Brown
2016-09-02 6:53 ` Eli Zaretskii [this message]
2016-09-04 10:34 ` Angelo Graziosi
2016-09-04 18:47 ` Paul Eggert
2016-09-04 19:00 ` Eli Zaretskii
2016-09-04 20:58 ` Angelo Graziosi
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83vayeeqsh.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=angelo.graziosi@alice.it \
--cc=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
--cc=kbrown@cornell.edu \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).