public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug dynamic-link/30601] New: ld.so should not use argv[0] as the dynamic linker name
@ 2023-07-01  8:40 fweimer at redhat dot com
  0 siblings, 0 replies; only message in thread
From: fweimer at redhat dot com @ 2023-07-01  8:40 UTC (permalink / raw)
  To: glibc-bugs

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.

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

only message in thread, other threads:[~2023-07-01  8:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-01  8:40 [Bug dynamic-link/30601] New: ld.so should not use argv[0] as the dynamic linker name fweimer at redhat dot com

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).