[Bug dynamic-link/23964] New: ldconfig: file truncated while reading soname for certain libraries

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug dynamic-link/23964] New: ldconfig: file truncated while reading soname for certain libraries

glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=23964

            Bug ID: 23964
           Summary: ldconfig: file truncated while reading soname for
                    certain libraries
           Product: glibc
           Version: 2.28
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: eamonn+srcware at rxd4 dot com
  Target Milestone: ---

Dynamic libraries that have been processed by the popular patchelf utility, are
ignored by ldconfig with a truncation error.

Assuming you have patchelf installed, this can be verified like so:

    ~/tmp % cp /usr/lib/libpcre.so libpcrecool.so
    ~/tmp % patchelf --set-soname libpcrecool.so.1 libpcrecool.so
    ~/tmp % ldconfig -l libpcrecool.so
    ldconfig: file libpcrecool.so is truncated

    ldconfig: No link created since soname could not be found for
libpcrecool.so
    ~/tmp % readelf -d libpcrecool.so|grep SONAME
    0x000000000000000e (SONAME)             Library soname: [libpcrecool.so.1]

This is due to the loadaddr calculation in readelflib.c assuming that the vaddr
which is read from the first STRTAB section in the dynamic segment can be
resolved in the first LOAD segment.
The patchelf utility however changes or adds entries to .dynstr, and then
relocates it to a new LOAD segment at the end of the file.

The vaddr found at the PT_DYNAMIC->(first STRTAB)->d_un.d_ptr should be checked
against each LOAD segment, not just the first one.

All relevant versions up to the current master exhibit this bug.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug dynamic-link/23964] ldconfig: file truncated while reading soname for certain libraries

glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=23964

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com
              Flags|                            |security-

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug dynamic-link/23964] ldconfig: file truncated while reading soname for certain libraries

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=23964

--- Comment #1 from Eamonn Coughlan <eamonn+srcware at rxd4 dot com> ---
Created attachment 11444
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11444&action=edit
Example fix for ldconfig

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug dynamic-link/23964] ldconfig: file truncated while reading soname for certain libraries

Sourceware - glibc-bugs mailing list
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=23964

Mikhail Novosyolov <m.novosyolov at rosalinux dot ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |m.novosyolov at rosalinux dot ru

--- Comment #2 from Mikhail Novosyolov <m.novosyolov at rosalinux dot ru> ---
Created attachment 12446
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12446&action=edit
example ELF file

Thanks for this patch, it solved the problem in glibc 2.24. The problem is also
present in glibc 2.30. But seems that it is no more present in glibc 2.31.

rosa-2016 lib64 # ldconfig -V  |head -n 1
ldconfig (GNU libc) 2.24
rosa-2016 lib64 # ldconfig -l libstdc++-gcc10.so.6.0.28
ldconfig: file libstdc++-gcc10.so.6.0.28 truncated
<...>

user@pay2:/tmp/lib64stdc++-gcc10_6-10-0.20200301.1-rosa2016.1.x86_64/usr/lib64$
LC_ALL=C ldconfig -V | head -n 1
ldconfig (Ubuntu GLIBC 2.30-0ubuntu2.1) 2.30
user@pay2:/tmp/lib64stdc++-gcc10_6-10-0.20200301.1-rosa2016.1.x86_64/usr/lib64$
LC_ALL=C ldconfig -l libstdc++-gcc10.so.6.0.28
/sbin/ldconfig.real: file libstdc++-gcc10.so.6.0.28 is truncated
<...>

[root@rosa-2019 lib64]# ldconfig -V | head -n 1
ldconfig (GNU libc) 2.31
[root@rosa-2019 lib64]# ldconfig -l libstdc++-gcc10.so.6.0.28
[root@rosa-2019 lib64]#

So, this bug probably can be closed.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug dynamic-link/23964] ldconfig: file truncated while reading soname for certain libraries

Sourceware - glibc-bugs mailing list
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=23964

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #3 from Florian Weimer <fweimer at redhat dot com> ---
Bug 25087 fixed patchelf'ed ELF objects according to the mailing list:
https://sourceware.org/pipermail/libc-alpha/2019-October/107378.html

*** This bug has been marked as a duplicate of bug 25087 ***

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