summaryrefslogtreecommitdiff
path: root/include/linux/workqueue_api.h
diff options
context:
space:
mode:
authorMani Tofigh <mt4022@columbia.edu>2026-11-03 13:19:01 -0500
committerChristian Brauner <brauner@kernel.org>2026-11-05 18:22:01 +0100
commit9f4413e522faed76f4cf610098b2369eb3ba1f1c (patch)
tree678a4249608a23417fed65968bb952203ab946b6 /include/linux/workqueue_api.h
parent925d238324c79bcb75ad0add1d1b9d31d5f48115 (diff)
eventpoll: wake the next waiter when a woken waiter is killed
Processes sharing an epoll instance can sleep forever while an event is ready. An event wakes only one waiter, which then wakes the next one in ep_done_scan() if events are still ready. Since commit c257a340ede0 ("fs, epoll: short circuit fetching events if thread has been killed"), ep_send_events() returns before the scan when the waiter has a fatal signal. If the woken waiter is killed before it runs, nobody wakes the next one: Task A Task B Task C epoll_wait(ep, -1) epoll_wait(ep, -1) write(efd) /* wakes A only */ kill(A, SIGKILL) ep_send_events() return -EINTR /* skips ep_done_scan() */ /* still asleep */ B then sleeps until another file on the instance becomes ready, if ever. This can hit eg a pre-fork server whose worker gets OOM killed. Commit 7fab29e35630 ("fs/epoll: restore waking from ep_done_scan()") fixed the same kind of hang when the wakeup in ep_done_scan() was removed. Keep the early return so that a dying task still doesn't take events nobody will see, but wake the next waiter there if events are ready, as ep_done_scan() would have. With the fix, B gets the event. This bug was identified and confirmed with the help of a deterministic hypervisor currently under development. The C reproducer below however hits it within about 2s. Fixes: c257a340ede0 ("fs, epoll: short circuit fetching events if thread has been killed") Cc: stable@vger.kernel.org Signed-off-by: Mani Tofigh <mt4022@columbia.edu> Link: https://patch.msgid.link/20261103-epoll-killed-waiter-v1-1-36e08c16b8a2@columbia.edu Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'include/linux/workqueue_api.h')
0 files changed, 0 insertions, 0 deletions