This is the mail archive of the glibc-bugs@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]

[Bug dynamic-link/22627] $ORIGIN in $LD_LIBRARY_PATH is substituted twice


https://sourceware.org/bugzilla/show_bug.cgi?id=22627

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
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, release/2.25/master has been updated
       via  26748a28ca36dd0bf8a92e3432cffad3bef43688 (commit)
      from  a8920e694ab23f25435329b2365efa5ca7ac64bd (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 -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=26748a28ca36dd0bf8a92e3432cffad3bef43688

commit 26748a28ca36dd0bf8a92e3432cffad3bef43688
Author: Dmitry V. Levin <ldv@altlinux.org>
Date:   Sun Dec 17 23:49:46 2017 +0000

    elf: do not substitute dst in $LD_LIBRARY_PATH twice [BZ #22627]

    Starting with commit
    glibc-2.18.90-470-g2a939a7e6d81f109d49306bc2e10b4ac9ceed8f9 that
    introduced substitution of dynamic string tokens in fillin_rpath,
    _dl_init_paths invokes _dl_dst_substitute for $LD_LIBRARY_PATH twice:
    the first time it's called directly, the second time the result
    is passed on to fillin_rpath which calls expand_dynamic_string_token
    which in turn calls _dl_dst_substitute, leading to the following
    behaviour:

    $ mkdir -p /tmp/'$ORIGIN' && cd /tmp/'$ORIGIN' &&
      echo 'int main(){}' |gcc -xc - &&
      strace -qq -E LD_LIBRARY_PATH='$ORIGIN' -e /open ./a.out
    open("/tmp//tmp/$ORIGIN/tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1
ENOENT (No such file or directory)
    open("/tmp//tmp/$ORIGIN/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No
such file or directory)
    open("/tmp//tmp/$ORIGIN/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT
(No such file or directory)
    open("/tmp//tmp/$ORIGIN/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No
such file or directory)
    open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
    open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3

    Fix this by removing the direct _dl_dst_substitute invocation.

    * elf/dl-load.c (_dl_init_paths): Remove _dl_dst_substitute preparatory
    code and invocation.

    (cherry picked from commit bb195224acc14724e9fc2dbaa8d0b20b72ace79b)

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

Summary of changes:
 ChangeLog     |    6 ++++++
 NEWS          |    1 +
 elf/dl-load.c |   20 +-------------------
 3 files changed, 8 insertions(+), 19 deletions(-)

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
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, release/2.26/master has been updated
       via  98f244e2456712778d91fcbdf99b1dd78b89c9f6 (commit)
      from  069c3dd05abc91fced6e1e119e425c361ad97644 (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 -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=98f244e2456712778d91fcbdf99b1dd78b89c9f6

commit 98f244e2456712778d91fcbdf99b1dd78b89c9f6
Author: Dmitry V. Levin <ldv@altlinux.org>
Date:   Sun Dec 17 23:49:46 2017 +0000

    elf: do not substitute dst in $LD_LIBRARY_PATH twice [BZ #22627]

    Starting with commit
    glibc-2.18.90-470-g2a939a7e6d81f109d49306bc2e10b4ac9ceed8f9 that
    introduced substitution of dynamic string tokens in fillin_rpath,
    _dl_init_paths invokes _dl_dst_substitute for $LD_LIBRARY_PATH twice:
    the first time it's called directly, the second time the result
    is passed on to fillin_rpath which calls expand_dynamic_string_token
    which in turn calls _dl_dst_substitute, leading to the following
    behaviour:

    $ mkdir -p /tmp/'$ORIGIN' && cd /tmp/'$ORIGIN' &&
      echo 'int main(){}' |gcc -xc - &&
      strace -qq -E LD_LIBRARY_PATH='$ORIGIN' -e /open ./a.out
    open("/tmp//tmp/$ORIGIN/tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1
ENOENT (No such file or directory)
    open("/tmp//tmp/$ORIGIN/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No
such file or directory)
    open("/tmp//tmp/$ORIGIN/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT
(No such file or directory)
    open("/tmp//tmp/$ORIGIN/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No
such file or directory)
    open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
    open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3

    Fix this by removing the direct _dl_dst_substitute invocation.

    * elf/dl-load.c (_dl_init_paths): Remove _dl_dst_substitute preparatory
    code and invocation.

    (cherry picked from commit bb195224acc14724e9fc2dbaa8d0b20b72ace79b)

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

Summary of changes:
 ChangeLog     |    6 ++++++
 NEWS          |    1 +
 elf/dl-load.c |   20 +-------------------
 3 files changed, 8 insertions(+), 19 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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