aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-10-29 15:34:31 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-11-25 10:46:22 -0300
commit74f418b29d1e9463028f2ae4cc2a9c74d39aeaab (patch)
treeafc76155ba0a5384bc6d142742441dc2b27cdc6a /sysdeps
parentb45b1c5ba1df4d0315ffdd00a040ff9bc0597a8d (diff)
downloadglibc-74f418b29d1e9463028f2ae4cc2a9c74d39aeaab.tar
glibc-74f418b29d1e9463028f2ae4cc2a9c74d39aeaab.tar.gz
glibc-74f418b29d1e9463028f2ae4cc2a9c74d39aeaab.tar.bz2
glibc-74f418b29d1e9463028f2ae4cc2a9c74d39aeaab.zip
nptl: Return EINVAL for pthread_mutex_clocklock/PI with CLOCK_MONOTONIC [BZ #26801]
Linux futex FUTEX_LOCK_PI operation only supports CLOCK_REALTIME, so pthread_mutex_clocklock operation with priority aware mutexes may fail depending of the input timeout. Also, it is not possible to convert a CLOCK_MONOTONIC to a CLOCK_REALTIME due the possible wall clock time change which might invalid the requested timeout. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski <lukma@denx.de>
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/pthread/tst-mutex5.c2
-rw-r--r--sysdeps/pthread/tst-mutex9.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/sysdeps/pthread/tst-mutex5.c b/sysdeps/pthread/tst-mutex5.c
index 14490768c3..bfe1a79fa4 100644
--- a/sysdeps/pthread/tst-mutex5.c
+++ b/sysdeps/pthread/tst-mutex5.c
@@ -112,7 +112,9 @@ static int do_test (void)
{
do_test_clock (CLOCK_USE_TIMEDLOCK, "timedlock");
do_test_clock (CLOCK_REALTIME, "clocklock(realtime)");
+#ifndef ENABLE_PI
do_test_clock (CLOCK_MONOTONIC, "clocklock(monotonic)");
+#endif
return 0;
}
diff --git a/sysdeps/pthread/tst-mutex9.c b/sysdeps/pthread/tst-mutex9.c
index 2d7927b7c2..bfc01f8c75 100644
--- a/sysdeps/pthread/tst-mutex9.c
+++ b/sysdeps/pthread/tst-mutex9.c
@@ -133,7 +133,9 @@ do_test (void)
{
do_test_clock (CLOCK_USE_TIMEDLOCK);
do_test_clock (CLOCK_REALTIME);
+#ifndef ENABLE_PI
do_test_clock (CLOCK_MONOTONIC);
+#endif
return 0;
}