]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
elf: Restore how vDSO dependency is printed with LD_TRACE_LOADED_OBJECTS (BZ #29539)
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 30 Aug 2022 16:35:52 +0000 (13:35 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 31 Aug 2022 12:10:53 +0000 (09:10 -0300)
The d7703d3176d225d5743b21811d888619eba39e82 changed how vDSO like
dependencies are printed, instead of just the name and address it
follows other libraries mode and prints 'name => path'.

Unfortunately, this broke some ldd consumer that uses the output to
filter out the program's dependencies.  For instance CMake
bundleutilities module [1], where GetPrequirite uses the regex to filter
out 'name => path' [2].

This patch restore the previous way to print just the name and the
mapping address.

Checked on x86_64-linux-gnu.

[1] https://github.com/Kitware/CMake/tree/master/Tests/BundleUtilities
[2] https://github.com/Kitware/CMake/blob/master/Modules/GetPrerequisites.cmake#L733

Reviewed-by: Florian Weimer <fweimer@redhat.com>
(cherry picked from commit 1e903124cec4492463d075c6c061a2a772db77bf)

NEWS
elf/rtld.c

diff --git a/NEWS b/NEWS
index 6d31e5abba13109c38563b2665ce43b17a812269..757ded85e0f7108324c3422c7e73c504ed77e41c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -14,7 +14,7 @@ The following bugs are resolved with this release:
   [29485] Linux: Terminate subprocess on late failure in tst-pidfd
   [29490] alpha: New __brk_call implementation is broken
   [29528] elf: Call __libc_early_init for reused namespaces
-
+  [29539] libc: LD_TRACE_LOADED_OBJECTS changed how vDSO library are
 \f
 Version 2.36
 
index cbbaf4a33196512c92ad4b2f7657a850b411d8b4..3e771a93d83457665d0e143cf6c22ace592ec6ac 100644 (file)
@@ -2122,6 +2122,12 @@ dl_main (const ElfW(Phdr) *phdr,
            if (l->l_faked)
              /* The library was not found.  */
              _dl_printf ("\t%s => not found\n",  l->l_libname->name);
+           else if (strcmp (l->l_libname->name, l->l_name) == 0)
+             /* Print vDSO like libraries without duplicate name.  Some
+                consumers depend of this format.  */
+             _dl_printf ("\t%s (0x%0*Zx)\n", l->l_libname->name,
+                         (int) sizeof l->l_map_start * 2,
+                         (size_t) l->l_map_start);
            else
              _dl_printf ("\t%s => %s (0x%0*Zx)\n",
                          DSO_FILENAME (l->l_libname->name),