diff options
author | Joe Simmons-Talbott <josimmon@redhat.com> | 2024-02-29 19:55:58 +0000 |
---|---|---|
committer | Joe Talbott <joetalbott@gmail.com> | 2024-02-29 19:55:58 +0000 |
commit | 71648e80042658f23965924616fb7db9c2fccff9 (patch) | |
tree | 6f8e71df3792ff126df2b7c74cef072af8a28df7 /elf/dl-tunables.c | |
parent | 9b7091415af47082664717210ac49d51551456ab (diff) | |
download | glibc-71648e80042658f23965924616fb7db9c2fccff9.tar.gz glibc-71648e80042658f23965924616fb7db9c2fccff9.tar.xz glibc-71648e80042658f23965924616fb7db9c2fccff9.zip |
rtld: Add glibc.rtld.enable_secure tunable.
Add a tunable for setting __libc_enable_secure to 1. Do not set __libc_enable_secure to 0 if the tunable is set to 0. Ignore all tunables if glib.rtld.enable_secure is set. One use-case for this addition is to enable testing code paths that depend on __libc_enable_secure being set without the need to use setxid binaries. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'elf/dl-tunables.c')
-rw-r--r-- | elf/dl-tunables.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c index 03e1a68675..d3ccd2ecd4 100644 --- a/elf/dl-tunables.c +++ b/elf/dl-tunables.c @@ -223,6 +223,17 @@ parse_tunables_string (const char *valstring, struct tunable_toset_t *tunables) { tunables[ntunables++] = (struct tunable_toset_t) { cur, value, p - value }; + + /* Ignore tunables if enable_secure is set */ + if (tunable_is_name ("glibc.rtld.enable_secure", name)) + { + tunable_num_t val = (tunable_num_t) _dl_strtoul (value, NULL); + if (val == 1) + { + __libc_enable_secure = 1; + return 0; + } + } break; } } |