glibc/sysdeps/sparc
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
..
bits
fpu sparc: Force calculation that raises exception 2024-01-18 08:27:44 -03:00
nptl
sparc32 login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-05-02 13:20:27 +02:00
sparc64 elf: Only process multiple tunable once (BZ 31686) 2024-05-07 14:06:56 -03:00
sys
abort-instr.h
atomic-machine.h
backtrace.c
configure
configure.ac
cpu_relax.c
crti.S
crtn.S
dl-dtprocnum.h
dl-lookupcfg.h
dl-procinfo.c
dl-procinfo.h
dl-tls.h
elf-initfini.h
gccframe.h
ldsodefs.h
machine-gmon.h
Makefile
mempcpy.S
preconfigure
sparc-ifunc.h
sparc-mcount.S
stackinfo.h
Subdirs
sysdep.h sparc: Remove unwind information from signal return stubs [BZ #31244] 2024-01-18 08:27:44 -03:00
unwind-arch.h
utmp-size.h login: Check default sizes of structs utmp, utmpx, lastlog 2024-05-02 13:20:27 +02:00