diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-11-06 17:25:39 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-11-21 16:15:42 -0300 |
commit | 680c597e9c363bc74d1495b08f7a0593a80f8921 (patch) | |
tree | 20c33ed76def53a76f9ff8520c043ffed79f4b95 /elf/tst-tunables.c | |
parent | b4cf6cac73725d988957410116ddf088546239ca (diff) | |
download | glibc-680c597e9c363bc74d1495b08f7a0593a80f8921.zip glibc-680c597e9c363bc74d1495b08f7a0593a80f8921.tar.gz glibc-680c597e9c363bc74d1495b08f7a0593a80f8921.tar.bz2 |
elf: Do not parse ill-formatted strings
Instead of ignoring ill-formatted tunable strings, first, check all the
tunable definitions are correct and then set each tunable value. It
means that partially invalid strings, like "key1=value1:key2=key2=value'
or 'key1=value':key2=value2=value2' do not enable 'key1=value1'. It
avoids possible user-defined errors in tunable definitions.
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 | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/elf/tst-tunables.c b/elf/tst-tunables.c index 7fe9907..e1ad44f 100644 --- a/elf/tst-tunables.c +++ b/elf/tst-tunables.c @@ -161,7 +161,7 @@ static const struct test_t 0, 0, }, - /* If there is a ill-formatted key=value, everything after is also ignored. */ + /* Ill-formatted tunables string is not parsed. */ { "glibc.malloc.mmap_threshold=glibc.malloc.mmap_threshold=4096:glibc.malloc.check=2", 0, @@ -186,13 +186,18 @@ static const struct test_t 0, 0, }, - /* Valid tunables set before ill-formatted ones are set. */ { "glibc.malloc.check=2:glibc.malloc.mmap_threshold=4096=4096", - 2, 0, 0, - } + 0, + }, + { + "glibc.malloc.check=2:glibc.malloc.mmap_threshold=4096=4096", + 0, + 0, + 0, + }, }; static int |