nptl: Fix tst-cancel7 and tst-cancelx7 pidfile race
authorStafford Horne <shorne@gmail.com>
Sat, 16 Oct 2021 22:41:54 +0000 (07:41 +0900)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 18 Oct 2021 16:30:10 +0000 (13:30 -0300)
commit06acd6d1d6f485f2751dcfec881044938742bc8e
treea739da8d35582d3b6aaaa7c08d67b79ae9b7bf38
parent5118dcac68c4eadfd6304bb33adde63d062dc07f
nptl: Fix tst-cancel7 and tst-cancelx7 pidfile race

The check for waiting for the pidfile to be created looks wrong.  At the
point when ACCESS is run the pid file will always be created and
accessible as it is created during DO_PREPARE.  This means that thread
cancellation may be performed before the pid is written to the pidfile.

This was found to be flaky when testing on my OpenRISC platform.

Fix this by using the semaphore to wait for pidfile pid write
completion.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
nptl/tst-cancel7.c