From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28466 invoked by alias); 17 Jul 2012 08:15:19 -0000 Received: (qmail 27987 invoked by uid 22791); 17 Jul 2012 08:15:13 -0000 X-SWARE-Spam-Status: No, hits=-7.6 required=5.0 tests=AWL,BAYES_00,KHOP_PGP_SIGNED,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,TW_OV X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Jul 2012 08:14:58 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1Sr2vm-0003jz-HF from Thomas_Schwinge@mentor.com ; Tue, 17 Jul 2012 01:14:54 -0700 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Tue, 17 Jul 2012 01:14:54 -0700 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.1.289.1; Tue, 17 Jul 2012 09:14:52 +0100 From: Thomas Schwinge To: , CC: Andreas Krebbel , Carlos O'Donell , Carlos O'Donell , Andreas Jaeger Subject: Port maintainers, please check: makecontext with uc_link == NULL In-Reply-To: <50051074.2050203@suse.com> References: <20120710102022.GA5123@bart> <4FFC2AA3.50908@codesourcery.com> <20120712121908.GA6549@bart> <4FFED35B.9010005@mentor.com> <877gu4i0eb.fsf@kepler.schwinge.homeip.net> <5003FA13.2060209@linux.vnet.ibm.com> <877gu3zsof.fsf@schwinge.name> <50051074.2050203@suse.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Tue, 17 Jul 2012 08:15:00 -0000 Message-ID: <871ukaztwr.fsf@schwinge.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2012-07/txt/msg00039.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 5429 Hi! Port maintainers, please check your ports: On Tue, 17 Jul 2012 09:12:52 +0200, Andreas Jaeger wrote: > On 07/16/2012 04:28 PM, Thomas Schwinge wrote: > > On Mon, 16 Jul 2012 13:25:07 +0200, Andreas Krebbel wrote: > >> On 07/16/2012 10:19 AM, Thomas Schwinge wrote: > >>> On Thu, 12 Jul 2012 09:38:35 -0400, Carlos O'Donell wrote: > >>>> On 7/12/2012 8:19 AM, Andreas Krebbel wrote: > >>>>> stdlib/tst-makecontext already calls makecontext with uc_link =3D= =3D NULL > >>>>> but the function invoked in the context does explicitly call exit (= 0). > >>>>> Removing this enables the testcase to cover that problem as well. > >>> > >>>>> * stdlib/tst-makecontext.c: Remove explicit exit call. > >>>> > >>>> Excellent. The testcase changes look good to me and match what > >>>> SuSv2 says about a returning from a context where uc_link is > >>>> zero e.g. "the thread will exit when this context returns." > >>>> > >>>> I'm happy with this, thanks for enhancing the testcase to cover > >>>> the failure scenario. > >>> > >>> I already raised this topic in > >>> : > >>> > >>> | [a bug is only seen] when returning from a context with =C2=BBuc_li= nk =3D=3D > >>> | NULL=C2=AB, which is not exercised in the testsuite. > >>> | > >>> | I first though about simply removing the =C2=BBexit (0)=C2=AB from > >>> | stdlib/tst-makecontext.c:cf (which would then test exactly this cas= e), > >>> | but apparently it is not specified which status value to use for ex= it in > >>> | this case -- libc.info: =C2=BBIf `uc_link' was a null pointer the a= pplication > >>> | terminates in this case.=C2=AB -- so it is not trivial to test for.= (Maybe > >>> | worth specifying? EXIT_SUCCESS (0)?) > >> Ok. Thanks for the pointer. I think everything other than 0 doesn't ma= ke much sense since > >> exiting that way is not caused by any kind of error. > > > > Ack. > > > >> I could check in the testcase change removing the exit and we could ma= ke the back-end > >> maintainers aware of the problem with their target. What do you think? > > > > How about this one? > > > > manual: setcontext: Clarify termination when uc_link is the null pointe= r. > > > > 2012-07-16 Thomas Schwinge > > Andreas Krebbel > > > > * manual/setjmp.texi (setcontext): Clarify normal process > > termination when uc_link is the null pointer. > > * stdlib/tst-makecontext.c (cf): Exercise this: remove explicit > > exit call. > > > > diff --git a/manual/setjmp.texi b/manual/setjmp.texi > > index a5a7ce6..f13ac7b 100644 > > --- a/manual/setjmp.texi > > +++ b/manual/setjmp.texi > > @@ -354,7 +354,8 @@ specified parameters passed. If this function retu= rns execution is > > resumed in the context which was referenced by the @code{uc_link} > > element of the context structure passed to @code{makecontext} at the > > time of the call. If @code{uc_link} was a null pointer the applicati= on > > -terminates in this case. > > +terminates normally with an exit status value of @code{EXIT_SUCCESS} > > +(@pxref{Program Termination}). > > > > Since the context contains information about the stack no two threads > > should use the same context at the same time. The result in most cas= es > > diff --git a/stdlib/tst-makecontext.c b/stdlib/tst-makecontext.c > > index 3185900..eb6e89b 100644 > > --- a/stdlib/tst-makecontext.c > > +++ b/stdlib/tst-makecontext.c > > @@ -35,7 +35,9 @@ cf (int i) > > printf ("i %d thr %d\n", i, thr); > > exit (1); > > } > > - exit (0); > > + > > + /* Since uc_link below has been set to NULL, setcontext is supposed = to > > + terminate the process normally after this function returns. */ > > } Pushed as dc97c227c95dd521594f1eaa472399b9fba03b2a. > > x86_64: makecontext: exit (0) if uc_link is the null pointer. > > > > 2012-07-16 Thomas Schwinge > > > > * sysdeps/unix/sysv/linux/x86_64/__start_context.S > > (__start_context): Preserve zero value for regular exit case. >=20 > Yes, this is fine. Pushed as f7db31703ab2e11b162d4e0e3b4af0c1c971b6cd. > > SH: makecontext: exit (0) if uc_link is the null pointer. > > > > 2012-07-16 Thomas Schwinge > > > > * sysdeps/unix/sysv/linux/sh/makecontext.S (.Lexitcode): Preserve > > zero value for regular exit case. > I suggest the sh maintainer to review this, it looks fine to me, That'd be me ;-) (and Kaz, of course). Pushed as 07cbfc23683827c1b92d0bc62b15a77a48b09a17. > > Further (incomplete) notes for port maintainers have been gives as > > follows: > > > > i386: sysdeps/unix/sysv/linux/i386/makecontext.S:L(exitcode): seem= s OK > > x86_64: sysdeps/unix/sysv/linux/x86_64/__start_context.S: 2: is mi= splaced, should be after the movq %rax, %rdi > > SPARC32: sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S:__star= t_context can't tell > > SPARC64: sysdeps/unix/sysv/linux/sparc/sparc64/makecontext.c:__mak= econtext_ret missing handling completely > > S390-32: sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c:__make= context_ret missing handling completely > > S390-64: sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c:__make= context_ret missing handling completely Gr=C3=BC=C3=9Fe, Thomas --=-=-= Content-Type: application/pgp-signature Content-length: 489 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBAgAGBQJQBR7UAAoJENuKOtuXzphJWGsH/0BPzt4LX6921hUeIlp+KVaE s89H6MhFpf8GFrHy+ZtWRi/rtAU2NFyO8DbUWM0/1eYU5F35G7m4+gfbHLNsgvqg H7x7cqQH7Q9R8G479PskArdlAuTmXKlX8XgaqrMmSdAPmPrxvGPYlIHAa8O6GM2T BMudzbOJGk7EyBbeCOjXc9SDv6Y0rGwSx/TUiJOpttRHt4p4+U1DYjJUjXONHEMG qil3kz/HL3B/9tfuDeIBtdKKSU8CyPkoFtWJfzmWr/Mx7kGx0m2Vw38Mrnl0J+pa b/g+/9pRabG3G51fgMrKt1NKxLesFMao3ruB8oqGmvHPNOYpKteMzNA2J2jkGf8= =QEZu -----END PGP SIGNATURE----- --=-=-=--