Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: "yanjun.zhu" <yanjun.zhu@linux.dev>
To: Leon Romanovsky <leon@kernel.org>, Zhu Yanjun <yanjun.zhu@linux.dev>
Cc: zyjzyj2000@gmail.com, jgg@ziepe.ca, linux-rdma@vger.kernel.org
Subject: Re: [PATCH 1/1] RDMA/rxe: Fix unsafe socket release during namespace cleanup
Date: Mon, 11 May 2026 20:35:38 -0700	[thread overview]
Message-ID: <558fe8e4-2283-4921-bae0-6b68d9a9d65d@linux.dev> (raw)
In-Reply-To: <20260511123701.GI15586@unreal>

On 5/11/26 5:37 AM, Leon Romanovsky wrote:
> On Wed, Apr 29, 2026 at 04:31:48PM -0700, yanjun.zhu wrote:
>> Hi, Leon
>>
>> I have performed further tests to verify the execution order and the
>> necessity of the cleanup code in rxe_ns_exit().
>>
>> My findings show that a double-free race condition is unlikely because of
>> how the kernel manages namespace references:
>>
>> Reference Dependency: The RXE RDMA link holds a reference to the network
>> namespace.
>>
>> Order of Execution: When a namespace is deleted while an RDMA link exists,
>> rxe_ns_exit() is not invoked immediately. It is deferred until the RDMA link
>> itself is deleted (e.g., via rdma link del), which drops the final reference
>> count of the namespace.
> 
> AFAIC, we've seen syzkaller reports where "rdma link del" was never invoked,
> yet RXE was removed regardless. Is it possible?

Hi Leon,

Thanks for your feedback.

Regarding the case where "rdma link del" is not invoked, I’d like to 
share my observations on the namespace cleanup flow for RXE:

In my tests, when a network namespace is deleted (e.g., ip netns del), 
the RXE device (and its underlying net_device) is typically moved back 
to the init_net rather than being destroyed immediately. This is why the 
RDMA links still show up in init_net and the namespace reference count 
remains held.

As long as the device exists (even if moved), the resource cleanup is 
managed by the device's lifecycle. The rxe_ns_exit() only gets called 
when the last reference to that netns is dropped, which usually happens 
after the RXE device itself is finally deleted.

I haven't personally encountered the syzkaller reports where this logic 
fails or leads to a leak/crash. If possible, could you please share the 
specific syzkaller logs or the link to the report? It would be very 
helpful for me to understand if there is a specific corner case (e.g., 
driver unloading or abnormal netns teardown) where the per-net cleanup 
acts as a necessary "safety net."

If such a race exists, I will reconsider whether to keep the cleanup 
code or move it to a more robust location.

Best regards,
Yanjun Zhu

> 
> Thanks


      reply	other threads:[~2026-05-12  3:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-24  4:35 [PATCH 1/1] RDMA/rxe: Fix unsafe socket release during namespace cleanup Zhu Yanjun
2026-04-27 12:35 ` Leon Romanovsky
2026-04-27 20:52   ` yanjun.zhu
2026-04-28 14:26     ` Leon Romanovsky
2026-04-29 13:49       ` Zhu Yanjun
2026-04-29 23:31         ` yanjun.zhu
2026-05-11 12:37           ` Leon Romanovsky
2026-05-12  3:35             ` yanjun.zhu [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=558fe8e4-2283-4921-bae0-6b68d9a9d65d@linux.dev \
    --to=yanjun.zhu@linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=zyjzyj2000@gmail.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