This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Skip PT_DYNAMIC segment if its p_filesz == 0 [BZ #22101]


On 09/26/2017 11:26 AM, Adhemerval Zanella wrote:
> On 25/09/2017 18:12, H.J. Lu wrote:
>> On 9/25/17, Zack Weinberg <zackw@panix.com> wrote:
>>> On Mon, Sep 25, 2017 at 8:33 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> ELF object generated with "objcopy --only-keep-debug" has
>>>>
>>>> Type     Offset  VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
>>>> DYNAMIC  0x0+e28 0x0+200e40 0x0+200e40 0x0+    0x0+1a0 RW  0x8
>>>>
>>>> with 0 file size. ld.so should skip such PT_DYNAMIC segments.
>>> Why should ld.so skip such PT_DYNAMIC segments?  It seems like loading
>>> empty segments should be harmless, and ...
>> Not all valid segments can have zero p_filesz.  The valid PT_DYNAMIC  segment
>> should have non-zero p_filesz.
> 
> Should we fix it on objcopy as well to avoid it create such invalid
> segments?
 
No. You want a minimum sized debuginfo object, and that includes removing
things you don't need. The real solution here is as proposed in the bug
which is to mark debuginfo objects with a special ET_* marker and then
adjust the downstream tools to either tread lightly or reject such
pseudo-ELF files (they are effectively a *part* of an ELF file).

-- 
Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]