Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Nov 2009 16:47:14 -0500
From:      Joe Marcus Clarke <marcus@FreeBSD.org>
To:        Daniel Eischen <eischen@vigrid.com>
Cc:        "threads@freebsd.org" <threads@FreeBSD.org>
Subject:   Re: [PATCH] Add missing pthread_condattr_{init,destroy} stubs to libc
Message-ID:  <1259358434.1608.43.camel@shumai.marcuscom.com>
In-Reply-To: <4AF1E295-0524-4C39-94CD-9A12D574C64D@vigrid.com>
References:  <1259298918.1608.19.camel@shumai.marcuscom.com> <20091127131242.GA2368@deviant.kiev.zoral.com.ua> <1259349248.1608.36.camel@shumai.marcuscom.com> <4AF1E295-0524-4C39-94CD-9A12D574C64D@vigrid.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--=-Gp1ebHz9hS6B46nCQ8z9
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Fri, 2009-11-27 at 16:19 -0500, Daniel Eischen wrote:
> On Nov 27, 2009, at 2:14 PM, Joe Marcus Clarke <marcus@freebsd.org> =20
> wrote:
>=20
> > On Fri, 2009-11-27 at 15:12 +0200, Kostik Belousov wrote:
> >> On Fri, Nov 27, 2009 at 12:15:18AM -0500, Joe Marcus Clarke wrote:
> >>> I would like permission to commit this patch which adds missing
> >>> pthread_condattr_{init,destroy} symbols to libc.  I think I did the
> >>> symbol addition correctly (and it seems to work).  Without this, the
> >>> weak symbols added in the libpthread-stubs port conflict with =20
> >>> those in
> >>> libthr, and applications with use these symbols can crash.
> >>>
> >>> I have temporarily hacked libpthread-stubs to fix this, but I really
> >>> feel these stubs should be added to libc.  I've also copied kib as =20
> >>> he
> >>> has been kind enough to review my work in the past.  Thanks.
> >>>
> >>> http://www.marcuscom.com/downloads/stubs.diff
> >>
> >> It is FBSD_1.2 version that we use for symbols added after HEAD =20
> >> become
> >> CURRENT-9.
> >
> > Done.
>=20
> I don't think the symbols belong in FBSD_1.2.  They already exist in =20
> libthr in a previous namespace.  If you use FBSD_1.2, then you =20
> probably need to bump them in libthr and libc_r, and add compatible =20
> symbols (no problem there since there are no differences) for the =20
> previous versions.

How would this be done?  Would I add an FBSD_1.2 namespace to
pthread.map, or would FBSD_1.1 be sufficient?  How would the
compatibility symbols be defined?

>=20
> Still not sure why libc needs all libpthread stubs.  Shouldn't be =20
> necessary.

Agreed, but the problem comes with the libpthread-stubs port.  This port
was added as a dependency of libxcb (which is used by just about
everything in X).  This port defines weak symbols for
pthread_condattr_destroy and pthread_condattr_init and maps them to a
function that simply returns 0.  The problem is that if a binary is
linked to both this library and -pthread, and that binary calls
pthread_condattr_init(), it can be resolved in libpthread-stubs instead
of libthr.  When this happens, the init isn't done, and any subsequent
usage of the pthread_condattr_t structure results in a segfault.

I'm certainly open to other suggestions for fixing this.

Joe

>=20
> --
> DE
>=20
--=20
Joe Marcus Clarke
FreeBSD GNOME Team      ::      gnome@FreeBSD.org
FreeNode / #freebsd-gnome
http://www.FreeBSD.org/gnome

--=-Gp1ebHz9hS6B46nCQ8z9
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iEYEABECAAYFAksQSOEACgkQb2iPiv4Uz4fn7ACgif4uKqUEAY7xuZfisoZ6988e
f2sAoI4v1mTekST+tos3Rz450ESCUWno
=5bHj
-----END PGP SIGNATURE-----

--=-Gp1ebHz9hS6B46nCQ8z9--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1259358434.1608.43.camel>