From owner-freebsd-threads@FreeBSD.ORG Fri Oct 6 08:49:51 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 5F90B16A407 for ; Fri, 6 Oct 2006 08:49:51 +0000 (UTC) (envelope-from takahiro.kurosawa@gmail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.189]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3189D43D53 for ; Fri, 6 Oct 2006 08:49:49 +0000 (GMT) (envelope-from takahiro.kurosawa@gmail.com) Received: by nf-out-0910.google.com with SMTP id n29so1153575nfc for ; Fri, 06 Oct 2006 01:49:49 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=exefOSKSYh1apI3Gj9eEX0dZGTKsUXR7h/cITkvJI9qKZBQrW59Tsc8cu1+pmXpiez8MjUsJgLMXSU37Ojn5FkJAMQqhmIBU4yqetfRCqH8fJWAKdPv5Fl59r8yZe2GTUOqgFkQ+ZoCaEzuzEyHa3SyJe7Rsvfvkc7V4e1vzWtE= Received: by 10.82.142.9 with SMTP id p9mr163106bud; Fri, 06 Oct 2006 01:49:48 -0700 (PDT) Received: by 10.82.126.17 with HTTP; Fri, 6 Oct 2006 01:49:48 -0700 (PDT) Message-ID: Date: Fri, 6 Oct 2006 17:49:48 +0900 From: "Takahiro Kurosawa" To: "Alexander Kabaev" In-Reply-To: <20061005194756.07580108@kan.dnsalias.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200610041356.k94DuOmj097237@www.freebsd.org> <200610050906.21304.john@baldwin.cx> <20061005194756.07580108@kan.dnsalias.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 List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Oct 2006 08:49:51 -0000 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