diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-11-06 17:25:38 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-11-21 16:15:42 -0300 |
commit | b4cf6cac73725d988957410116ddf088546239ca (patch) | |
tree | cb009ca20109b9150326dc36a05bdb2cbcee237e /elf/tst-tunables.c | |
parent | 11f7e3dd8fed66e0b8740af440cd3151e55a466f (diff) | |
download | glibc-b4cf6cac73725d988957410116ddf088546239ca.tar glibc-b4cf6cac73725d988957410116ddf088546239ca.tar.gz glibc-b4cf6cac73725d988957410116ddf088546239ca.tar.bz2 glibc-b4cf6cac73725d988957410116ddf088546239ca.zip |
elf: Do not process invalid tunable format
Tunable definitions with more than one '=' on are parsed and enabled,
and any subsequent '=' are ignored. It means that tunables in the form
'tunable=tunable=value' or 'tunable=value=value' are handled as
'tunable=value'. These inputs are likely user input errors, which
should not be accepted.
Checked on x86_64-linux-gnu.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'elf/tst-tunables.c')
-rw-r--r-- | elf/tst-tunables.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/elf/tst-tunables.c b/elf/tst-tunables.c index d874b73b68..7fe9907e05 100644 --- a/elf/tst-tunables.c +++ b/elf/tst-tunables.c @@ -161,24 +161,36 @@ static const struct test_t 0, 0, }, - /* The ill-formatted tunable is also skipped. */ + /* If there is a ill-formatted key=value, everything after is also ignored. */ { "glibc.malloc.mmap_threshold=glibc.malloc.mmap_threshold=4096:glibc.malloc.check=2", - 2, + 0, 0, 0, }, - /* For an integer tunable, parse will stop on non number character. */ { "glibc.malloc.check=2=2", - 2, + 0, 0, 0, }, { "glibc.malloc.check=2=2:glibc.malloc.mmap_threshold=4096", + 0, + 0, + 0, + }, + { + "glibc.malloc.check=2=2:glibc.malloc.check=2", + 0, + 0, + 0, + }, + /* Valid tunables set before ill-formatted ones are set. */ + { + "glibc.malloc.check=2:glibc.malloc.mmap_threshold=4096=4096", 2, - 4096, + 0, 0, } }; |