[PATCH 2/8] elf: Verify the tunable cache header signature and version
Adhemerval Zanella
adhemerval.zanella@linaro.org
Mon Jul 6 21:14:38 GMT 2026
The tunable header signature and version are written by ldconfig but
never checked them on read, so the version field was inert. Reject
the section unless both match.
Checked on x86_64-linux-gnu and i686-linux-gnu.
---
elf/dl-cache.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/elf/dl-cache.c b/elf/dl-cache.c
index 5d8d3cae908..498196d0aa3 100644
--- a/elf/dl-cache.c
+++ b/elf/dl-cache.c
@@ -642,6 +642,11 @@ _dl_load_cache_tunables (const char **data)
thc = (struct tunable_header_cached *)
ext.sections[cache_extension_tag_tunables].base;
+
+ /* Reject data produced by a different tunable cache format. */
+ if (thc->signature != TUNCONF_SIGNATURE || thc->version != TUNCONF_VERSION)
+ return NULL;
+
tec = thc->tunables;
count = thc->num_tunables;
--
2.43.0
More information about the Libc-alpha
mailing list