]> git.ipfire.org Git - thirdparty/glibc.git/commit
pthread/tst-cancel28: Fix barrier re-init race condition
authorStafford Horne <shorne@gmail.com>
Sat, 25 Sep 2021 08:02:06 +0000 (17:02 +0900)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Tue, 14 Dec 2021 04:37:27 +0000 (10:07 +0530)
commit06865865151579d1aa17d38110060a68b85c5d90
tree2eedae597cc1b7394b16a8ff60c8a77f140821b4
parent1fe4b8d6937139faa47410552d4e21b356810d67
pthread/tst-cancel28: Fix barrier re-init race condition

When running this test on the OpenRISC port I am working on this test
fails with a timeout.  The test passes when being straced or debugged.
Looking at the code there seems to be a race condition in that:

  1 main thread: calls xpthread_cancel
  2 sub thread : receives cancel signal
  3 sub thread : cleanup routine waits on barrier
  4 main thread: re-inits barrier
  5 main thread: waits on barrier

After getting to 5 the main thread and sub thread wait forever as the 2
barriers are no longer the same.

Removing the barrier re-init seems to fix this issue.  Also, the barrier
does not need to be reinitialized as that is done by default.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit 9874ca536b1d0662b1cea46af3ce09a4d42aeb32)
sysdeps/pthread/tst-cancel28.c