[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: dlopen(), atexit() SEGV in NetBSD
On Jul 8, 2009, at 2:03 AM, Channa wrote:
2009/7/8 Thor Lancelot Simon <tls%panix.com@localhost>:
On Wed, Jul 08, 2009 at 01:10:50PM +0530, Channa wrote:
I am facing some issue with atexit handler in NetBSD.
The procedure to reproduce the problem i have explained below:
Because after a dlopened library that calls atexit() the
is dlclosed, an executable can't
access a registered handler in the library and causes SEGV.
Well, of course it does. The documentation is quite clear:
dlclose() unlinks and removes the object referred to by handle
process address space.
Yes but while calling fini functions in the dynamic linker , the
__cxa_finalize is called during that time the atexit() handlers
registered in the library can be called?
Or is there a method to unregister the atexit() handlers registered
There is not.
This is why it is normal to use some sort of session handle when
designing libraries that can be loaded and unloaded instead of library-
internal state that needs to be cleaned up with an exit handler.
int mylib_open (void **handle, args);
int mylib_close (void *handle);
int mylib_funcA(void *handle, .args);
and so on. It can easily be argued that this is a failing in libc
(and I believe it is), but those arguments are pointless: it is the
way things are on all unix-like OS's and does not appear to be
changing any time soon.
Main Index |
Thread Index |