about summary refs log tree commit diff
path: root/nptl/sem_waitcommon.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-11-26 10:54:04 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-11-27 09:59:13 -0300
commitaa69f19a937b679816ef10e8620ea1141bb1734b (patch)
treefda886e3c6899912d8ebb5e65ace4710075bbc0f /nptl/sem_waitcommon.c
parent71eeae0325a95f5e5d7ec4a27a6a6c357e0c8ef4 (diff)
downloadglibc-aa69f19a937b679816ef10e8620ea1141bb1734b.tar.gz
glibc-aa69f19a937b679816ef10e8620ea1141bb1734b.tar.xz
glibc-aa69f19a937b679816ef10e8620ea1141bb1734b.zip
nptl: Add EOVERFLOW checks for futex calls
Some futex-internal calls require additional check for EOVERFLOW (as
indicated by [1] [2] [3]).  For both mutex and rwlock code, EOVERFLOW is
handle as ETIMEDOUT; since it indicate to the caller that the blocking
operation could not be issued.

For mutex it avoids a possible issue where PTHREAD_MUTEX_ROBUST_* might
assume EOVERFLOW indicate futex has succeed, and for PTHREAD_MUTEX_PP_*
it avoid a potential busy infinite loop.  For rwlock and semaphores, it
also avoids potential busy infinite loops.

Checked on x86_64-linux-gnu and i686-linux-gnu, although EOVERFLOW
won't be possible with current usage (since all timeouts on 32-bit
architectures with 32-bit time_t support will be in the range of
32-bit time_t).

[1] https://sourceware.org/pipermail/libc-alpha/2020-November/120079.html
[2] https://sourceware.org/pipermail/libc-alpha/2020-November/120080.html
[3] https://sourceware.org/pipermail/libc-alpha/2020-November/120127.html
Diffstat (limited to 'nptl/sem_waitcommon.c')
-rw-r--r--nptl/sem_waitcommon.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/nptl/sem_waitcommon.c b/nptl/sem_waitcommon.c
index 6dd4eb97cb..0ac1f139bd 100644
--- a/nptl/sem_waitcommon.c
+++ b/nptl/sem_waitcommon.c
@@ -191,7 +191,7 @@ __new_sem_wait_slow64 (struct new_sem *sem, clockid_t clockid,
 	     documentation.  Before Linux 2.6.22, EINTR was also returned on
 	     spurious wake-ups; we only support more recent Linux versions,
 	     so do not need to consider this here.)  */
-	  if (err == ETIMEDOUT || err == EINTR)
+	  if (err == ETIMEDOUT || err == EINTR || err == EOVERFLOW)
 	    {
 	      __set_errno (err);
 	      err = -1;