[PATCH] nptl: Fix racy pipe closing in tst-cancel{20,21}

Florian Weimer fweimer@redhat.com
Wed Dec 2 19:00:00 GMT 2015


On 10/14/2015 09:03 PM, Adhemerval Zanella wrote:
> +  /* The pipe closing must be issued after the cancellation handling to avoid
> +     a race condition where the cancellation runs after both pipe ends are
> +     closed.  In this case the read syscall returns EOF and the cancellation
> +     must not act.  */

I find this comment confusing.  What is actually happening during a
spurious failure?  The thread which is supposed to be canceled sees a
failed read from the pipe instead?

In this case, the return value from the read should be checked in a more
stringent fashion.  Or is the read not supposed to return at all?  Then
why have two read calls instead of one?

Florian



More information about the Libc-alpha mailing list