From 5920a4a624b1f4db310d1c44997b640e2a4653e5 Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Sat, 29 Jul 2017 00:02:03 -0400 Subject: mutex: Fix robust mutex lock acquire (Bug 21778) 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 loce 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. Tested on x86_64, i686, ppc64, ppc64le, s390x, aarch64, armv7hl. --- nptl/tst-mutex7robust.c | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 nptl/tst-mutex7robust.c (limited to 'nptl/tst-mutex7robust.c') diff --git a/nptl/tst-mutex7robust.c b/nptl/tst-mutex7robust.c new file mode 100644 index 0000000000..8221a61d29 --- /dev/null +++ b/nptl/tst-mutex7robust.c @@ -0,0 +1,7 @@ +/* Bug 21778: Fix oversight in robust mutex lock acquisition. */ +#define TYPE PTHREAD_MUTEX_NORMAL +#define ROBUST PTHREAD_MUTEX_ROBUST +#define DELAY_NSEC 0 +#define ROUNDS 1000 +#define N 32 +#include "tst-mutex7.c" -- cgit 1.4.1