From: Jens Axboe <axboe@kernel.dk>
To: Palash Oswal <oswalpalash@gmail.com>,
io-uring@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, mingo@kernel.org, mingo@redhat.com,
peterz@infradead.org, rostedt@goodmis.org,
syzkaller-bugs@googlegroups.com, viro@zeniv.linux.org.uk,
will@kernel.org
Subject: Re: INFO: task hung in __io_uring_task_cancel
Date: Sun, 3 Jan 2021 14:53:35 -0700 [thread overview]
Message-ID: <e3bd8214-830d-ab3e-57ba-564c5adcac52@kernel.dk> (raw)
In-Reply-To: <CAGyP=7cFM6BJE7X2PN9YUptQgt5uQYwM4aVmOiVayQPJg1pqaA@mail.gmail.com>
On 1/2/21 9:14 PM, Palash Oswal wrote:
> Hello,
>
> I was running syzkaller and I found the following issue :
>
> Head Commit : b1313fe517ca3703119dcc99ef3bbf75ab42bcfb ( v5.10.4 )
> Git Tree : stable
> Console Output :
> [ 242.769080] INFO: task repro:2639 blocked for more than 120 seconds.
> [ 242.769096] Not tainted 5.10.4 #8
> [ 242.769103] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"
> disables this message.
> [ 242.769112] task:repro state:D stack: 0 pid: 2639
> ppid: 2638 flags:0x00000004
> [ 242.769126] Call Trace:
> [ 242.769148] __schedule+0x28d/0x7e0
> [ 242.769162] ? __percpu_counter_sum+0x75/0x90
> [ 242.769175] schedule+0x4f/0xc0
> [ 242.769187] __io_uring_task_cancel+0xad/0xf0
> [ 242.769198] ? wait_woken+0x80/0x80
> [ 242.769210] bprm_execve+0x67/0x8a0
> [ 242.769223] do_execveat_common+0x1d2/0x220
> [ 242.769235] __x64_sys_execveat+0x5d/0x70
> [ 242.769249] do_syscall_64+0x38/0x90
> [ 242.769260] entry_SYSCALL_64_after_hwframe+0x44/0xa9
> [ 242.769270] RIP: 0033:0x7f59ce45967d
> [ 242.769277] RSP: 002b:00007ffd05d10a58 EFLAGS: 00000246 ORIG_RAX:
> 0000000000000142
> [ 242.769290] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f59ce45967d
> [ 242.769297] RDX: 0000000000000000 RSI: 0000000020000180 RDI: 00000000ffffffff
> [ 242.769304] RBP: 00007ffd05d10a70 R08: 0000000000000000 R09: 00007ffd05d10a70
> [ 242.769311] R10: 0000000000000000 R11: 0000000000000246 R12: 000055a91d37d320
> [ 242.769318] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
Can you see if this helps? The reproducer is pretty brutal, it'll fork
thousands of tasks with rings! But should work of course. I think this
one is pretty straight forward, and actually an older issue with the
poll rewaiting.
diff --git a/fs/io_uring.c b/fs/io_uring.c
index ca46f314640b..539de04f9183 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5103,6 +5103,12 @@ static bool io_poll_rewait(struct io_kiocb *req, struct io_poll_iocb *poll)
{
struct io_ring_ctx *ctx = req->ctx;
+ /* Never re-wait on poll if the ctx or task is going away */
+ if (percpu_ref_is_dying(&ctx->refs) || req->task->flags & PF_EXITING) {
+ spin_lock_irq(&ctx->completion_lock);
+ return false;
+ }
+
if (!req->result && !READ_ONCE(poll->canceled)) {
struct poll_table_struct pt = { ._key = poll->events };
--
Jens Axboe
next prev parent reply other threads:[~2021-01-03 21:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-03 4:14 INFO: task hung in __io_uring_task_cancel Palash Oswal
2021-01-03 21:53 ` Jens Axboe [this message]
[not found] ` <20210103123701.1500-1-hdanton@sina.com>
2021-01-04 5:23 ` Palash Oswal
[not found] ` <20210104065231.2579-1-hdanton@sina.com>
2021-01-04 9:40 ` Palash Oswal
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=e3bd8214-830d-ab3e-57ba-564c5adcac52@kernel.dk \
--to=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=oswalpalash@gmail.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=syzkaller-bugs@googlegroups.com \
--cc=viro@zeniv.linux.org.uk \
--cc=will@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).