bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le


From: Andy Moreton
Subject: bug#33174: 27.0.50; Dump fails on GNU/Linux ppc64le
Date: Mon, 12 Nov 2018 17:24:27 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (windows-nt)

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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]