public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: OFED mailing list <linux-rdma@vger.kernel.org>,
	Leon Romanovsky <leon@kernel.org>
Subject: Re: [rdma] "rdma link del" operation hangs at wait_for_completion() when a file descriptor is in use.
Date: Sun, 1 Mar 2026 13:47:14 -0400	[thread overview]
Message-ID: <20260301174714.GS44359@ziepe.ca> (raw)
In-Reply-To: <116c8183-64a4-4afd-8a5a-b9ee65610480@I-love.SAKURA.ne.jp>

On Sun, Mar 01, 2026 at 04:43:55PM +0900, Tetsuo Handa wrote:
> On 2026/03/01 7:35, Tetsuo Handa wrote:
> > On 2026/03/01 1:43, Jason Gunthorpe wrote:
> >> On Sat, Feb 28, 2026 at 03:07:29PM +0900, Tetsuo Handa wrote:
> >>> On 2025/12/04 17:26, Tetsuo Handa wrote:
> >>>> I found that running the attached example program causes khungtaskd message. What is wrong?
> >>>
> >>> I found that this is a deadlock caused by "struct ib_device_ops"->disassociate_ucontext == NULL.
> >>> If the thread which called ib_uverbs_remove_one() is unable to call ib_uverbs_release_file()
> >>>  from ib_uverbs_close() because it is blocked at
> >>> wait_for_completion(), it forms a deadlock.
> >>
> >> That doesn't sound right at all, the wait_for_completion is waiting
> >> for other threads to let go of the context before closing it. rxe/etc
> >> that syzkaller is testing don't support disassociate so they need to
> >> wait.
> > 
> > This issue was not found by syzkaller. Please see the reproducer.
> > 
> >>
> >> If the wait gets stuck that is a different issue.
> > 
> > My question is how we can support disassociate...
> > 
> 
> As of eb71ab2bf722 in linux.git, this problem is still reproducible.
> 
> If you add debug printk() like below, you will be able to confirm that
> ib_uverbs_remove_one() cannot return unless file descriptor is closed.

That's right - that is exactly how it designed to work.

Without disassociate support in the driver you *cannot* safely unload
the driver while FDs are open, to protect the kernel from UAF crashes
we sleep here.

I have no idea what it would take to add disassociate to siw or rxe,
they clearly should have it given how easy it is to trigger a "driver
unbind" through ip route..

Alternatively maybe we should make 'ip link del' fail early in these
case when a FD is open instead of infinite way.

Jason

      reply	other threads:[~2026-03-01 17:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-04  8:26 [rdma] "rdma link del" operation hangs at wait_for_completion() when a file descriptor is in use Tetsuo Handa
2026-02-28  6:07 ` Tetsuo Handa
2026-02-28 16:43   ` Jason Gunthorpe
2026-02-28 22:35     ` Tetsuo Handa
2026-03-01  7:43       ` Tetsuo Handa
2026-03-01 17:47         ` Jason Gunthorpe [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=20260301174714.GS44359@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    /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