public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [COMMITTED] Fix comments in _dl_dst_count and _dl_dst_substitute.
@ 2018-06-13  3:35 Carlos O'Donell
  0 siblings, 0 replies; only message in thread
From: Carlos O'Donell @ 2018-06-13  3:35 UTC (permalink / raw)
  To: GNU C Library, DJ Delorie

DJ Delorie <dj@redhat.com> pointed out some obvious comment mistakes
in the DST changes. Thanks DJ!

---
The comments in _dl_dst_count is adjusted to match what the code does
which is count DSTs from the start of the string. With the removal of
DL_DST_COUNT we no longer accept an input that starts at the first $.

In _dl_dst_substitute we adjust the comment to indicate that both
conditions must be true for the SUID/SGID $ORIGIN exception.
---
 ChangeLog     |  3 +++
 elf/dl-load.c | 14 ++++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f3ba045896..9fbd48d848 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2018-06-12  Carlos O'Donell  <carlos@redhat.com>
 
+	* elf/dl-load (_dl_dst_substitute): Correct comment.
+	(_dl_dst_count): Likewise.
+
 	* nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock): Call
 	lll_futex_timed_wait.
 
diff --git a/elf/dl-load.c b/elf/dl-load.c
index e81601f36d..09185ab68d 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -219,11 +219,11 @@ is_dst (const char *input, const char *ref)
     return rlen;
 }
 
-/* INPUT is the start of a DST sequence at the first '$' occurrence.
-   If there is a DST we call into _dl_dst_count to count the number of
-   DSTs.  We count all known DSTs regardless of __libc_enable_secure;
-   the caller is responsible for enforcing the security of the
-   substitution rules (usually _dl_dst_substitute).  */
+/* INPUT should be the start of a path e.g DT_RPATH or name e.g.
+   DT_NEEDED.  The return value is the number of known DSTs found.  We
+   count all known DSTs regardless of __libc_enable_secure; the caller
+   is responsible for enforcing the security of the substitution rules
+   (usually _dl_dst_substitute).  */
 size_t
 _dl_dst_count (const char *input)
 {
@@ -292,7 +292,9 @@ _dl_dst_substitute (struct link_map *l, const char *input, char *result)
 		   * $ORIGIN appears as the first path element, and is
 		     the only string in the path or is immediately
 		     followed by a path separator and the rest of the
-		     path.
+		     path,
+
+		   and ...
 
 		   * The path is rooted in a trusted directory.
 
-- 
2.14.4

Cheers,
Carlos.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-06-13  3:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-13  3:35 [COMMITTED] Fix comments in _dl_dst_count and _dl_dst_substitute Carlos O'Donell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).