about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/Makefile
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2023-04-27 13:06:15 -0700
committerH.J. Lu <hjl.tools@gmail.com>2023-04-28 13:38:38 -0700
commita443bd3fb233186038b8b483959ecb7978d1abea (patch)
tree53948f90d590b84afe22a42ec49cc2ec2fe0c700 /sysdeps/unix/sysv/linux/Makefile
parenta225cb3ee9a22021312ae25c37595cd9d1995a1f (diff)
downloadglibc-a443bd3fb233186038b8b483959ecb7978d1abea.tar.gz
glibc-a443bd3fb233186038b8b483959ecb7978d1abea.tar.xz
glibc-a443bd3fb233186038b8b483959ecb7978d1abea.zip
__check_pf: Add a cancellation cleanup handler [BZ #20975]
There are reports for hang in __check_pf:

https://github.com/JoeDog/siege/issues/4

It is reproducible only under specific configurations:

1. Large number of cores (>= 64) and large number of threads (> 3X of
the number of cores) with long lived socket connection.
2. Low power (frequency) mode.
3. Power management is enabled.

While holding lock, __check_pf calls make_request which calls __sendto
and __recvmsg.  Since __sendto and __recvmsg are cancellation points,
lock held by __check_pf won't be released and can cause deadlock when
thread cancellation happens in __sendto or __recvmsg.  Add a cancellation
cleanup handler for __check_pf to unlock the lock when cancelled by
another thread.  This fixes BZ #20975 and the siege hang issue.
Diffstat (limited to 'sysdeps/unix/sysv/linux/Makefile')
-rw-r--r--sysdeps/unix/sysv/linux/Makefile2
1 files changed, 2 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index aec7a94785..0160be8790 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -529,6 +529,8 @@ sysdep_headers += \
 sysdep_routines += \
   netlink_assert_response \
   # sysdep_routines
+
+CFLAGS-check_pf.c += -fexceptions
 endif
 
 # Don't compile the ctype glue code, since there is no old non-GNU C library.