all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 24033@debbugs.gnu.org
Subject: bug#24033: Porting emacs-25 to GNU/Linux ppc64 with draft glibc 2.24
Date: Wed, 20 Jul 2016 19:09:40 +0200	[thread overview]
Message-ID: <1424f04d-88b6-b760-8da0-afa30c082eb2@cs.ucla.edu> (raw)
In-Reply-To: <83poq8z774.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 259 bytes --]

On 07/20/2016 04:59 PM, Eli Zaretskii wrote:
>
> Would it be possible to tweak the patch so that it doesn't change the
> code on platforms other than PPC64?

Sure, something like the attached patch perhaps? If so, I can ask my 
PPC64 correspondent to try it.

[-- Attachment #2: 0001-Port-to-glibc-2.24-pre-release-ppc64.patch --]
[-- Type: text/x-patch, Size: 2199 bytes --]

From 37bc57cf803f2ab0b7a7844730ebc17eb43e942d Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 19 Jul 2016 15:23:14 +0200
Subject: [PATCH] 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.
---
 src/emacs.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/emacs.c b/src/emacs.c
index 5c187e7..2480dfc 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -674,6 +674,26 @@ main (int argc, char **argv)
 
   stack_base = &dummy;
 
+#if defined HAVE_PERSONALITY_LINUX32 && defined __PPC64__
+  /* This code partly duplicates the HAVE_PERSONALITY_LINUX32 code
+     below.  This duplication is planned to be fixed in a later
+     Emacs release.  */
+# define ADD_NO_RANDOMIZE 0x0040000
+  int pers = personality (0xffffffff);
+  if (! (pers & ADD_NO_RANDOMIZE)
+      && 0 <= personality (pers | ADD_NO_RANDOMIZE))
+    {
+      /* 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 the user and then try without a
+	 clean slate.  */
+      perror (argv[0]);
+    }
+# undef ADD_NO_RANDOMIZE
+#endif
+
 #ifndef CANNOT_DUMP
   might_dump = !initialized;
 #endif
@@ -784,7 +804,7 @@ main (int argc, char **argv)
   dumping = !initialized && (strcmp (argv[argc - 1], "dump") == 0
 			     || strcmp (argv[argc - 1], "bootstrap") == 0);
 
-#ifdef HAVE_PERSONALITY_LINUX32
+#if defined HAVE_PERSONALITY_LINUX32 && !defined __PPC64__
   if (dumping && ! getenv ("EMACS_HEAP_EXEC"))
     {
       /* Set this so we only do this once.  */
@@ -801,7 +821,7 @@ main (int argc, char **argv)
       /* If the exec fails, try to dump anyway.  */
       emacs_perror (argv[0]);
     }
-#endif /* HAVE_PERSONALITY_LINUX32 */
+#endif
 
 #if defined (HAVE_SETRLIMIT) && defined (RLIMIT_STACK) && !defined (CYGWIN)
   /* Extend the stack space available.  Don't do that if dumping,
-- 
2.5.5


  reply	other threads:[~2016-07-20 17:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-20  8:02 bug#24033: Porting emacs-25 to GNU/Linux ppc64 with draft glibc 2.24 Paul Eggert
2016-07-20 14:59 ` Eli Zaretskii
2016-07-20 17:09   ` Paul Eggert [this message]
2016-07-20 18:52     ` Eli Zaretskii
2016-07-21 11:30       ` Paul Eggert

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=1424f04d-88b6-b760-8da0-afa30c082eb2@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=24033@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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.