Re: [Syzkaller & bisect] There is "io_poll_remove_entries" NULL pointer BUG in v6.3-rc4 kernel
From: Pengfei Xu
Date: Mon Mar 27 2023 - 22:46:46 EST
Hi Jens Axboe,
On 2023-03-27 at 07:35:59 -0600, Jens Axboe wrote:
> 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_remove_entries
> > Syzkaller reproduced code: https://github.com/xupengfe/syzkaller_logs/blob/main/230327_041425_io_poll_remove_entries/repro.c
> > Syzkaller analysis report0: https://github.com/xupengfe/syzkaller_logs/blob/main/230327_041425_io_poll_remove_entries/report0
> > Syzkaller analysis status: https://github.com/xupengfe/syzkaller_logs/blob/main/230327_041425_io_poll_remove_entries/repro.stats
> > v6.3-rc4 issue dmesg: https://github.com/xupengfe/syzkaller_logs/blob/main/230327_041425_io_poll_remove_entries/v63rc4_reproduce_dmesg.log
> > Kconfig: https://github.com/xupengfe/syzkaller_logs/blob/main/230327_041425_io_poll_remove_entries/kconfig_origin
> > Bisect info: https://github.com/xupengfe/syzkaller_logs/blob/main/230327_041425_io_poll_remove_entries/bisect_info.log
> >
> > 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);
>
Thanks for your fixed patch in short time!
After receiving this email, I saw one of your newly improved fixed patch.
I will verify the new one soon.
Thanks!
BR.
-Pengfei
> --
> Jens Axboe
>