glibc/sysdeps
Adhemerval Zanella 71149c2a2e elf: Only process multiple tunable once (BZ 31686)
The 680c597e9c 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.  For
instance:

  GLIBC_TUNABLES=glibc.malloc.check=2:... (repeat over the number of
  total support for different tunable).

Instead, use the index of the tunable list to get the expected tunable
entry.  Since now the initial list is zero-initialized, the compiler
might emit an extra memset and this requires some minor adjustment
on some ports.

Checked on x86_64-linux-gnu and aarch64-linux-gnu.

Reported-by: Yuto Maeda <maeda@cyberdefense.jp>
Reported-by: Yutaro Shimizu <shimizu@cyberdefense.jp>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
(cherry picked from commit bcae44ea85)
2024-05-07 14:06:56 -03:00
..
aarch64 elf: Only process multiple tunable once (BZ 31686) 2024-05-07 14:06:56 -03:00
alpha Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
arc login: Check default sizes of structs utmp, utmpx, lastlog 2024-05-02 13:20:27 +02:00
arm login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-05-02 13:20:27 +02:00
csky login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-05-02 13:20:27 +02:00
generic login: Check default sizes of structs utmp, utmpx, lastlog 2024-05-02 13:20:27 +02:00
gnu Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hppa login: Check default sizes of structs utmp, utmpx, lastlog 2024-05-02 13:20:27 +02:00
htl Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurd Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
i386 i686: Fix multiple definitions of __memmove_chk and __memset_chk 2024-05-04 13:29:48 +01:00
ieee754 math: remove exp10 wrappers 2024-01-12 16:02:12 +00:00
loongarch Apply the Makefile sorting fix 2024-04-14 05:41:02 -07:00
m68k login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-05-02 13:20:27 +02:00
mach Make __getrandom_nocancel set errno and add a _nostatus version 2024-01-12 14:23:11 +01:00
microblaze login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-05-02 13:20:27 +02:00
mips login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-05-02 13:20:27 +02:00
nios2 login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-05-02 13:20:27 +02:00
nptl Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
or1k login: Check default sizes of structs utmp, utmpx, lastlog 2024-05-02 13:20:27 +02:00
posix Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
powerpc login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-05-02 13:20:27 +02:00
pthread nptl: Fix tst-cancel30 on kernels without ppoll_time64 support 2024-04-25 12:57:32 +02:00
riscv login: Check default sizes of structs utmp, utmpx, lastlog 2024-05-02 13:20:27 +02:00
s390 S390: Fix building with --disable-mutli-arch [BZ #31196] 2024-01-30 22:28:51 +01:00
sh login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-05-02 13:20:27 +02:00
sparc elf: Only process multiple tunable once (BZ 31686) 2024-05-07 14:06:56 -03:00
unix time: Allow later version licensing. 2024-05-03 10:15:11 +02:00
wordsize-32 Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wordsize-64 Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
x86 login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-05-02 13:20:27 +02:00
x86_64 x86_64: Exclude SSE, AVX and FMA4 variants in libm multiarch 2024-04-14 05:41:02 -07:00