mirror of
git://sourceware.org/git/glibc.git
synced 2026-09-08 23:58:31 +08:00
A string tunable value usually references the GLIBC_TUNABLES (or alias) environment string, which lives in the environment block the kernel places on the initial stack. That memory is owned by the application, which may overwrite it (e.g. setproctitle), so the reference is only safe while no application code has run (a value coming from the system-wide tunables cache is a copy instead, but the rule is applied uniformly). This patch make the lifetime explicit and enforced without copying the value or allocating any memory by adding __tunable_seal_strings, which drops every string tunable reference once early startup is complete. The seal is applied after the only string tunable consumer and before any code outside of the startup sequence runs. Checked on aarch64-linux-gnu and x86_64-linux-gnu. I also run the elf tests on powerpc64le-linux-gnu, loongarch64-linux-gnuf64, and s390x-linux-gnu.
2 lines
31 B
C
2 lines
31 B
C
#include "tst-tunables-seal.c"
|