[PATCH 2/8] elf: Verify the tunable cache header signature and version

Adhemerval Zanella <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.