From owner-freebsd-threads@FreeBSD.ORG Sun Apr 17 23:22:27 2011 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0078E1065673; Sun, 17 Apr 2011 23:22:27 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 6DCE08FC14; Sun, 17 Apr 2011 23:22:26 +0000 (UTC) Received: by vws18 with SMTP id 18so4067190vws.13 for ; Sun, 17 Apr 2011 16:22:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:in-reply-to :references:x-mailer:mime-version:content-type; bh=/R20/6IpQBNTb1NhS8o97alWsvXPGA10n7sVlJgjSEo=; b=wT7pm+VrVubl+sydBP2jo3b9wHz0h+E59Cfnva2qvOlD5Lza7m5iGerApwrV6KJKGo ZtWEj+vdm6GUdrqj3Qqy98wsFCevPw1xcoydl+zk/45jpfFrEUrahwjvZtSlMSjmxouQ lLQrNU3iLXZZikmCjGqn6rpIDrV/MjFZ0781g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; b=sv4cLnf8TOd2pxTos6gEO08GCjUykDM6+xZtXXy0wQ6EcjD3+kamE+F+uF4mR1U4Tq iST/D0Pm5Px9AUtimrtKhoBfl6bakGxH1RzTLCTC9/J7BGLYRyxj/9NNecO3rD9iv8Yk M36k2FeJviE+1IrG0IVPCLLKJQdkeczN+6FgU= Received: by 10.52.173.168 with SMTP id bl8mr2078721vdc.106.1303081094508; Sun, 17 Apr 2011 15:58:14 -0700 (PDT) Received: from kan.dnsalias.net (c-24-63-226-98.hsd1.ma.comcast.net [24.63.226.98]) by mx.google.com with ESMTPS id h23sm3000284vbz.21.2011.04.17.15.58.12 (version=SSLv3 cipher=OTHER); Sun, 17 Apr 2011 15:58:13 -0700 (PDT) Date: Sun, 17 Apr 2011 18:58:07 -0400 From: Alexander Kabaev To: Andriy Gapon Message-ID: <20110417185807.1a06347a@kan.dnsalias.net> In-Reply-To: <4DAAFBAF.90700@FreeBSD.org> References: <4DA98197.8060104@FreeBSD.org> <4DAAFBAF.90700@FreeBSD.org> X-Mailer: Claws Mail 3.7.8 (GTK+ 2.22.1; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/4RPTx2z_gCy3dk77ArUp3nn"; protocol="application/pgp-signature" Cc: hackers@FreeBSD.org, freebsd-threads@FreeBSD.org Subject: Re: puzzled: fork +libthr 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: Sun, 17 Apr 2011 23:22:27 -0000 --Sig_/4RPTx2z_gCy3dk77ArUp3nn Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sun, 17 Apr 2011 17:39:43 +0300 Andriy Gapon wrote: > on 16/04/2011 14:46 Andriy Gapon said the following: > > The second puzzle is the EPERM return value itself, on stable/8. > > From what I seem chromium does a bunch of forks before it gets to > > the place of interest. My debugging shows that those forks are > > "single-threaded" (i.e. code in thr_fork.c is not called). And > > then in a process/thread that makes that pthread_cond_wait call I > > see that libthr and kernel have different opinions about what > > current TID is. Userland part uses what is actually a kernel TID > > of its parent thread (the one that called fork). And given how the > > work is divided between userland and kernel in libthr, that > > mismatch leads to serious consequences. > >=20 > > So my question is why libthr doesn't see its actual TID. Maybe some > > initialization code is not invoked. BTW, chromium is linked to > > both libc and libthr (per ldd). But it seems that there are no > > pthread calls up the fork chain until that pthread_cond_wait call. >=20 > The second problem seems to be caused by chrome binary being linked > to libc and libthr in "incorrect order", libc comes before libthr in > ldd output. My debugging shows that fork is resolved from libc, not > from libthr. Not sure what to blame here: > - build toolchain for putting libc before libthr > - rtld for not preferring libthr over libc > - libc/libthr for being split into two pieces in the current way Why rtld would make any special allowances for libthr?! It does exactly what it is told to do, just as it should. --=20 Alexander Kabaev --Sig_/4RPTx2z_gCy3dk77ArUp3nn Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) iD8DBQFNq3CDQ6z1jMm+XZYRAgN6AJ4yIEHX69BJmHGpR7RbyLQWOSbPcQCgwpdw A00+NB4c9I0kDFp3IBWiSTQ= =5L07 -----END PGP SIGNATURE----- --Sig_/4RPTx2z_gCy3dk77ArUp3nn--