about summary refs log tree commit diff
path: root/sysdeps/sh/bits/wordsize.h
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-05-06 13:18:45 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-05-07 14:06:56 -0300
commit71149c2a2e85a8233631cc816030d449f021bb2a (patch)
treed75ecdbf94d2461f1dfeb45b981a96508f8bf28f /sysdeps/sh/bits/wordsize.h
parentf8e462342189525e4605cf233b8f798d1c7f398d (diff)
downloadglibc-71149c2a2e85a8233631cc816030d449f021bb2a.tar.gz
glibc-71149c2a2e85a8233631cc816030d449f021bb2a.tar.xz
glibc-71149c2a2e85a8233631cc816030d449f021bb2a.zip
elf: Only process multiple tunable once (BZ 31686)
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.  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 bcae44ea8536b30a7119c0986ff5692bddacb672)
Diffstat (limited to 'sysdeps/sh/bits/wordsize.h')
0 files changed, 0 insertions, 0 deletions