]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
For b/3133396, ignore system ld.so.cache when looking for nss and iconv modules.
authorPaul Pluzhnikov <ppluzhnikov@google.com>
Tue, 4 Mar 2014 00:18:01 +0000 (16:18 -0800)
committerPaul Pluzhnikov <ppluzhnikov@google.com>
Tue, 4 Mar 2014 00:18:01 +0000 (16:18 -0800)
README.google
elf/dl-cache.c
elf/dl-load.c
include/dlfcn.h
sysdeps/generic/ldsodefs.h

index dfa4bfd71c8350ed85b0246057f5f1bf343925c7..8710245a5ac4bcf70880e885442dc82eed3754bd 100644 (file)
@@ -177,3 +177,13 @@ sysdeps/generic/unsecvars.h
   Forward-ported from cl/51433387 (from cl/38694-p2, cl/38725-p2, and
   cl/38741-p2).
   (ppluzhnikov, google-local)
+
+elf/dl-cache.c
+elf/dl-load.c
+include/dlfcn.h
+sysdeps/generic/ldsodefs.h
+  For b/3133396, ignore system ld.so.cache when looking for
+  nss and iconv modules.
+  Forward-ported from cl/51433604 (from cl/44863-p2).
+  (ppluzhnikov, google-local)
+
index 34de935000eed3685336240e3ad5d71cb638a4de..c5db4639e616a6f2bd7dabd45964ca532119d33e 100644 (file)
@@ -353,7 +353,7 @@ _dl_alloc_cache_info (const char *const cache_list)
    file name stored there, or null if none is found.  */
 const char *
 internal_function
-_dl_load_cache_lookup (const char *name)
+_dl_load_cache_lookup (const char *name, int mode)
 {
   struct cache_info *info;
 
@@ -362,6 +362,16 @@ _dl_load_cache_lookup (const char *name)
     /* Caches have not been initialized yet.  */
     cache_info = _dl_alloc_cache_info (GLRO(google_ld_so_cache_list));
 
+  if (mode & __RTLD_GOOGLE_IGNORE_HOST_LD_SO_CACHE)
+    {
+      /* We are loading a component of glibc itself (e.g. nss or iconv).
+        Such components must not be loaded from host, only from this
+        glibc compilation (which must always be the first component of
+        the cache list). See b/3133396 */
+
+      return _dl_load_cache_lookup_2 (name, cache_info);
+    }
+
   for (info = cache_info; info->ld_so_cache != NULL; ++info)
     {
       const char *result;
index 1be7a3ca967d2c7d463583bd9f1ced036b3c075a..cf49641dfc9187f692591c5aea38d97bf807384f 100644 (file)
@@ -2229,7 +2229,7 @@ _dl_map_object (struct link_map *loader, const char *name,
        {
          /* Check the list of libraries in the file /etc/ld.so.cache,
             for compatibility with Linux's ldconfig program.  */
-         const char *cached = _dl_load_cache_lookup (name);
+         const char *cached = _dl_load_cache_lookup (name, mode);
 
          if (cached != NULL)
            {
index a67b2e3251e652c94cfcffad69422ff18949c30d..666ee605961816959e71e1c23c15c75b31d39b20 100644 (file)
 #define __RTLD_SECURE  0x04000000 /* Apply additional security checks.  */
 #define __RTLD_NOIFUNC 0x02000000 /* Suppress calling ifunc functions.  */
 
+/* Google-local; use only $prefix/etc/ld.so.cache.
+   See b/3133396 */
+#define __RTLD_GOOGLE_IGNORE_HOST_LD_SO_CACHE  0x01000000
+
 #define __LM_ID_CALLER -2
 
 #ifdef SHARED
@@ -32,7 +36,8 @@ extern char **__libc_argv attribute_hidden;
 /* Now define the internal interfaces.  */
 
 #define __libc_dlopen(name) \
-  __libc_dlopen_mode (name, RTLD_LAZY | __RTLD_DLOPEN)
+  __libc_dlopen_mode (name, RTLD_LAZY | __RTLD_DLOPEN | \
+                           __RTLD_GOOGLE_IGNORE_HOST_LD_SO_CACHE)
 extern void *__libc_dlopen_mode  (const char *__name, int __mode);
 extern void *__libc_dlsym   (void *__map, const char *__name);
 extern int   __libc_dlclose (void *__map);
index 5afa846859759820f35cbe1f26891d22695b7c4b..2cddbf1d74a9c862b728c4074a83a02bdc706673 100644 (file)
@@ -939,7 +939,7 @@ extern const struct r_strlenpair *_dl_important_hwcaps (const char *platform,
 
 /* Look up NAME in ld.so.cache and return the file name stored there,
    or null if none is found.  */
-extern const char *_dl_load_cache_lookup (const char *name)
+extern const char *_dl_load_cache_lookup (const char *name, int mode)
      internal_function;
 
 /* If the system does not support MAP_COPY we cannot leave the file open