Blame sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h

Packit 6c4009
/* Optional code to distinguish library flavours.  x86-64 version.
Packit 6c4009
   Copyright (C) 2015-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _DL_LIBRECON_H
Packit 6c4009
Packit 6c4009
#include <sysdeps/unix/sysv/linux/dl-librecon.h>
Packit 6c4009
Packit 6c4009
/* Recognizing extra environment variables.  For 64-bit applications,
Packit 6c4009
   branch prediction performance may be negatively impacted when the
Packit 6c4009
   target of a branch is more than 4GB away from the branch.  Add the
Packit 6c4009
   Prefer_MAP_32BIT_EXEC bit so that mmap will try to map executable
Packit 6c4009
   pages with MAP_32BIT first.  NB: MAP_32BIT will map to lower 2GB,
Packit 6c4009
   not lower 4GB, address.  Prefer_MAP_32BIT_EXEC reduces bits available
Packit 6c4009
   for address space layout randomization (ASLR).  Prefer_MAP_32BIT_EXEC
Packit 6c4009
   is always disabled for SUID programs and can be enabled by setting
Packit 6c4009
   environment variable, LD_PREFER_MAP_32BIT_EXEC.  */
Packit 6c4009
#define EXTRA_LD_ENVVARS \
Packit 6c4009
  case 21:								  \
Packit 4844b7
    if (!__libc_enable_secure						  \
Packit 4844b7
	&& memcmp (envline, "PREFER_MAP_32BIT_EXEC", 21) == 0)		  \
Packit 6c4009
      GLRO(dl_x86_cpu_features).feature[index_arch_Prefer_MAP_32BIT_EXEC] \
Packit 6c4009
	|= bit_arch_Prefer_MAP_32BIT_EXEC;				  \
Packit 6c4009
    break;
Packit 6c4009
Packit 6c4009
/* Extra unsecure variables.  The names are all stuffed in a single
Packit 6c4009
   string which means they have to be terminated with a '\0' explicitly.  */
Packit 6c4009
#define EXTRA_UNSECURE_ENVVARS \
Packit 6c4009
  "LD_PREFER_MAP_32BIT_EXEC\0"
Packit 6c4009
Packit 6c4009
#endif /* dl-librecon.h */