diff options
| author | Daehyeon Ko <4ncienth@gmail.com> | 2026-08-13 22:38:43 +0900 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-08-31 11:55:48 +0200 |
| commit | 398e3fa789aa5ffddc8689d8cbc7b31e1824130c (patch) | |
| tree | b7c34f7d02bd59f482b8260b5c00b497b91ed3a1 /tools/lib/python/kdoc/python_version.py | |
| parent | 10f2c164ca2feb881dd854fe9b75e7ea286dc320 (diff) | |
aio: prevent eventfd/epoll recursion on poll
aio_poll_wake() can complete a keyed poll request inline while the
provider waitqueue lock is held. If the polled file is an epoll instance
and the AIO result eventfd is watched by that same instance, signaling the
result can feed back into epoll and try to take the provider waitqueue lock
again.
For example, a timerfd wake can follow this path:
timerfd -> ep_poll_callback -> aio_poll_wake -> aio_complete
-> eventfd_signal -> ep_poll_callback -> ep_poll_safewake
The second ep_poll_safewake() recursively acquires ep->poll_wait.lock.
eventfd_signal_allowed() does not prevent this because the wake chain did
not begin in eventfd, so the task's eventfd recursion bit is still clear
when aio_poll_wake() decides to complete inline.
An unprivileged process can construct this graph and make a CPU spin on the
recursive lock. DEBUG_SPINLOCK reports "BUG: spinlock recursion", and
lockdep reports the same epoll waitqueue lock as both held and requested.
Always defer eventfd-backed poll completions through the existing
aio_poll_put_work() path. At this point the request has already been
detached from the waitqueue and active request list, so the work item can
publish the completion after the provider callback releases its lock.
Poll completions without a result eventfd remain inline.
Fixes: e8693bcfa0b4 ("aio: allow direct aio poll comletions for keyed wakeups")
Cc: stable@vger.kernel.org
Signed-off-by: Daehyeon Ko <4ncienth@gmail.com>
Link: https://patch.msgid.link/20260813133843.2933127-1-4ncienth@gmail.com
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
