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.
61 lines
1.3 KiB
Makefile
61 lines
1.3 KiB
Makefile
ifeq ($(subdir),misc)
|
|
sysdep_headers += \
|
|
sys/asm.h \
|
|
# sysdep_headers
|
|
|
|
tests += \
|
|
tst-hwcap-tunables \
|
|
# tests
|
|
|
|
tst-hwcap-tunables-ARGS = -- $(host-test-program-cmd)
|
|
endif
|
|
|
|
ifeq ($(subdir),elf)
|
|
sysdep-dl-routines += \
|
|
dl-tlsdesc \
|
|
tlsdesc \
|
|
# sysdep-dl-routines
|
|
|
|
gen-as-const-headers += \
|
|
dl-link.sym \
|
|
# gen-as-const-headers
|
|
|
|
CFLAGS-tst-tunables-seal.c += -DTST_SEAL_TUNABLE_NAME=hwcaps
|
|
tst-tunables-seal-TUNABLES += glibc.cpu.hwcaps=-LASX
|
|
endif
|
|
|
|
ifeq ($(subdir),csu)
|
|
gen-as-const-headers += \
|
|
tlsdesc.sym \
|
|
# gen-as-const-headers
|
|
endif
|
|
|
|
ifeq ($(subdir),elf)
|
|
sysdep-dl-routines += \
|
|
dl-get-cpu-features \
|
|
# sysdep-dl-routines
|
|
|
|
# Disable the compiler from using LSX for TLS descriptor tests, or storing into
|
|
# 16B TLS variable may clobber FP/vector registers and prevent us from checking
|
|
# their contents.
|
|
ifeq (yes,$(loongarch-vec-com))
|
|
CFLAGS-tst-gnu2-tls2mod0.c += -mno-lsx
|
|
CFLAGS-tst-gnu2-tls2mod1.c += -mno-lsx
|
|
CFLAGS-tst-gnu2-tls2mod2.c += -mno-lsx
|
|
endif
|
|
endif
|
|
|
|
# LoongArch's assembler also needs to know about PIC as it changes the
|
|
# definition of some assembler macros.
|
|
ASFLAGS-.os += \
|
|
$(pic-ccflag) \
|
|
# ASFLAGS-.os
|
|
|
|
# All the objects in lib*_nonshared.a need to be compiled with medium code
|
|
# model or large applications may fail to link.
|
|
ifeq (yes,$(have-cmodel-medium))
|
|
CFLAGS-.oS += \
|
|
-mcmodel=medium \
|
|
# CFLAGS-.oS
|
|
endif
|