pthread_atfork() problem on Linux9

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

A brief description of the problem we see on Linux 9 follows:

Please let me know if any of you have seen this problem or know how to
tackle it!


I have a "mylib.so" that calls:

_init()
{
   pthread_atfork(NULL, ParentHdlr, ChildHdlr);
}

_fini()
{
   // do nothing
}


Another executable mytest.c does the following:

main()
{
  void *libHandle = NULL;

  libHandle = dlopen("mylib.so", RTLD_NOW);
  // dlopen() call succeeds so I have not included my error checking code
here
  dlclose(libHandle);
  libHandle = NULL;
  ...
  printf("\n In mytest.c: Before fork \n");

  if ((pid = fork()) < 0)
  {
     printf("Fork failed\n");
  }

  printf("Something after fork\n");
}


Note that the fork() is called after the dlclose()
And mytest.c is NOT linked with mylib.so

The problem is mytest.c causes a SEGMENTATION FAULT on Linux9. Seems to work
fine on Linux 8 and below.

We suspect that the atfork() handler functions registered at _init are lost
And that causes the seg fault before the fork() since it cant find the
handlers anymore as the library has been closed.

Any help is appreciated. Thanks!

         tushar



_______________________________________________
Redhat-devel-list mailing list
Redhat-devel-list@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

[Index of Archives]     [Kernel Newbies]     [Red Hat General]     [Fedora]     [Red Hat Install]     [Linux Kernel Development]     [Yosemite News]

  Powered by Linux