From owner-freebsd-threads@FreeBSD.ORG Fri Oct 6 12:42:49 2006 Return-Path: X-Original-To: freebsd-threads@freebsd.org Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 54F9516A403; Fri, 6 Oct 2006 12:42:49 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id F37A643DA1; Fri, 6 Oct 2006 12:42:23 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.ntplx.net (8.13.7/8.13.7/NETPLEX) with ESMTP id k96CgJsR029485; Fri, 6 Oct 2006 08:42:19 -0400 (EDT) Date: Fri, 6 Oct 2006 08:42:19 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Takahiro Kurosawa In-Reply-To: Message-ID: References: <200610041356.k94DuOmj097237@www.freebsd.org> <200610050906.21304.john@baldwin.cx> <20061005194756.07580108@kan.dnsalias.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Message whitelisted by DRAC access database, not delayed by milter-greylist-2.0.2 (mail.ntplx.net [204.213.176.10]); Fri, 06 Oct 2006 08:42:19 -0400 (EDT) X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) Cc: John Baldwin , freebsd-gnats-submit@freebsd.org, freebsd-threads@freebsd.org 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: Daniel Eischen List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Oct 2006 12:42:49 -0000 On Fri, 6 Oct 2006, Takahiro Kurosawa wrote: > 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 If that's the knob, then I'd agree. You also want to make the same change to libthr. -- Dan