GNU bug report logs - #33174
27.0.50; Dump fails on GNU/Linux ppc64le

Previous Next

Package: emacs;

Reported by: Thomas Fitzsimmons <fitzsim <at> fitzsim.org>

Date: Sat, 27 Oct 2018 10:31:02 UTC

Severity: normal

Found in version 27.0.50

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Andy Moreton <andrewjmoreton <at> gmail.com>
To: 33174 <at> debbugs.gnu.org
Subject: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le
Date: Mon, 12 Nov 2018 17:24:27 +0000
On Sun 11 Nov 2018, Paul Eggert wrote:

> Thomas Fitzsimmons wrote:
>> Actually, EMACS_HEAP_EXEC is true!
>
> OK, thanks, that explains things. I installed the first attached patch to the
> emacs-26 branch as a quick hack to work around the problem, and the second
> attached patch to the master branch to come up with a better way to address
> the underlying issue that doesn't involve fiddling with environment variables.
> Please let us know if this doesn't work for your platform, as I've tested this
> only on x86-64.

The second patch (applied to master) breaks the build on Windows.

> diff --git a/src/lisp.h b/src/lisp.h
> index eb6762678c..383d61274c 100644
> --- a/src/lisp.h
> +++ b/src/lisp.h
> @@ -4325,9 +4325,12 @@ struct tty_display_info;
>  
>  /* Defined in sysdep.c.  */
>  #ifdef HAVE_PERSONALITY_ADDR_NO_RANDOMIZE
> -extern bool disable_address_randomization (void);
> +extern int maybe_disable_address_randomization (bool, int, char **);
>  #else
> -INLINE bool disable_address_randomization (void) { return false; }
> +INLINE void
> +maybe_disable_address_randomization (bool dumping, int argc, char **argv)
> +{
> +}

The return type must be consistent as it is used by its caller:

C:/emacs/git/emacs/master/src/emacs.c: In function 'main':
C:/emacs/git/emacs/master/src/emacs.c:709:8: error: void value not ignored as it ought to be
   argc = maybe_disable_address_randomization (dumping, argc, argv);
        ^
The obvious fix seems to work:

#ifdef HAVE_PERSONALITY_ADDR_NO_RANDOMIZE
extern int maybe_disable_address_randomization (bool, int, char **);
#else
INLINE int
maybe_disable_address_randomization (bool dumping, int argc, char **argv)
{
  return argc;
}
#endif


> +int
> +maybe_disable_address_randomization (bool dumping, int argc, char **argv)
>  {
[snipped]
> +  if (argc < 2 || strcmp (argv[1], aslr_disabled_option) != 0)
> +    {
[snipped]
> +    }
> +  else
> +    {
> +      /* Our earlier incarnation already disabled ASLR.  */
> +      argc--;
> +      memmove (&argv[1], &argv[2], argc * sizeof *argv);
> +    }

This looks wrong: the memmove size is one element too long, and if argc
was 2 then there is an out of bounds access.

    AndyM





This bug report was last modified 6 years and 245 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.