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 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);
}


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