On 3/27/23 12:08?AM, Pengfei Xu wrote:
Hi Jens Axboe and kernel experts,
Platform: x86 platforms There is "io_poll_remove_entries" NULL pointer BUG in v6.3-rc4 kernel.
All detailed log: https://github.com/xupengfe/syzkaller_logs/tree/main/230327_041425_io_poll_r... Syzkaller reproduced code: https://github.com/xupengfe/syzkaller_logs/blob/main/230327_041425_io_poll_r... Syzkaller analysis report0: https://github.com/xupengfe/syzkaller_logs/blob/main/230327_041425_io_poll_r... Syzkaller analysis status: https://github.com/xupengfe/syzkaller_logs/blob/main/230327_041425_io_poll_r... v6.3-rc4 issue dmesg: https://github.com/xupengfe/syzkaller_logs/blob/main/230327_041425_io_poll_r... Kconfig: https://github.com/xupengfe/syzkaller_logs/blob/main/230327_041425_io_poll_r... Bisect info: https://github.com/xupengfe/syzkaller_logs/blob/main/230327_041425_io_poll_r...
It could be reproduced in v6.3-rc3 and v6.3-rc4 kernel, and bisected between v6.3-rc3 and v5.11 kernel, bad commit was: " c16bda37594f83147b167d381d54c010024efecf io_uring/poll: allow some retries for poll triggering spuriously " After reverted above commit on top of v6.3-rc3 kernel, this issue was gone.
This should probably fix it, though I do wonder why this can only trigger after that patch. Seems like it would've been possible before too.
diff --git a/io_uring/poll.c b/io_uring/poll.c index 795facbd0e9f..90555a22a900 100644 --- a/io_uring/poll.c +++ b/io_uring/poll.c @@ -600,7 +600,8 @@ static int __io_arm_poll_handler(struct io_kiocb *req, mask = vfs_poll(req->file, &ipt->pt) & poll->events;
if (unlikely(ipt->error || !ipt->nr_entries)) { - io_poll_remove_entries(req); + if (ipt->nr_entries) + io_poll_remove_entries(req);
if (!io_poll_can_finish_inline(req, ipt)) { io_poll_mark_cancelled(req);