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][BZ #11941] Fix spurious assert in dlclose.


On 11/06/2013 08:58 AM, OndÅej BÃlka wrote:
> On Thu, Oct 31, 2013 at 03:36:48PM -0400, Carlos O'Donell wrote:
>> On 10/26/2013 03:37 AM, OndÅej BÃlka wrote:
>>> Hi, in following bug we did represent that destructor was called by reseting
>>> l_init_called to zero. This triggered a assert in dlclose.
>>>
>>> A solution would be add additional l_fini_called flag to represent this
>>> condition.
>>>
>>> 	[BZ #11941]
>>> 	include/link.h (struct link_map): Add l_fini_called.
>>> 	elf/dl-fini.c (_dl_fini): Guard double call by l_fini_called
>>> 	instead of reseting l_init_called.
>>
>> Thanks for fixing this.
>>
>> This looks good to me, but we need a test case before we can check this in.
>>
> I tried to write a self contained testcase but did not succeed.
> A bug report is about pstoedit program so some additional constaints are
> needed.
> 
> I tried following as a closest match to bug description but it works as
> intended.
> 
> #include <unistd.h>
> #include <dlfcn.h>
> struct dl
> {
>   void *handle;
>   dl (void)
>     {
>       handle = dlopen("./x.so", RTLD_NOW);
>     }
>   ~dl (void)
>     {
>       dlclose (handle);
>     }
> };
> 
> dl d;
> 
> int main()
> {
>   char *args[2] = {"/bin/ls", "foo"};
>   execvp ("/bin/ls", args);
> }
> 

Then I think we need to spend more time trying to understand exactly
how the code is wrong and how we trigger it. It should be entirely
possible to trigger such asserts. I know it's hard work, but writing
test cases are really where the rubber hits the road (I just spent
almost a day writing one for the ppc64 opd ifunc failure Azanella
just posted a patch for).

Cheers,
Carlos.


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