[PATCH] [BZ #21778] Fix oversight in robust mutex lock acquisition.
Torvald Riegel
triegel@redhat.com
Wed Jul 26 00:27:00 GMT 2017
65810f0ef05e8c9e333f17a44e77808b163ca298 fixed a robust mutex bug but
introduced BZ 21778: if the CAS used to try to acquire a lock fails, the
expected value is not updated, which breaks other cases in the lock
acquisition loop. The fix is to simply update the expected value with
the value returned by the CAS, which ensures that behavior is as if the
first case with the CAS never happened (if the CAS fails).
This is a regression introduced in the last release, so it would be good
to get this included in this release. I'll likely be AFK on Thursday,
so please just commit this once it has been approved. Tested on
x86_64-linux.
[BZ 21778]
* nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock): Update
oldval if the CAS fails.
* nptl/pthread_mutex_lock.c (__pthread_mutex_lock_full): Likewise.
* nptl/tst-mutex7.c (ROBUST, DELAY_NSEC, ROUNDS, N): New.
(tf, do_test): Use them.
* nptl/tst-mutex7robust.c: New file.
* nptl/Makefile (tests): Add new test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: robust-mutex-21778.patch
Type: text/x-patch
Size: 4846 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20170726/a0e305f3/attachment.bin>
More information about the Libc-alpha
mailing list