]> git.ipfire.org Git - thirdparty/glibc.git/commit
__check_pf: Add a cancellation cleanup handler [BZ #20975]
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 27 Apr 2023 20:06:15 +0000 (13:06 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 23 May 2023 23:06:42 +0000 (16:06 -0700)
commit24302748fcf85023fd64630de241973ec17f2dc1
tree7481b678f2e3c1d4b4bb7c972a036b94bf8dee8e
parent017b9df5ea2694a8dc24b81934b9c5b014040c85
__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.

(cherry picked from commit a443bd3fb233186038b8b483959ecb7978d1abea)
sysdeps/unix/sysv/linux/Makefile
sysdeps/unix/sysv/linux/check_pf.c