aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/emacs.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/emacs.c b/src/emacs.c
index bb85733a1f2..b2219844ca0 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -112,7 +112,7 @@ extern void moncontrol (int mode);
112#include <sys/resource.h> 112#include <sys/resource.h>
113#endif 113#endif
114 114
115#ifdef HAVE_PERSONALITY_LINUX32 115#ifdef HAVE_PERSONALITY_ADDR_NO_RANDOMIZE
116#include <sys/personality.h> 116#include <sys/personality.h>
117#endif 117#endif
118 118
@@ -796,24 +796,22 @@ main (int argc, char **argv)
796 dumping = !initialized && (strcmp (argv[argc - 1], "dump") == 0 796 dumping = !initialized && (strcmp (argv[argc - 1], "dump") == 0
797 || strcmp (argv[argc - 1], "bootstrap") == 0); 797 || strcmp (argv[argc - 1], "bootstrap") == 0);
798 798
799#ifdef HAVE_PERSONALITY_LINUX32 799#ifdef HAVE_PERSONALITY_ADDR_NO_RANDOMIZE
800 if (dumping && ! getenv ("EMACS_HEAP_EXEC")) 800 if (dumping)
801 { 801 {
802 /* Set this so we only do this once. */ 802 int pers = personality (0xffffffff);
803 xputenv ("EMACS_HEAP_EXEC=true"); 803 if (! (pers & ADDR_NO_RANDOMIZE)
804 804 && 0 <= personality (pers | ADDR_NO_RANDOMIZE))
805 /* A flag to turn off address randomization which is introduced 805 {
806 in linux kernel shipped with fedora core 4 */ 806 /* Address randomization was enabled, but is now disabled.
807#define ADD_NO_RANDOMIZE 0x0040000 807 Re-execute Emacs to get a clean slate. */
808 personality (PER_LINUX32 | ADD_NO_RANDOMIZE); 808 execvp (argv[0], argv);
809#undef ADD_NO_RANDOMIZE
810
811 execvp (argv[0], argv);
812 809
813 /* If the exec fails, try to dump anyway. */ 810 /* If the exec fails, warn and then try without a clean slate. */
814 emacs_perror (argv[0]); 811 perror (argv[0]);
812 }
815 } 813 }
816#endif /* HAVE_PERSONALITY_LINUX32 */ 814#endif
817 815
818#if defined (HAVE_SETRLIMIT) && defined (RLIMIT_STACK) && !defined (CYGWIN) 816#if defined (HAVE_SETRLIMIT) && defined (RLIMIT_STACK) && !defined (CYGWIN)
819 /* Extend the stack space available. Don't do that if dumping, 817 /* Extend the stack space available. Don't do that if dumping,