From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org
Cc: Siddhesh Poyarekar <siddhesh@sourceware.org>
Subject: [PATCH v3 3/3] elf: Remove LD_USE_LOAD_BIAS
Date: Thu, 10 Feb 2022 09:17:54 -0300 [thread overview]
Message-ID: <20220210121754.862331-4-adhemerval.zanella@linaro.org> (raw)
In-Reply-To: <20220210121754.862331-1-adhemerval.zanella@linaro.org>
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 | 3 +++
elf/dl-map-segments.h | 3 +--
elf/dl-support.c | 1 -
elf/rtld.c | 13 -------------
sysdeps/generic/ldsodefs.h | 5 -----
sysdeps/generic/unsecvars.h | 1 -
6 files changed, 4 insertions(+), 22 deletions(-)
diff --git a/NEWS b/NEWS
index 88815bcad1..626eeabf5d 100644
--- 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
diff --git a/elf/dl-map-segments.h b/elf/dl-map-segments.h
index 172692b120..b3513e7909 100644
--- a/elf/dl-map-segments.h
+++ b/elf/dl-map-segments.h
@@ -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. */
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 0fff62064a..1977a2be76 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -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. */
diff --git a/elf/rtld.c b/elf/rtld.c
index aa18256d86..19e328f89e 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -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:
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index d1c6cd902b..9878e7e87e 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -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;
diff --git a/sysdeps/generic/unsecvars.h b/sysdeps/generic/unsecvars.h
index 5ea8a4a259..b50331b50f 100644
--- a/sysdeps/generic/unsecvars.h
+++ b/sysdeps/generic/unsecvars.h
@@ -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" \
--
2.32.0
prev parent reply other threads:[~2022-02-10 12:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-10 12:17 [PATCH v3 0/3] Remove prelink support Adhemerval Zanella
2022-02-10 12:17 ` [PATCH v3 1/3] elf: " Adhemerval Zanella
2022-10-25 13:51 ` Andreas Schwab
2022-10-25 14:36 ` Adhemerval Zanella Netto
2022-02-10 12:17 ` [PATCH v3 2/3] malloc: Remove LD_TRACE_PRELINKING usage from mtrace Adhemerval Zanella
2022-08-22 9:48 ` Andreas Schwab
2022-08-22 18:56 ` Adhemerval Zanella Netto
2022-02-10 12:17 ` Adhemerval Zanella [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220210121754.862331-4-adhemerval.zanella@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=libc-alpha@sourceware.org \
--cc=siddhesh@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).