[PATCH] S/390: Fix makecontext with uc_link == NULL

Thomas Schwinge thomas@codesourcery.com
Mon Jul 16 08:19:00 GMT 2012


Hi!

On Thu, 12 Jul 2012 09:38:35 -0400, Carlos O'Donell <carlos_odonell@mentor.com> wrote:
> On 7/12/2012 8:19 AM, Andreas Krebbel wrote:
> >> Do we have a testcase that covers this failure?
> >>
> >> If we don't, could you try to work one up?
> > 
> > stdlib/tst-makecontext already calls makecontext with uc_link == 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
<http://news.gmane.org/find-root.php?message_id=%3C87lijq5h72.fsf@schwinge.name%3E>:

| [a bug is only seen] when returning from a context with »uc_link ==
| NULL«, which is not exercised in the testsuite.
| 
| I first though about simply removing the »exit (0)« from
| stdlib/tst-makecontext.c:cf (which would then test exactly this case),
| but apparently it is not specified which status value to use for exit in
| this case -- libc.info: »If `uc_link' was a null pointer the application
| terminates in this case.« -- so it is not trivial to test for.  (Maybe
| worth specifying?  EXIT_SUCCESS (0)?)

At that time, I also worked on reviewing all glibc ports with respect to
that topic (»exit (0)« if »uc_link == NULL«) -- my notes included:

    S390-32: sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c:__makecontext_ret missing handling completely
    S390-64: sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c:__makecontext_ret missing handling completely

... which you have now fixed -- I'll try to resume reviewing all other
ports.  (And I think I somewhere have a patch for SH already.)

My other notes from that time were:

    i386: sysdeps/unix/sysv/linux/i386/makecontext.S:L(exitcode): seems OK
    x86_64: sysdeps/unix/sysv/linux/x86_64/__start_context.S: 2: is misplaced, should be after the movq %rax, %rdi
    SPARC32: sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S:__start_context can't tell
    SPARC64: sysdeps/unix/sysv/linux/sparc/sparc64/makecontext.c:__makecontext_ret missing handling completely


Grüße,
 Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20120716/f3d95dbf/attachment.sig>


More information about the Libc-alpha mailing list