Xiaoguang Wang
d7e10d4769
io_uring: don't modify identity's files uncess identity is cowed
...
Abaci Robot reported following panic:
BUG: kernel NULL pointer dereference, address: 0000000000000000
PGD 800000010ef3f067 P4D 800000010ef3f067 PUD 10d9df067 PMD 0
Oops: 0002 [#1 ] SMP PTI
CPU: 0 PID: 1869 Comm: io_wqe_worker-0 Not tainted 5.11.0-rc3+ #1
Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011
RIP: 0010:put_files_struct+0x1b/0x120
Code: 24 18 c7 00 f4 ff ff ff e9 4d fd ff ff 66 90 0f 1f 44 00 00 41 57 41 56 49 89 fe 41 55 41 54 55 53 48 83 ec 08 e8 b5 6b db ff 41 ff 0e 74 13 48 83 c4 08 5b 5d 41 5c 41 5d 41 5e 41 5f e9 9c
RSP: 0000:ffffc90002147d48 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff88810d9a5300 RCX: 0000000000000000
RDX: ffff88810d87c280 RSI: ffffffff8144ba6b RDI: 0000000000000000
RBP: 0000000000000080 R08: 0000000000000001 R09: ffffffff81431500
R10: ffff8881001be000 R11: 0000000000000000 R12: ffff88810ac2f800
R13: ffff88810af38a00 R14: 0000000000000000 R15: ffff8881057130c0
FS: 0000000000000000(0000) GS:ffff88813bc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 000000010dbaa002 CR4: 00000000003706f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
__io_clean_op+0x10c/0x2a0
io_dismantle_req+0x3c7/0x600
__io_free_req+0x34/0x280
io_put_req+0x63/0xb0
io_worker_handle_work+0x60e/0x830
? io_wqe_worker+0x135/0x520
io_wqe_worker+0x158/0x520
? __kthread_parkme+0x96/0xc0
? io_worker_handle_work+0x830/0x830
kthread+0x134/0x180
? kthread_create_worker_on_cpu+0x90/0x90
ret_from_fork+0x1f/0x30
Modules linked in:
CR2: 0000000000000000
---[ end trace c358ca86af95b1e7 ]---
I guess case below can trigger above panic: there're two threads which
operates different io_uring ctxs and share same sqthread identity, and
later one thread exits, io_uring_cancel_task_requests() will clear
task->io_uring->identity->files to be NULL in sqpoll mode, then another
ctx that uses same identity will panic.
Indeed we don't need to clear task->io_uring->identity->files here,
io_grab_identity() should handle identity->files changes well, if
task->io_uring->identity->files is not equal to current->files,
io_cow_identity() should handle this changes well.
Cc: stable@vger.kernel.org # 5.5+
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2021-02-04 07:43:21 -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-02-04 07:43:21 -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