[glibc] elf: Verify the tunable cache header signature and version
Adhemerval Zanella via Glibc-cvs <[email protected]> Mon, 13 Jul 2026 16:56:11 +0000 (GMT)
| Newsgroups | gmane.comp.lib.glibc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4e971f555850f856e70ceb05d963baa9e0a455a4 commit 4e971f555850f856e70ceb05d963baa9e0a455a4 Author: Adhemerval Zanella <[email protected]> Date: Mon Jul 6 16:56:27 2026 -0300 elf: Verify the tunable cache header signature and version 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. Reviewed-by: DJ Delorie <[email protected]> Diff: --- elf/dl-cache.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/elf/dl-cache.c b/elf/dl-cache.c index 5d8d3cae90..498196d0aa 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;