]> sourceware.org Git - glibc.git/commitdiff
elf: Remove LD_USE_LOAD_BIAS
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 13 Jan 2022 21:04:49 +0000 (18:04 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 10 Feb 2022 12:18:15 +0000 (09:18 -0300)
It is solely for prelink with PIE executables [1].

[1] https://sourceware.org/legacy-ml/libc-hacker/2003-11/msg00127.html

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
NEWS
elf/dl-map-segments.h
elf/dl-support.c
elf/rtld.c
sysdeps/generic/ldsodefs.h
sysdeps/generic/unsecvars.h

diff --git a/NEWS b/NEWS
index 88815bcad13432ad0128b293a01812ccf27a634e..626eeabf5d0be4cf6fbe727d94b42f39e276b054 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -197,6 +197,9 @@ Deprecated and removed features, and other changes affecting compatibility:
   functionality to obtain the program mapping address can be achieved by
   using LD_TRACE_LOADED_OBJECTS to value of 2.
 
+* The LD_USE_LOAD_BIAS has been removed.  The variable was mainly used to
+  support prelink PIE binaries.
+
 Changes to build and runtime requirements:
 
 * The audit module interface version LAV_CURRENT is increased to enable
index 172692b120e1e83fa2fc292d4362e4862ed920e8..b3513e79093b279dfe11425451bd836fb0a02a7d 100644 (file)
@@ -94,8 +94,7 @@ _dl_map_segments (struct link_map *l, int fd,
          prefer to map such objects at; but this is only a preference,
          the OS can do whatever it likes. */
       ElfW(Addr) mappref
-        = (ELF_PREFERRED_ADDRESS (loader, maplength,
-                                  c->mapstart & GLRO(dl_use_load_bias))
+        = (ELF_PREFERRED_ADDRESS (loader, maplength, c->mapstart)
            - MAP_BASE_ADDR (l));
 
       /* Remember which part of the address space this object uses.  */
index 0fff62064ab5944d22017dd08a5f9ba0b375d8f3..1977a2be7602650e0b2ef850c777d9b9cc056c52 100644 (file)
@@ -54,7 +54,6 @@ size_t _dl_platformlen;
 
 int _dl_debug_mask;
 int _dl_lazy;
-ElfW(Addr) _dl_use_load_bias = -2;
 int _dl_dynamic_weak;
 
 /* If nonzero print warnings about problematic situations.  */
index aa18256d86d7da8c209714f96ab2f3ded08615a6..19e328f89e348347c1d0a045fbda1af49b0edc1f 100644 (file)
@@ -365,7 +365,6 @@ struct rtld_global_ro _rtld_global_ro attribute_relro =
     ._dl_sysinfo = DL_SYSINFO_DEFAULT,
 #endif
     ._dl_debug_fd = STDERR_FILENO,
-    ._dl_use_load_bias = -2,
     ._dl_correct_cache_id = _DL_CACHE_DEFAULT_ID,
 #if !HAVE_TUNABLES
     ._dl_hwcap_mask = HWCAP_IMPORTANT,
@@ -1742,12 +1741,6 @@ dl_main (const ElfW(Phdr) *phdr,
   ++GL(dl_ns)[LM_ID_BASE]._ns_nloaded;
   ++GL(dl_load_adds);
 
-  /* If LD_USE_LOAD_BIAS env variable has not been seen, default
-     to not using bias for non-prelinked PIEs and libraries
-     and using it for executables or prelinked PIEs or libraries.  */
-  if (GLRO(dl_use_load_bias) == (ElfW(Addr)) -2)
-    GLRO(dl_use_load_bias) = main_map->l_addr == 0 ? -1 : 0;
-
   /* Starting from binutils-2.23, the linker will define the magic symbol
      __ehdr_start to point to our own ELF header if it is visible in a
      segment that also includes the phdrs.  If that's not available, we use
@@ -2657,12 +2650,6 @@ process_envvars (struct dl_main_state *state)
 #ifdef EXTRA_LD_ENVVARS_13
          EXTRA_LD_ENVVARS_13
 #endif
-         if (!__libc_enable_secure
-             && memcmp (envline, "USE_LOAD_BIAS", 13) == 0)
-           {
-             GLRO(dl_use_load_bias) = envline[14] == '1' ? -1 : 0;
-             break;
-           }
          break;
 
        case 14:
index d1c6cd902b882a68fa66473f11d8e86155a2e97e..9878e7e87eb97c0fdaaae50bcb6119422a38984f 100644 (file)
@@ -628,11 +628,6 @@ struct rtld_global_ro
   /* Location of the binary.  */
   EXTERN const char *_dl_origin_path;
 
-  /* -1 if the dynamic linker should honor library load bias,
-     0 if not, -2 use the default (honor biases for normal
-     binaries, don't honor for PIEs).  */
-  EXTERN ElfW(Addr) _dl_use_load_bias;
-
   /* Size of the static TLS block.  */
   EXTERN size_t _dl_tls_static_size;
 
index 5ea8a4a259ef753c9d0d30aa4c0788e93656d047..b50331b50fe05bdfa4734319bf1863e6cc565b49 100644 (file)
@@ -22,7 +22,6 @@
   "LD_PRELOAD\0"                                                             \
   "LD_PROFILE\0"                                                             \
   "LD_SHOW_AUXV\0"                                                           \
-  "LD_USE_LOAD_BIAS\0"                                                       \
   "LOCALDOMAIN\0"                                                            \
   "LOCPATH\0"                                                                \
   "MALLOC_TRACE\0"                                                           \
This page took 0.058098 seconds and 5 git commands to generate.