public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v5 0/5] Improve loader environment variable handling
@ 2023-11-22 20:43 Adhemerval Zanella
  2023-11-22 20:43 ` [PATCH v5 1/5] elf: Do not duplicate the GLIBC_TUNABLES string Adhemerval Zanella
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Adhemerval Zanella @ 2023-11-22 20:43 UTC (permalink / raw)
  To: libc-alpha, siddhesh

The first patch removes the tunable_strdup and make the GLIBC_TUNABLE
parsing in place (no more possible allocation failure).  The parsing now
tracks the tunable string start and its size.  The dl-tunable-parse.h
adds helper functions to help to parse, like an strcmp that also checks
for size and an iterator for suboptions that are comma-separated
(used on hwcap parsing by x86, powerpc, and s390x).

The second and third patch make loader ignore all but just
LD_PRELOAD and LD_AUDIT for setuid binaries.   For both options, loader
ensures that pathnames containing slashes are ignored and shared
libraries are loaded only from the standard search directories and only
if they have set-user-ID mode bit enabled.


Changes from v4:
* Improve tunables value handling, now warnings for invalid and out of
  range numbers.

Changes from v3:
* Fixed tunable_initialize for strong aliases (it used the key length,
  instead of the value length).
* Added a assert on tunable_str_comma_init to ensure its value is non
  null.
* Added LD_WARN and LD_VERBOSE to filtered environment variables.

Changes from v2:
* Extend tst-tunables with tunables aliases tests.
* Use warning instead of an error to indicate invalid tunables.
* Fixed tunable_initialize for string aliases.

Changes from v1:
* Ignore most of the environment variables on security-sensitive mode.
* Extend tests.

Adhemerval Zanella (5):
  elf: Do not duplicate the GLIBC_TUNABLES string
  elf: Do not set invalid tunables values
  elf: Ignore loader debug env vars for setuid
  elf: Ignore LD_BIND_NOW and LD_BIND_NOT for setuid binaries
  elf: Refactor process_envvars

 elf/dl-misc.c                                 |   5 +-
 elf/dl-tunables.c                             | 123 +++++++------
 elf/dl-tunables.h                             |   6 +-
 elf/rtld.c                                    | 108 ++++++++----
 elf/tst-env-setuid.c                          |   8 +-
 elf/tst-tunables.c                            |  96 +++++++++-
 sysdeps/generic/dl-tunables-parse.h           | 134 ++++++++++++++
 sysdeps/generic/unsecvars.h                   |   4 +
 sysdeps/s390/cpu-features.c                   | 165 +++++++-----------
 .../unix/sysv/linux/aarch64/cpu-features.c    |  33 ++--
 .../unix/sysv/linux/powerpc/cpu-features.c    |  45 ++---
 .../sysv/linux/powerpc/tst-hwcap-tunables.c   |   6 +-
 sysdeps/x86/Makefile                          |   4 +-
 sysdeps/x86/cpu-tunables.c                    | 118 +++++--------
 sysdeps/x86/tst-hwcap-tunables.c              | 148 ++++++++++++++++
 15 files changed, 682 insertions(+), 321 deletions(-)
 create mode 100644 sysdeps/generic/dl-tunables-parse.h
 create mode 100644 sysdeps/x86/tst-hwcap-tunables.c

-- 
2.34.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-12-06 13:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-22 20:43 [PATCH v5 0/5] Improve loader environment variable handling Adhemerval Zanella
2023-11-22 20:43 ` [PATCH v5 1/5] elf: Do not duplicate the GLIBC_TUNABLES string Adhemerval Zanella
2023-12-01 15:20   ` Siddhesh Poyarekar
2023-11-22 20:43 ` [PATCH v5 2/5] elf: Do not set invalid tunables values Adhemerval Zanella
2023-12-01 15:32   ` Siddhesh Poyarekar
2023-12-06 13:06     ` Adhemerval Zanella Netto
2023-11-22 20:43 ` [PATCH v5 3/5] elf: Ignore loader debug env vars for setuid Adhemerval Zanella
2023-12-01 15:34   ` Siddhesh Poyarekar
2023-11-22 20:43 ` [PATCH v5 4/5] elf: Ignore LD_BIND_NOW and LD_BIND_NOT for setuid binaries Adhemerval Zanella
2023-11-22 20:43 ` [PATCH v5 5/5] elf: Refactor process_envvars Adhemerval Zanella

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).