diff options
| author | Paul Eggert | 2016-07-19 15:23:14 +0200 |
|---|---|---|
| committer | Paul Eggert | 2016-07-21 13:29:17 +0200 |
| commit | ff3fc21e24edffccce0d42065833e852a6792bd2 (patch) | |
| tree | 0bda287bab6b3182a305c57515821951a3ec5d8e | |
| parent | eb9d461a8edd1a515f361a3a5fdc2e886264b0d9 (diff) | |
| download | emacs-ff3fc21e24edffccce0d42065833e852a6792bd2.tar.gz emacs-ff3fc21e24edffccce0d42065833e852a6792bd2.zip | |
Port to glibc 2.24 (pre-release) + ppc64
Backport from master (Bug#24033).
Inspired by a suggestion by Florian Weimer in:
https://sourceware.org/ml/libc-alpha/2016-07/msg00425.html
* src/emacs.c (main) [__PPC64__]:
Special case for __PPC64__, which needs ASLR disabled in
dumped Emacs too.
| -rw-r--r-- | src/emacs.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/emacs.c b/src/emacs.c index 5c187e76ba1..2480dfc603a 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -674,6 +674,26 @@ main (int argc, char **argv) | |||
| 674 | 674 | ||
| 675 | stack_base = &dummy; | 675 | stack_base = &dummy; |
| 676 | 676 | ||
| 677 | #if defined HAVE_PERSONALITY_LINUX32 && defined __PPC64__ | ||
| 678 | /* This code partly duplicates the HAVE_PERSONALITY_LINUX32 code | ||
| 679 | below. This duplication is planned to be fixed in a later | ||
| 680 | Emacs release. */ | ||
| 681 | # define ADD_NO_RANDOMIZE 0x0040000 | ||
| 682 | int pers = personality (0xffffffff); | ||
| 683 | if (! (pers & ADD_NO_RANDOMIZE) | ||
| 684 | && 0 <= personality (pers | ADD_NO_RANDOMIZE)) | ||
| 685 | { | ||
| 686 | /* Address randomization was enabled, but is now disabled. | ||
| 687 | Re-execute Emacs to get a clean slate. */ | ||
| 688 | execvp (argv[0], argv); | ||
| 689 | |||
| 690 | /* If the exec fails, warn the user and then try without a | ||
| 691 | clean slate. */ | ||
| 692 | perror (argv[0]); | ||
| 693 | } | ||
| 694 | # undef ADD_NO_RANDOMIZE | ||
| 695 | #endif | ||
| 696 | |||
| 677 | #ifndef CANNOT_DUMP | 697 | #ifndef CANNOT_DUMP |
| 678 | might_dump = !initialized; | 698 | might_dump = !initialized; |
| 679 | #endif | 699 | #endif |
| @@ -784,7 +804,7 @@ main (int argc, char **argv) | |||
| 784 | dumping = !initialized && (strcmp (argv[argc - 1], "dump") == 0 | 804 | dumping = !initialized && (strcmp (argv[argc - 1], "dump") == 0 |
| 785 | || strcmp (argv[argc - 1], "bootstrap") == 0); | 805 | || strcmp (argv[argc - 1], "bootstrap") == 0); |
| 786 | 806 | ||
| 787 | #ifdef HAVE_PERSONALITY_LINUX32 | 807 | #if defined HAVE_PERSONALITY_LINUX32 && !defined __PPC64__ |
| 788 | if (dumping && ! getenv ("EMACS_HEAP_EXEC")) | 808 | if (dumping && ! getenv ("EMACS_HEAP_EXEC")) |
| 789 | { | 809 | { |
| 790 | /* Set this so we only do this once. */ | 810 | /* Set this so we only do this once. */ |
| @@ -801,7 +821,7 @@ main (int argc, char **argv) | |||
| 801 | /* If the exec fails, try to dump anyway. */ | 821 | /* If the exec fails, try to dump anyway. */ |
| 802 | emacs_perror (argv[0]); | 822 | emacs_perror (argv[0]); |
| 803 | } | 823 | } |
| 804 | #endif /* HAVE_PERSONALITY_LINUX32 */ | 824 | #endif |
| 805 | 825 | ||
| 806 | #if defined (HAVE_SETRLIMIT) && defined (RLIMIT_STACK) && !defined (CYGWIN) | 826 | #if defined (HAVE_SETRLIMIT) && defined (RLIMIT_STACK) && !defined (CYGWIN) |
| 807 | /* Extend the stack space available. Don't do that if dumping, | 827 | /* Extend the stack space available. Don't do that if dumping, |