public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fweimer at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug dynamic-link/30601] New: ld.so should not use argv[0] as the dynamic linker name
Date: Sat, 01 Jul 2023 08:40:12 +0000	[thread overview]
Message-ID: <bug-30601-131@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 30601
           Summary: ld.so should not use argv[0] as the dynamic linker
                    name
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: fweimer at redhat dot com
  Target Milestone: ---
             Flags: security-

Without an explicit loader invocation, the program name (in argv[0]) does not
matter for dynamic linking because it always set to "". But with an explicit
invocation, argv[0] ends up as an alias for the dynamic linker itself:

$ (exec -a libc.so.6 ld.so /usr/bin/cat)
/usr/bin/cat: libc.so.6: version `GLIBC_2.33' not found (required by
/usr/bin/cat)
/usr/bin/cat: libc.so.6: version `GLIBC_2.16' not found (required by
/usr/bin/cat)
/usr/bin/cat: libc.so.6: version `GLIBC_2.3.4' not found (required by
/usr/bin/cat)
/usr/bin/cat: libc.so.6: version `GLIBC_2.27' not found (required by
/usr/bin/cat)

This can be seen by attaching a debugger and inspecting l_name for the loader
map:

$ (exec -a foo ld.so /usr/bin/cat)

$ gdb -p  `pgrep ld.so`
(gdb) print _rtld_global._dl_rtld_map.l_name
$1 = 0x7ffe23a123b6 "foo"

(The pldd command does not work in this context, see bug 30600.)

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

                 reply	other threads:[~2023-07-01  8:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-30601-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).