This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add Prefer_MAP_32BIT_EXEC for Silvermont

On Fri, Dec 11, 2015 at 10:11 AM, Zack Weinberg <> wrote:
> On Fri, Dec 11, 2015 at 12:02 PM, Adhemerval Zanella
> <> wrote:
>> Another issue is this is basically limiting ALSR really hard on x86_64.
>> I also would prefer to make the default to *not* include this flag and
>> set the env. variable to actually enable it. If the cpu is slow doing
>> what's intended because it is buggy, let it be slow at default. Do not
>> break what was intended (full ALSR).
> FWIW, I was about to post the exact same objection.  Relatedly, the
> environment variable should be handled through the normal
> environment variable mechanism (and, in particular, ineffective for
> set*id binaries).

We have discussed it internally.  Since this is very critical for performance
on Silvermont based platforms, we want to keep it op-out for normal
programs and disable it for SUID programs.  Reduced address range is no
worse than 32-bit programs.

Like this.

/* Prefer_MAP_32BIT_EXEC reduces bits available for address space layout
   randomization (ASLR).  Prefer_MAP_32BIT_EXEC is disabled for SUID
   programs and can also be disabled by setting environment variable,

static inline unsigned int
get_prefer_map_32bit_exec (void)
#if defined __LP64__ && IS_IN (rtld)
  extern char **__environ attribute_hidden;
  extern int __libc_enable_secure;
  if (__builtin_expect (__libc_enable_secure, 0))
    return 0;
  for (char **current = __environ; *current != NULL; ++current)
      /* Check LD_DISABLE_PREFER_MAP_32BIT_EXEC=.  */
      static const char *disable = "LD_DISABLE_PREFER_MAP_32BIT_EXEC=";
      for (size_t i = 0; ; i++)
 if (disable[i] != (*current)[i])
 if ((*current)[i] == '=')
   return 0;
  return bit_Prefer_MAP_32BIT_EXEC;
  return 0;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]