This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [patch] Fix BZ #16634 -- assert in ld.so when dlopen("a.out"...) is called repeatedly.
- From: Paul Pluzhnikov <ppluzhnikov at google dot com>
- To: Siddhesh Poyarekar <siddhesh dot poyarekar at gmail dot com>
- Cc: Siddhesh Poyarekar <siddhesh at redhat dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Sun, 23 Mar 2014 09:55:02 -0700
- Subject: Re: [patch] Fix BZ #16634 -- assert in ld.so when dlopen("a.out"...) is called repeatedly.
- Authentication-results: sourceware.org; auth=none
- References: <ye6qpplo78g2 dot fsf at elbrus2 dot mtv dot corp dot google dot com> <20140316105130 dot GJ1850 at spoyarek dot pnq dot redhat dot com> <CALoOobOt4q05ht82tWw3P=+TgR5sp3HW=DFpJC57O9knXzO6iQ at mail dot gmail dot com> <CAAHN_R3ix78oNgh=eQNcG51jbC3g5fjZ89=_qKivhdBGzO5aGw at mail dot gmail dot com>
On Fri, Mar 21, 2014 at 10:47 PM, Siddhesh Poyarekar
<siddhesh.poyarekar@gmail.com> wrote:
>> 2014-03-21 Paul Pluzhnikov <ppluzhnikov@google.com>
>>
>> [BZ #16634]
>> * elf/dl-load.c (open_verify): Add mode parameter.
>> Error early when ET_EXEC and mode does not have __RTLD_OPENEXEC.
>> (open_path): Change from boolean 'secure' to complete flag 'mode'
>> (_dl_map_object): Adjust.
>
> The patch looks OK to me, but (I'm sorry it didn't occur to me in my
> initial review) shouldn't there be a test case for this? I think you
> could adapt the reproducer in the bz into a test case.
As mentioned in bugzilla, the bug doesn't show up when invoked via
./elf/ld.so --library-path ... pr16634
and only shows up if the binary is linked with
gcc -pthread -ldl -Wl,-rpath=.:nptl/l:dlfcn,--dynamic-linker=elf/ld.so
I've spent some time tracing through ld.so to understand why that is.
In the former case, _dl_map_object_from_fd (which is where the assert
fires) does not get invoked.
It looks like there is some way to link the test with
--dynamic-linker; I'll look some more into creating a reproducer.
> Also, please try to always post the patch inline like you did
> originally
That is unfortunately impossible with GMail :-(
--
Paul Pluzhnikov