Fix comments in _dl_dst_count and _dl_dst_substitute.

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.
This commit is contained in:
Carlos O'Donell 2018-06-12 23:31:02 -04:00
parent 35df5a77f3
commit a745c837cb
2 changed files with 11 additions and 6 deletions

View File

@ -1,5 +1,8 @@
2018-06-12 Carlos O'Donell <carlos@redhat.com> 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 * nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock): Call
lll_futex_timed_wait. lll_futex_timed_wait.

View File

@ -219,11 +219,11 @@ is_dst (const char *input, const char *ref)
return rlen; return rlen;
} }
/* INPUT is the start of a DST sequence at the first '$' occurrence. /* INPUT should be the start of a path e.g DT_RPATH or name e.g.
If there is a DST we call into _dl_dst_count to count the number of DT_NEEDED. The return value is the number of known DSTs found. We
DSTs. We count all known DSTs regardless of __libc_enable_secure; count all known DSTs regardless of __libc_enable_secure; the caller
the caller is responsible for enforcing the security of the is responsible for enforcing the security of the substitution rules
substitution rules (usually _dl_dst_substitute). */ (usually _dl_dst_substitute). */
size_t size_t
_dl_dst_count (const char *input) _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 * $ORIGIN appears as the first path element, and is
the only string in the path or is immediately the only string in the path or is immediately
followed by a path separator and the rest of the followed by a path separator and the rest of the
path. path,
and ...
* The path is rooted in a trusted directory. * The path is rooted in a trusted directory.