This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Skip PT_DYNAMIC segment if its p_filesz == 0 [BZ #22101]
- From: Zack Weinberg <zackw at panix dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 25 Sep 2017 20:54:30 -0400
- Subject: Re: [PATCH] Skip PT_DYNAMIC segment if its p_filesz == 0 [BZ #22101]
- Authentication-results: sourceware.org; auth=none
- References: <20170926003314.GA18765@gmail.com>
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 ...
> + void *h = dlopen ("tst-debug1mod1.so", RTLD_LAZY);
> + if (h != NULL)
> + {
> + puts ("shouldn't load tst-debug1mod1.so");
... the implications of this test are scary: I suspect there is code
out there that will break if dlopen starts returning NULL on
completely empty shared objects.
zw