From owner-freebsd-threads@FreeBSD.ORG Fri Oct 6 08:50:28 2006 Return-Path: X-Original-To: freebsd-threads@hub.freebsd.org Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E72DD16A415 for ; Fri, 6 Oct 2006 08:50:28 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 74AFB43D5C for ; Fri, 6 Oct 2006 08:50:27 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k968oQMO084990 for ; Fri, 6 Oct 2006 08:50:26 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k968oQwM084989; Fri, 6 Oct 2006 08:50:26 GMT (envelope-from gnats) Date: Fri, 6 Oct 2006 08:50:26 GMT Message-Id: <200610060850.k968oQwM084989@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: "Takahiro Kurosawa" Cc: Subject: Re: threads/103975: Implicit loading/unloading of libpthread.so may crash user processes X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Takahiro Kurosawa List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Oct 2006 08:50:29 -0000 The following reply was made to PR threads/103975; it has been noted by GNATS. From: "Takahiro Kurosawa" To: "Alexander Kabaev" Cc: "John Baldwin" , freebsd-threads@freebsd.org, freebsd-gnats-submit@freebsd.org Subject: Re: threads/103975: Implicit loading/unloading of libpthread.so may crash user processes Date: Fri, 6 Oct 2006 17:49:48 +0900 Alexander Kabaev wrote: > On Thu, 5 Oct 2006 09:06:20 -0400 > John Baldwin 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/libpthread.so.0: > > 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 Thanks, -- KUROSAWA, Takahiro