threads/103975: Implicit loading/unloading of may crash user processes

Daniel Eischen deischen at
Fri Oct 6 05:50:21 PDT 2006

The following reply was made to PR threads/103975; it has been noted by GNATS.

From: Daniel Eischen <deischen at>
To: Takahiro Kurosawa <takahiro.kurosawa at>
Cc: Alexander Kabaev <kabaev at>, John Baldwin <john at>,
        freebsd-gnats-submit at, freebsd-threads at
Subject: Re: threads/103975: Implicit loading/unloading of may
 crash user processes
Date: Fri, 6 Oct 2006 08:42:19 -0400 (EDT)

 On Fri, 6 Oct 2006, Takahiro Kurosawa wrote:
 > Alexander Kabaev <kabaev at> wrote:
 >> On Thu, 5 Oct 2006 09:06:20 -0400
 >> John Baldwin <john at> wrote:
 >> > > To fix the problem, a function that has __attribute__((destructor))
 >> > > in libpthread should probably be implemented in order to recover
 >> > > the initial state before unloading.
 >> >
 >> > I'm not sure you can recover the state actually, hence why I think
 >> > maybe we should make it so that libpthread doesn't unload once it has
 >> > been loaded.
 > I understand that it's way easier to prohibit unloading of libpthread
 > than to change the code safely unloadable.
 > Thanks for your explanation, John!
 >> Linux does not allow pthread library to be unloaded presumably because
 >> of reasons like this. From readelf -a /compat/linux/lib/
 >>  0x6ffffffb (FLAGS_1)                    Flags: NODELETE INITFIRST
 >> Infortunately, rtld does not implement NODELETE and INITFIRST. Both are
 >> addressed in my patch that I am yet to commit.
 > I'm looking forward to the commit of your patch into the CVS repository :-)
 > Maybe the following line should be added to src/lib/libpthread/Makefile
 > when rtld supports the NODELETE flag? :
 > LDFLAGS+=-Wl,-znodelete
 If that's the knob, then I'd agree.  You also want to make
 the same change to libthr.

More information about the freebsd-threads mailing list