io_uring: do not double call_rcu with eventfd
PATCH 1/1 io_uring: do not double call_rcu with eventfd
It is not allowed to use call_rcu twice with the same rcu head. This could have happened with multiple signals occurring concurrently.
Instead keep track of ops in a bitset and only queue up the call if it is not already queued up.
The refcounting is still required since as far as I can tell there is otherwise no protection from a call to io_eventfd_ops being started and before it completes another call being started.
---
Note I did not put a hash in the Fixes tag as it has not yet been merged. You could also just merge it into that commit if you like.
Dylan
include/linux/io_uring_types.h | 1 + io_uring/io_uring.c | 41 +++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 18 deletions(-)
include/linux/io_uring_types.h +1 -0
@@ -185,6 +185,7 @@ struct io_ev_fd { unsigned int eventfd_async: 1;struct rcu_head rcu;atomic_t refs; +atomic_t ops; };struct io_alloc_cache {
io_uring/io_uring.c +23 -18
78 lines not on this page · raw message
base-commit: 32bde07ca566822d14f5faadcce86629d89b072b
Signature · 1 line
2.30.2
Jens Axboe
maintainerQuoted 10 lines · Dylan Yudaken
It is not allowed to use
call_rcutwice with the same rcu head. This could have happened with multiple signals occurring concurrently.Instead keep track of ops in a bitset and only queue up the call if it is not already queued up.
The refcounting is still required since as far as I can tell there is otherwise no protection from a call to
io_eventfd_opsbeing started and before it completes another call being started.
Quoted 6 lines
Fixes "io_uring: signal registered eventfd to process deferred task work"Signed-off-by Dylan Yudaken <[email protected]>---
Note I did not put a hash in the Fixes tag as it has not yet been merged. You could also just merge it into that commit if you like.
I folded it into that commit, thanks!
Signature · 1 line
Jens Axboe