Make .pdmp file more reproducible
Problem reported by Ulrich Müller <https://lists.gnu.org/r/emacs-devel/2019-11/msg00757.html> and diagnosed by Andreas Schwab <https://lists.gnu.org/r/emacs-devel/2019-11/msg00774.html>. * src/sysdep.c (maybe_disable_address_randomization): Disable ASLR if any kind of dumping, instead of merely if unexec dumping. Omit first arg for simplicity; all uses changed.
This commit is contained in:
parent
aa79f4e8c6
commit
0fce8e9391
3 changed files with 8 additions and 6 deletions
|
@ -1054,8 +1054,7 @@ main (int argc, char **argv)
|
|||
load_pdump (argc, argv);
|
||||
#endif
|
||||
|
||||
argc = maybe_disable_address_randomization (
|
||||
will_dump_with_unexec_p (), argc, argv);
|
||||
argc = maybe_disable_address_randomization (argc, argv);
|
||||
|
||||
#if defined GNU_LINUX && defined HAVE_UNEXEC
|
||||
if (!initialized)
|
||||
|
|
|
@ -4576,10 +4576,10 @@ struct tty_display_info;
|
|||
|
||||
/* Defined in sysdep.c. */
|
||||
#ifdef HAVE_PERSONALITY_ADDR_NO_RANDOMIZE
|
||||
extern int maybe_disable_address_randomization (bool, int, char **);
|
||||
extern int maybe_disable_address_randomization (int, char **);
|
||||
#else
|
||||
INLINE int
|
||||
maybe_disable_address_randomization (bool dumping, int argc, char **argv)
|
||||
maybe_disable_address_randomization (int argc, char **argv)
|
||||
{
|
||||
return argc;
|
||||
}
|
||||
|
|
|
@ -158,14 +158,17 @@ static int exec_personality;
|
|||
/* Try to disable randomization if the current process needs it and
|
||||
does not appear to have it already. */
|
||||
int
|
||||
maybe_disable_address_randomization (bool dumping, int argc, char **argv)
|
||||
maybe_disable_address_randomization (int argc, char **argv)
|
||||
{
|
||||
/* Undocumented Emacs option used only by this function. */
|
||||
static char const aslr_disabled_option[] = "--__aslr-disabled";
|
||||
|
||||
if (argc < 2 || strcmp (argv[1], aslr_disabled_option) != 0)
|
||||
{
|
||||
bool disable_aslr = dumping;
|
||||
/* If dumping via unexec, ASLR must be disabled, as otherwise
|
||||
data may be scattered and undumpable as a simple executable.
|
||||
If pdumping, disabling ASLR makes the .pdmp file reproducible. */
|
||||
bool disable_aslr = will_dump_p ();
|
||||
# ifdef __PPC64__
|
||||
disable_aslr = true;
|
||||
# endif
|
||||
|
|
Loading…
Add table
Reference in a new issue