tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Add a hack to deinstall pthread_atexit handlers at dso unload time
On Wed, Feb 08, 2017 at 10:31:53PM +0100, Joerg Sonnenberger wrote:
> On Wed, Feb 08, 2017 at 05:08:49PM +0100, Martin Husemann wrote:
> > I would like to adopt a hack like FreeBSD did here:
> >
> > https://lists.freebsd.org/pipermail/svn-src-head/2010-August/019849.html
> >
> > This allows dynamically loaded shared libraries to install
> > pthread_atexit handlers. Currently there is no way for the lib to
> > deinstall the handler in time, and later fork()s would crash the app.
> >
> > The same behaviour (auto deinstall the handlers) has been implemented
> > in Linux and Solaris as well.
> >
> > I don't like the solution, but now solving it differently sounds painfull
> > as well.
> >
> > What do others think?
>
> The FreeBSD way is not acceptable at all. It violates core assumptions
> for all the ways TLS can be used. The claims are not correct either,
> since pthread_[gs]etspecific can be used correctly from shared
> libraries. The only implementation choice that is somewhat reasonable is
> to just mark the DSO as busy.
Sorry, wrong rant. That was for the TLS destructor problem where similar
crude hacks exist. The FreeBSD "solution" is still wrong. Introducing
__pthread_cxa_finalize or even a public interface for that is fine.
Iterating over all text segments to guess what handlers to remove is
definitely not fine.
Joerg
Home |
Main Index |
Thread Index |
Old Index