Pavel Begunkov
ca70f00bed
io_uring: fix cancellation taking mutex while TASK_UNINTERRUPTIBLE
...
do not call blocking ops when !TASK_RUNNING; state=2 set at
[<00000000ced9dbfc>] prepare_to_wait+0x1f4/0x3b0
kernel/sched/wait.c:262
WARNING: CPU: 1 PID: 19888 at kernel/sched/core.c:7853
__might_sleep+0xed/0x100 kernel/sched/core.c:7848
RIP: 0010:__might_sleep+0xed/0x100 kernel/sched/core.c:7848
Call Trace:
__mutex_lock_common+0xc4/0x2ef0 kernel/locking/mutex.c:935
__mutex_lock kernel/locking/mutex.c:1103 [inline]
mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:1118
io_wq_submit_work+0x39a/0x720 fs/io_uring.c:6411
io_run_cancel fs/io-wq.c:856 [inline]
io_wqe_cancel_pending_work fs/io-wq.c:990 [inline]
io_wq_cancel_cb+0x614/0xcb0 fs/io-wq.c:1027
io_uring_cancel_files fs/io_uring.c:8874 [inline]
io_uring_cancel_task_requests fs/io_uring.c:8952 [inline]
__io_uring_files_cancel+0x115d/0x19e0 fs/io_uring.c:9038
io_uring_files_cancel include/linux/io_uring.h:51 [inline]
do_exit+0x2e6/0x2490 kernel/exit.c:780
do_group_exit+0x168/0x2d0 kernel/exit.c:922
get_signal+0x16b5/0x2030 kernel/signal.c:2770
arch_do_signal_or_restart+0x8e/0x6a0 arch/x86/kernel/signal.c:811
handle_signal_work kernel/entry/common.c:147 [inline]
exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
exit_to_user_mode_prepare+0xac/0x1e0 kernel/entry/common.c:201
__syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline]
syscall_exit_to_user_mode+0x48/0x190 kernel/entry/common.c:302
entry_SYSCALL_64_after_hwframe+0x44/0xa9
Rewrite io_uring_cancel_files() to mimic __io_uring_task_cancel()'s
counting scheme, so it does all the heavy work before setting
TASK_UNINTERRUPTIBLE.
Cc: stable@vger.kernel.org # 5.9+
Reported-by: syzbot+f655445043a26a7cfab8@syzkaller.appspotmail.com
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
[axboe: fix inverted task check]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2021-01-26 09:01:49 -07:00
..
2020-12-21 10:28:02 -08:00
2020-10-24 12:26:05 -07:00
2020-10-24 12:26:05 -07:00
2021-01-04 12:25:19 +00:00
2020-12-10 12:42:59 -06:00
2020-09-18 16:45:50 -04:00
2020-12-15 22:46:18 -08:00
2021-01-20 14:15:33 -08:00
2021-01-20 11:33:51 -08:00
2021-01-04 17:31:32 +01:00
2021-01-23 01:28:20 -06:00
2020-05-05 09:22:21 -06:00
2020-11-14 10:22:45 +01:00
2020-09-18 16:45:50 -04:00
2020-12-17 11:18:00 -08:00
2020-10-30 08:37:39 +01:00
2020-11-10 12:14:20 -06:00
2020-08-07 11:33:22 -07:00
2020-11-25 16:55:02 +01:00
2020-09-18 16:45:50 -04:00
2020-12-10 11:07:40 +08:00
2020-12-22 12:31:17 +09:00
2020-12-09 09:39:38 -05:00
2020-11-23 10:36:53 +01:00
2021-01-15 14:54:24 -08:00
2020-12-17 11:18:00 -08:00
2020-09-18 16:45:50 -04:00
2020-06-03 16:27:18 -07:00
2020-12-10 15:33:14 +01:00
2020-12-03 17:04:41 +01:00
2020-10-29 17:22:59 -05:00
2020-10-29 17:22:59 -05:00
2020-12-21 21:42:29 -05:00
2020-09-18 16:45:50 -04:00
2020-08-12 10:57:56 -07:00
2020-12-02 18:28:05 -08:00
2020-10-29 17:22:59 -05:00
2020-12-17 13:30:45 -05:00
2020-12-13 21:57:21 +01:00
2020-11-13 16:03:07 -06:00
2021-01-21 18:30:28 +01:00
2020-12-16 07:57:37 -05:00
2020-09-18 16:45:50 -04:00
2021-01-10 16:29:28 -05:00
2020-12-09 09:38:34 -05:00
2021-01-12 08:54:14 -05:00
2020-12-15 22:46:17 -08:00
2020-06-14 01:57:21 +09:00
2020-12-28 11:58:59 +01:00
2020-12-15 12:13:37 -08:00
2020-12-15 12:13:37 -08:00
2020-09-22 23:39:45 -04:00
2020-12-16 16:14:08 -05:00
2020-12-14 15:26:14 +01:00
2021-01-24 10:34:53 -08:00
2020-12-17 13:22:17 -08:00
2020-09-18 16:45:50 -04:00
2020-09-18 16:45:50 -04:00
2020-12-17 11:00:37 -08:00
2020-10-16 11:11:22 -07:00
2020-11-26 16:57:28 +01:00
2020-10-24 12:26:05 -07:00
2020-10-24 12:26:05 -07:00
2020-10-02 12:02:30 +02:00
2020-09-18 16:45:50 -04:00
2020-12-17 17:46:34 -08:00
2021-01-18 12:06:33 +01:00
2020-10-24 12:26:05 -07:00
2020-09-10 14:03:31 -07:00
2020-10-15 15:11:56 -07:00
2020-12-14 12:18:19 -08:00
2020-12-18 12:50:18 -08:00
2021-01-04 09:06:42 +09:00
2020-12-15 12:53:37 -08:00
2020-06-03 23:16:55 -04:00
2020-05-07 16:55:47 -05:00
2020-10-16 11:11:21 -07:00
2020-12-15 19:29:43 -08:00
2020-06-04 19:18:29 -07:00
2020-08-24 08:49:13 +10:00
2020-06-04 19:18:29 -07:00
2020-06-04 19:18:29 -07:00
2021-01-07 20:57:53 -07:00
2020-12-16 12:57:51 -08:00
2020-05-14 16:44:23 +02:00
2020-10-26 13:46:47 +01:00
2020-12-15 19:29:43 -08:00
2020-10-14 14:54:45 -07:00
2020-12-15 22:46:19 -08:00
2020-12-10 17:33:17 -05:00
2020-10-15 15:03:10 -07:00
2020-04-27 02:07:40 -04:00
2020-11-15 09:49:10 -05:00
2020-12-19 11:18:38 -08:00
2020-12-16 12:10:40 -08:00
2020-11-05 07:44:15 -05:00
2020-10-25 20:02:08 -04:00
2020-12-30 19:36:54 -07:00
2020-04-10 15:36:22 -07:00
2020-08-23 17:36:59 -05:00
2020-10-13 18:38:27 -07:00
2020-07-29 16:14:27 +02:00
2021-01-13 17:26:21 +01:00
2020-08-23 17:36:59 -05:00
2020-08-04 21:02:38 -04:00
2020-12-25 10:54:29 -08:00
2020-12-16 12:57:51 -08:00
2021-01-26 09:01:49 -07:00
2020-12-20 10:47:42 -07:00
2020-12-20 10:47:42 -07:00
2020-07-31 08:16:01 +02:00
2020-08-07 11:33:24 -07:00
2020-06-14 01:57:21 +09:00
2020-10-05 13:37:04 +02:00
2020-12-17 11:18:00 -08:00
2020-12-15 19:29:43 -08:00
2020-10-23 11:33:41 -07:00
2020-08-19 14:14:19 +02:00
2020-06-02 10:59:07 -07:00
2020-12-25 10:54:29 -08:00
2021-01-04 15:31:58 -05:00
2020-05-13 11:41:22 +02:00
2020-12-15 19:29:43 -08:00
2020-12-01 14:53:39 -07:00
2020-04-27 10:37:14 -04:00
2020-12-10 17:33:17 -05:00
2020-06-08 11:04:19 -07:00
2020-12-27 12:00:36 -08:00
2020-10-23 11:33:41 -07:00
2020-07-31 08:16:00 +02:00
2020-12-14 15:26:13 +01:00
2021-01-08 11:06:29 -08:00
2020-11-15 22:12:53 -05:00
2020-08-23 17:36:59 -05:00
2020-10-24 12:40:18 -07:00
2020-09-26 22:55:05 -04:00
2020-12-01 14:53:39 -07:00
2020-12-01 14:53:39 -07:00
2020-06-09 15:40:50 -07:00
2020-12-15 12:13:46 -08:00
2020-07-31 08:16:01 +02:00
2020-12-14 15:26:13 +01:00