glibc/sysdeps
Adhemerval Zanella bcae44ea85 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>
2024-05-07 12:16:36 -03:00
..
aarch64 elf: Only process multiple tunable once (BZ 31686) 2024-05-07 12:16:36 -03:00
alpha string: Use builtins for ffs and ffsll 2024-02-01 09:31:33 -03:00
arc login: Check default sizes of structs utmp, utmpx, lastlog 2024-04-19 14:38:17 +02:00
arm login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-04-19 14:38:17 +02:00
csky login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-04-19 14:38:17 +02:00
generic login: Check default sizes of structs utmp, utmpx, lastlog 2024-04-19 14:38:17 +02:00
gnu login: Use unsigned 32-bit types for seconds-since-epoch 2024-04-19 14:38:17 +02:00
hppa login: Check default sizes of structs utmp, utmpx, lastlog 2024-04-19 14:38:17 +02:00
htl htl: Implement some support for TLS_DTV_AT_TP 2024-03-23 23:00:30 +01:00
hurd hurd: Move internal functions to internal header 2024-03-23 22:43:07 +01:00
i386 i686: Fix multiple definitions of __memmove_chk and __memset_chk 2024-05-02 11:51:10 +01:00
ieee754 Rename c2x / gnu2x tests to c23 / gnu23 2024-02-01 17:55:57 +00:00
loongarch LoongArch: Add glibc.cpu.hwcap support. 2024-04-24 18:22:38 +08:00
m68k login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-04-19 14:38:17 +02:00
mach htl: Implement some support for TLS_DTV_AT_TP 2024-03-23 23:00:30 +01:00
microblaze login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-04-19 14:38:17 +02:00
mips login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-04-19 14:38:17 +02:00
nios2 login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-04-19 14:38:17 +02:00
nptl Always define __USE_TIME_BITS64 when 64 bit time_t is used 2024-04-02 15:28:36 -03:00
or1k or1k: Add hard float support 2024-05-03 18:28:18 +01:00
posix posix: Sync tempname with gnulib 2024-04-10 14:53:39 -03:00
powerpc powerpc: Optimized strncmp for power10 2024-05-06 09:01:29 -05:00
pthread Add crt1-2.0.o for glibc 2.0 compatibility tests 2024-05-06 07:49:40 -07:00
riscv login: Check default sizes of structs utmp, utmpx, lastlog 2024-04-19 14:38:17 +02:00
s390 s390: Improve static-pie configure tests 2024-02-28 10:09:53 -03:00
sh login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-04-19 14:38:17 +02:00
sparc elf: Only process multiple tunable once (BZ 31686) 2024-05-07 12:16:36 -03:00
unix or1k: Add hard float support 2024-05-03 18:28:18 +01: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 x86: In ld.so, diagnose missing APX support in APX-only builds 2024-04-25 17:20:28 +02:00
x86_64 Revert "x86_64: Suppress false positive valgrind error" 2024-04-13 17:42:13 +02:00