[PATCH v2 0/4] More tunable fixes
Adhemerval Zanella
adhemerval.zanella@linaro.org
Thu May 2 16:35:55 GMT 2024
The 680c597e9c3 commit made loader reject ill-formatted strings by
first tracking all set tunables and then applying them. However, it does
not take into consideration if the same tunable is set multiple times,
where parse_tunables_string appends the found tunable without checking
if it was already in the list. It leads to a stack-based buffer overflow
if the tunable is specified more than the total number of
tunables (BZ 31686).
While fixing this issue, I noted that the new glibc.rtld.enable_secure
check could be optimized a bit to avoid the string comparison on the
tunable loop.
I also found an issue where it does have the handle case where the
environment alias is handled before the GLIBC_TUNABLES, which will
change the tunable even if glibc.rtld.enable_secure it set to 0. Fixing
it allows us to optimize the environment alias parsing a bit, since only
tunable with aliases need to be checked (instead of the whole list).
Changes from v1:
* Do not change tunables internal position.
Adhemerval Zanella (4):
elf: Only process multiple tunable once (BZ 31686)
elf: Remove glibc.rtld.enable_secure check from parse_tunables_string
support: Add envp argument to support_capture_subprogram
elf: Make glibc.rtld.enable_secure ignore alias environment variables
elf/dl-tunables.c | 114 ++++++++++++------
elf/tst-audit18.c | 2 +-
elf/tst-audit19b.c | 2 +-
elf/tst-audit22.c | 2 +-
elf/tst-audit23.c | 2 +-
elf/tst-audit25a.c | 4 +-
elf/tst-audit25b.c | 4 +-
elf/tst-glibc-hwcaps-2-cache.c | 2 +-
elf/tst-rtld-run-static.c | 4 +-
elf/tst-tunables-enable_secure.c | 133 ++++++++++++++++++---
elf/tst-tunables.c | 60 +++++++++-
scripts/gen-tunables.awk | 16 ++-
support/capture_subprocess.h | 9 +-
support/subprocess.h | 7 +-
support/support_capture_subprocess.c | 5 +-
support/support_subprocess.c | 5 +-
support/tst-support_capture_subprocess.c | 2 +-
sysdeps/aarch64/multiarch/memset_generic.S | 4 +
sysdeps/sparc/sparc64/rtld-memset.c | 3 +
sysdeps/x86/tst-hwcap-tunables.c | 2 +-
20 files changed, 304 insertions(+), 78 deletions(-)
--
2.43.0
More information about the Libc-alpha
mailing list