From: Pavel Begunkov <asml.silence@gmail.com>
To: syzbot <syzbot+2b8e48083b04a2e58fab@syzkaller.appspotmail.com>,
axboe@kernel.dk, io-uring@vger.kernel.org,
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [io-uring?] KCSAN: data-race in io_req_defer_failed / io_wq_free_work (3)
Date: Thu, 17 Oct 2024 13:00:57 +0100 [thread overview]
Message-ID: <e40179ae-5b1a-446e-a982-607321b21d57@gmail.com> (raw)
In-Reply-To: <6710c8ce.050a0220.d5849.0026.GAE@google.com>
On 10/17/24 09:20, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: c964ced77262 Merge tag 'for-linus' of git://git.kernel.org..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=14d3cf27980000
> kernel config: https://syzkaller.appspot.com/x/.config?x=fd83253b74c9c570
> dashboard link: https://syzkaller.appspot.com/bug?extid=2b8e48083b04a2e58fab
> compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
>
> Unfortunately, I don't have any reproducer for this issue yet.
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/dc3d0edf69f7/disk-c964ced7.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/bb0052a85cf6/vmlinux-c964ced7.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/ec8def944d77/bzImage-c964ced7.xz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+2b8e48083b04a2e58fab@syzkaller.appspotmail.com
I'd assume io_req_defer_failed sets F_FAIL flag, req_ref_put_and_test()
reads F_REFCOUNT, which never changes at this point, and there are
dozens other such modifications.
The race is mild, it shouldn't be a problem unless the compiler
misbehaves, but may make sense to add WRITE_ONCE for every
modification.
> ==================================================================
> BUG: KCSAN: data-race in io_req_defer_failed / io_wq_free_work
>
> write to 0xffff888117079648 of 8 bytes by task 3752 on cpu 1:
> io_req_defer_failed+0x73/0x440 io_uring/io_uring.c:935
> io_req_task_cancel+0x21/0x30 io_uring/io_uring.c:1361
> io_handle_tw_list+0x1b9/0x200 io_uring/io_uring.c:1063
> tctx_task_work_run+0x6c/0x1b0 io_uring/io_uring.c:1135
> tctx_task_work+0x40/0x80 io_uring/io_uring.c:1153
> task_work_run+0x13a/0x1a0 kernel/task_work.c:228
> get_signal+0xee9/0x1070 kernel/signal.c:2690
> arch_do_signal_or_restart+0x95/0x4b0 arch/x86/kernel/signal.c:337
> exit_to_user_mode_loop kernel/entry/common.c:111 [inline]
> exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
> __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
> syscall_exit_to_user_mode+0x59/0x130 kernel/entry/common.c:218
> do_syscall_64+0xd6/0x1c0 arch/x86/entry/common.c:89
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> read to 0xffff888117079648 of 8 bytes by task 3753 on cpu 0:
> req_ref_put_and_test io_uring/refs.h:22 [inline]
> io_wq_free_work+0x21/0x160 io_uring/io_uring.c:1779
> io_worker_handle_work+0x4cb/0x9d0 io_uring/io-wq.c:604
> io_wq_worker+0x286/0x820 io_uring/io-wq.c:655
> ret_from_fork+0x4b/0x60 arch/x86/kernel/process.c:147
> ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>
> value changed: 0x00000000802c2058 -> 0x00000000806c2118
--
Pavel Begunkov
prev parent reply other threads:[~2024-10-17 12:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 8:20 [syzbot] [io-uring?] KCSAN: data-race in io_req_defer_failed / io_wq_free_work (3) syzbot
2024-10-17 12:00 ` Pavel Begunkov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e40179ae-5b1a-446e-a982-607321b21d57@gmail.com \
--to=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+2b8e48083b04a2e58fab@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox