This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.26.9000-1041-g2bd8663


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  2bd86632b7cb97dc9002a23795e140fc880e1987 (commit)
       via  1c36e1e6a5b9b6f9ad1c67f5d43383afb4d80339 (commit)
       via  97f13188c9fbafeaab89146996b3cce1f4952b5e (commit)
      from  48a8f8328122ab8d06b7333cb87be46feeaf7cca (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=2bd86632b7cb97dc9002a23795e140fc880e1987

commit 2bd86632b7cb97dc9002a23795e140fc880e1987
Author: Dmitry V. Levin <ldv@altlinux.org>
Date:   Wed Dec 20 11:27:51 2017 +0000

    elf: remove redundant is_path argument
    
    is_path argument is no longer used and could be safely removed.
    
    * elf/dl-dst.h (DL_DST_COUNT): Remove is_path argument, all callers
    updated.
    * elf/dl-load.c (is_dst, _dl_dst_count, _dl_dst_substitute,
    expand_dynamic_string_token): Likewise.
    * sysdeps/generic/ldsodefs.h (_dl_dst_count, _dl_dst_substitute): Remove
    is_path argument.

diff --git a/ChangeLog b/ChangeLog
index 97aeed5..a1e065e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2017-12-27  Dmitry V. Levin  <ldv@altlinux.org>
 
+	* elf/dl-dst.h (DL_DST_COUNT): Remove is_path argument, all callers
+	updated.
+	* elf/dl-load.c (is_dst, _dl_dst_count, _dl_dst_substitute,
+	expand_dynamic_string_token): Likewise.
+	* sysdeps/generic/ldsodefs.h (_dl_dst_count, _dl_dst_substitute): Remove
+	is_path argument.
+
 	* elf/dl-load.c (is_dst): Remove checks that is_path is set and name
 	contains ':'.
 
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index 622331e..46ceb4a 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -100,7 +100,7 @@ struct list
   ({									      \
     const char *__str = (str);						      \
     const char *__result = __str;					      \
-    size_t __dst_cnt = DL_DST_COUNT (__str, 0);				      \
+    size_t __dst_cnt = DL_DST_COUNT (__str);				      \
 									      \
     if (__dst_cnt != 0)							      \
       {									      \
@@ -114,7 +114,7 @@ DST not allowed in SUID/SGID programs"));				      \
 	__newp = (char *) alloca (DL_DST_REQUIRED (l, __str, strlen (__str),  \
 						   __dst_cnt));		      \
 									      \
-	__result = _dl_dst_substitute (l, __str, __newp, 0);		      \
+	__result = _dl_dst_substitute (l, __str, __newp);		      \
 									      \
 	if (*__result == '\0')						      \
 	  {								      \
diff --git a/elf/dl-dst.h b/elf/dl-dst.h
index a96513d..3d2c667 100644
--- a/elf/dl-dst.h
+++ b/elf/dl-dst.h
@@ -20,13 +20,13 @@
 
 /* Determine the number of DST elements in the name.  Only if IS_PATH is
    nonzero paths are recognized (i.e., multiple, ':' separated filenames).  */
-#define DL_DST_COUNT(name, is_path) \
+#define DL_DST_COUNT(name) \
   ({									      \
     size_t __cnt = 0;							      \
     const char *__sf = strchr (name, '$');				      \
 									      \
     if (__glibc_unlikely (__sf != NULL))				      \
-      __cnt = _dl_dst_count (__sf, is_path);			      \
+      __cnt = _dl_dst_count (__sf);					      \
 									      \
     __cnt; })
 
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 87dfdf8..ae86f0b 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -180,8 +180,7 @@ is_trusted_path_normalize (const char *path, size_t len)
 
 
 static size_t
-is_dst (const char *start, const char *name, const char *str,
-	int is_path, int secure)
+is_dst (const char *start, const char *name, const char *str, int secure)
 {
   size_t len;
   bool is_curly = false;
@@ -219,7 +218,7 @@ is_dst (const char *start, const char *name, const char *str,
 
 
 size_t
-_dl_dst_count (const char *name, int is_path)
+_dl_dst_count (const char *name)
 {
   const char *const start = name;
   size_t cnt = 0;
@@ -231,10 +230,9 @@ _dl_dst_count (const char *name, int is_path)
       /* $ORIGIN is not expanded for SUID/GUID programs (except if it
 	 is $ORIGIN alone) and it must always appear first in path.  */
       ++name;
-      if ((len = is_dst (start, name, "ORIGIN", is_path,
-			 __libc_enable_secure)) != 0
-	  || (len = is_dst (start, name, "PLATFORM", is_path, 0)) != 0
-	  || (len = is_dst (start, name, "LIB", is_path, 0)) != 0)
+      if ((len = is_dst (start, name, "ORIGIN", __libc_enable_secure)) != 0
+	  || (len = is_dst (start, name, "PLATFORM", 0)) != 0
+	  || (len = is_dst (start, name, "LIB", 0)) != 0)
 	++cnt;
 
       name = strchr (name + len, '$');
@@ -246,8 +244,7 @@ _dl_dst_count (const char *name, int is_path)
 
 
 char *
-_dl_dst_substitute (struct link_map *l, const char *name, char *result,
-		    int is_path)
+_dl_dst_substitute (struct link_map *l, const char *name, char *result)
 {
   const char *const start = name;
 
@@ -267,16 +264,15 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
 	  size_t len;
 
 	  ++name;
-	  if ((len = is_dst (start, name, "ORIGIN", is_path,
-			     __libc_enable_secure)) != 0)
+	  if ((len = is_dst (start, name, "ORIGIN", __libc_enable_secure)) != 0)
 	    {
 	      repl = l->l_origin;
 	      check_for_trusted = (__libc_enable_secure
 				   && l->l_type == lt_executable);
 	    }
-	  else if ((len = is_dst (start, name, "PLATFORM", is_path, 0)) != 0)
+	  else if ((len = is_dst (start, name, "PLATFORM", 0)) != 0)
 	    repl = GLRO(dl_platform);
-	  else if ((len = is_dst (start, name, "LIB", is_path, 0)) != 0)
+	  else if ((len = is_dst (start, name, "LIB", 0)) != 0)
 	    repl = DL_DST_LIB;
 
 	  if (repl != NULL && repl != (const char *) -1)
@@ -320,7 +316,7 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
    belonging to the map is loaded.  In this case the path element
    containing $ORIGIN is left out.  */
 static char *
-expand_dynamic_string_token (struct link_map *l, const char *s, int is_path)
+expand_dynamic_string_token (struct link_map *l, const char *s)
 {
   /* We make two runs over the string.  First we determine how large the
      resulting string is and then we copy it over.  Since this is no
@@ -331,7 +327,7 @@ expand_dynamic_string_token (struct link_map *l, const char *s, int is_path)
   char *result;
 
   /* Determine the number of DST elements.  */
-  cnt = DL_DST_COUNT (s, is_path);
+  cnt = DL_DST_COUNT (s);
 
   /* If we do not have to replace anything simply copy the string.  */
   if (__glibc_likely (cnt == 0))
@@ -345,7 +341,7 @@ expand_dynamic_string_token (struct link_map *l, const char *s, int is_path)
   if (result == NULL)
     return NULL;
 
-  return _dl_dst_substitute (l, s, result, is_path);
+  return _dl_dst_substitute (l, s, result);
 }
 
 
@@ -399,7 +395,7 @@ fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
     {
       struct r_search_path_elem *dirp;
 
-      to_free = cp = expand_dynamic_string_token (l, cp, 1);
+      to_free = cp = expand_dynamic_string_token (l, cp);
 
       size_t len = strlen (cp);
 
@@ -2070,7 +2066,7 @@ _dl_map_object (struct link_map *loader, const char *name,
     {
       /* The path may contain dynamic string tokens.  */
       realname = (loader
-		  ? expand_dynamic_string_token (loader, name, 0)
+		  ? expand_dynamic_string_token (loader, name)
 		  : __strdup (name));
       if (realname == NULL)
 	fd = -1;
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 658a4f2..c533b3b 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -1096,11 +1096,11 @@ extern void _dl_nothread_init_static_tls (struct link_map *) attribute_hidden;
 extern const char *_dl_get_origin (void) attribute_hidden;
 
 /* Count DSTs.  */
-extern size_t _dl_dst_count (const char *name, int is_path) attribute_hidden;
+extern size_t _dl_dst_count (const char *name) attribute_hidden;
 
 /* Substitute DST values.  */
 extern char *_dl_dst_substitute (struct link_map *l, const char *name,
-				 char *result, int is_path) attribute_hidden;
+				 char *result) attribute_hidden;
 
 /* Check validity of the caller.  */
 extern int _dl_check_caller (const void *caller, enum allowmask mask)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1c36e1e6a5b9b6f9ad1c67f5d43383afb4d80339

commit 1c36e1e6a5b9b6f9ad1c67f5d43383afb4d80339
Author: Dmitry V. Levin <ldv@altlinux.org>
Date:   Wed Dec 20 11:27:51 2017 +0000

    elf: remove redundant code from is_dst
    
    is_dst is called either by _dl_dst_count or by _dl_dst_substitute.
    _dl_dst_count is called by DL_DST_COUNT only.
    DL_DST_COUNT is called either by expand_dst with is_path == 0
    or by expand_dynamic_string_token.
    _dl_dst_substitute is called either from expand_dst with is_path == 0
    or from expand_dynamic_string_token.
    The latter function is called either from _dl_map_object with is_path == 0
    or from fillin_rpath with is_path == 1 and name containing no ':'.
    
    In any case (is_path && name[i] == ':') is always false and all code
    depending on it can be safely removed.
    
    * elf/dl-load.c (is_dst): Remove checks that is_path is set and name
    contains ':', and all code depending on these checks.

diff --git a/ChangeLog b/ChangeLog
index 297dd70..97aeed5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2017-12-27  Dmitry V. Levin  <ldv@altlinux.org>
 
+	* elf/dl-load.c (is_dst): Remove checks that is_path is set and name
+	contains ':'.
+
 	* elf/dl-load.c (_dl_dst_substitute): Remove checks that is_path
 	is set and name contains ':', and all code depending on these checks.
 
diff --git a/elf/dl-load.c b/elf/dl-load.c
index a60277d..87dfdf8 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -206,14 +206,12 @@ is_dst (const char *start, const char *name, const char *str,
       /* Skip over closing curly brace and adjust for the --name.  */
       len += 2;
     }
-  else if (name[len] != '\0' && name[len] != '/'
-	   && (!is_path || name[len] != ':'))
+  else if (name[len] != '\0' && name[len] != '/')
     return 0;
 
   if (__glibc_unlikely (secure)
-      && ((name[len] != '\0' && name[len] != '/'
-	   && (!is_path || name[len] != ':'))
-	  || (name != start + 1 && (!is_path || name[-2] != ':'))))
+      && ((name[len] != '\0' && name[len] != '/')
+	  || (name != start + 1)))
     return 0;
 
   return len;

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=97f13188c9fbafeaab89146996b3cce1f4952b5e

commit 97f13188c9fbafeaab89146996b3cce1f4952b5e
Author: Dmitry V. Levin <ldv@altlinux.org>
Date:   Tue Dec 19 21:06:23 2017 +0000

    elf: remove redundant code from _dl_dst_substitute
    
    There are just two users of _dl_dst_substitute: one is expand_dst that
    sets is_path argument to 0, another one is expand_dynamic_string_token.
    The latter function also has just two users: one is _dl_map_object that
    sets is_path argument to 0, another one is fillin_rpath that sets
    is_path argument to 1 and name argument contains no ':'.
    
    In any case (is_path && name[i] == ':') is always false and all code
    depending on it can be safely removed.
    
    * elf/dl-load.c (_dl_dst_substitute): Remove checks that is_path
    is set and name contains ':', and all code depending on these checks.

diff --git a/ChangeLog b/ChangeLog
index 086bb81..297dd70 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-12-27  Dmitry V. Levin  <ldv@altlinux.org>
+
+	* elf/dl-load.c (_dl_dst_substitute): Remove checks that is_path
+	is set and name contains ':', and all code depending on these checks.
+
 2017-12-24  Zack Weinberg  <zackw@panix.com>
 
 	* libio/libio.h, libio/_G_config.h: New stub headers which issue a
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 2964464..a60277d 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -291,13 +291,7 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
 	      /* We cannot use this path element, the value of the
 		 replacement is unknown.  */
 	      wp = last_elem;
-	      name += len;
-	      while (*name != '\0' && (!is_path || *name != ':'))
-		++name;
-	      /* Also skip following colon if this is the first rpath
-		 element, but keep an empty element at the end.  */
-	      if (wp == result && is_path && *name == ':' && name[1] != '\0')
-		++name;
+	      break;
 	    }
 	  else
 	    /* No DST we recognize.  */
@@ -306,19 +300,6 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
       else
 	{
 	  *wp++ = *name++;
-	  if (is_path && *name == ':')
-	    {
-	      /* In SUID/SGID programs, after $ORIGIN expansion the
-		 normalized path must be rooted in one of the trusted
-		 directories.  */
-	      if (__glibc_unlikely (check_for_trusted)
-		  && !is_trusted_path_normalize (last_elem, wp - last_elem))
-		wp = last_elem;
-	      else
-		last_elem = wp;
-
-	      check_for_trusted = false;
-	    }
 	}
     }
   while (*name != '\0');

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                  |   15 +++++++++++
 elf/dl-deps.c              |    4 +-
 elf/dl-dst.h               |    4 +-
 elf/dl-load.c              |   61 +++++++++++++-------------------------------
 sysdeps/generic/ldsodefs.h |    4 +-
 5 files changed, 39 insertions(+), 49 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]