From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111237 invoked by alias); 2 Jun 2015 05:41:44 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 111219 invoked by uid 89); 2 Jun 2015 05:41:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: smtp.gentoo.org Date: Tue, 02 Jun 2015 09:53:00 -0000 From: Mike Frysinger To: Martin Sebor Cc: Florian Weimer , GNU C Library Subject: Re: [PATCH] pthread_once hangs when init routine throws an exception [BZ #18435] Message-ID: <20150602054139.GZ4496@vapier> Mail-Followup-To: Martin Sebor , Florian Weimer , GNU C Library References: <556B7F10.40209@redhat.com> <556C1A22.30504@redhat.com> <556C8062.4010309@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dwbdSPijtzn/UKh9" Content-Disposition: inline In-Reply-To: <556C8062.4010309@redhat.com> X-SW-Source: 2015-06/txt/msg00033.txt.bz2 --dwbdSPijtzn/UKh9 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 2240 On 01 Jun 2015 09:55, Martin Sebor wrote: > On 06/01/2015 02:38 AM, Florian Weimer wrote: > > On 05/31/2015 11:37 PM, Martin Sebor wrote: > >> The C++ 2011 std::call_once function is specified to allow > >> the initialization routine to exit by throwing an exception. > >> Such an execution, termed exceptional, requires call_once to > >> propagate the exception to its caller. A program may contain > >> any number of exceptional executions but only one returning > >> execution (which, if it exists, must be the last execution > >> with the same once flag). > > > > What do you propose as the commit message? >=20 > I usually repeat the ChangeLog entry in my commit messages > (included in the patch) but I'd be happy to add more detail > or change the format if there's a preference one way or the > other. it would be best if your commit message was useful. usually that means you= r=20 e-mail that was sent to the list w/the patch explaining what it was all abo= ut. if you're familiar with the linux kernel git message style, then that ;). > > It's not immediately obvious to me why this change works. :) >=20 > The pthread_cleanup_push and pthread_cleanup_pop macros are > defined in sysdeps/nptl/pthread.h. In C code outside of > glibc compiled with -fexceptions (with __EXCEPTIONS defined), > they make use of GCC attribute cleanup to invoke the cleanup > handler during stack unwinding. (In C++ they make use of > a destructor of a class object.) These macros do the right > thing when an exception is thrown in the code they surround. >=20 > The problem is that the nptl/pthreadP.h header redefines > the macros for internal use by glibc without the use of > the cleanup attribute. As a result, when an exception is > thrown, the cleanup handler is not invoked. This is what > happens in pthread_once.c. >=20 > By removing the macro redefinitions from nptl/pthreadP.h > the change causes pthread_once.c to be compiled with the > more robust macros defined in pthread.h and allows cleanup > to take place even after an exception has been thrown so > long as glibc has been compiled with -fexceptions. they're in there to avoid the PLT right ? so deleting them means the reloc= s=20 come back. can't we get both here ? -mike --dwbdSPijtzn/UKh9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVbUITAAoJEEFjO5/oN/WBoYsQAL3u+PQQKp4eG5ZG4cH74Ii5 CGL/XknEyzI+7IsjXmWwTxSC7x8gnLXHN3PNc8atHFgfivUDdQ1QLTfFpnxr3loT twMOTdZWZauGqYCbEGLoDmKOXyKuWpWetF16p2Efp+8Mpm4HAwXLM2H0bauAa7Lx yKFzUCgZ/xCfpkDt5LOOh35YJoAZkdI2AqSDagIkF+mmIxzcxFKD3wJNMIvYxb+7 Bt5/fiFjoZSFLAn4RQN7gR7Fj4i3RinvlrD2ddMKkzjF9ieNpRsZnLNQoF5izUiq hAFnb7nLGw04ts3yqOCQ+NswskpgAUV1r1QSzIqJ1MqCzJouh3oKQFWq4bOX/rCw qi+Hy3k5WxXnB8iLD4T63hg+BeFi2JEXdwAoNa5rZXwLMNiFBPIFRxQX0LCPS3bg 7Lb+J0qx99ybEoPvMwaL4GeA6l09pEeWfJyYgYbxKy4FYOJzeExo5cWYXIMH3s+u xSimJiUUALq55Gc6yHkvxafXsF3EJjOKc11JrWmMHLRWvIxh7fbw+xvXQ34/APDL sUomRM2vuzyBDCiOv3KywXTByO1AG1jsrW7C5LBN6VvbsdxQnzNkHtw3uRrs+Etg FW1yNF5BWfBKPOrVMWefIZ7XHydVOJBqwP1NcnLJWKTk+lBtniuxp4rZ41+99fiY YP7VPryXZiwhGtQwdcTT =UmHh -----END PGP SIGNATURE----- --dwbdSPijtzn/UKh9--