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

eamonn+srcware at rxd4 dot com sourceware-bugzilla@sourceware.org
Sat Dec 8 19:32:00 GMT 2018


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.


More information about the Glibc-bugs mailing list