Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Serhat Kumral <serhatkumral1@gmail.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Leon Romanovsky <leon@kernel.org>,
	Zhu Yanjun <yanjun.zhu@linux.dev>,
	Zhu Yanjun <zyjzyj2000@gmail.com>,
	David Ahern <dsahern@kernel.org>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzbot+8c9eede336e3a843750e@syzkaller.appspotmail.com
Subject: Re: [RFC PATCH 1/2] RDMA/rxe: drive UDP tunnel socket lifetime from the GID table
Date: Sun, 19 Jul 2026 20:54:47 +0300	[thread overview]
Message-ID: <20260719175447.196499-1-serhatkumral1@gmail.com> (raw)
In-Reply-To: <20260718153927.GF701389@ziepe.ca>

> Don't get this, GID removal is asynchronous, so it will eventually
> complete, what is wrong with leaving the socks around but unsuable for
> a little bit? Does something break?

I checked this more closely. You are right that a kernel socket's
passive net reference keeps struct net itself allocated, so my
wording about closing the sockets before the net is freed was
inaccurate.

However, the passive reference does not defer the pernet exit
callbacks. cleanup_net runs those callbacks before dropping its base
passive reference. With CONFIG_PROC_FS, sock_inuse_exit_net() frees
net->core.prot_inuse; when per-netns UDP hash tables are enabled,
udp_pernet_table_free() also frees net->ipv4.udp_table. The eventual
udp_tunnel_sock_release() reaches udp_lib_unhash(), which accesses
this state while unhashing a still-hashed socket. A sufficiently
delayed close can therefore access freed pernet storage even though
struct net itself remains allocated.

The backstop is therefore intended to close any remaining hashed
sockets while the required protocol pernet state is still alive, not
to prevent a direct struct net UAF. I will reword the comment and
commit message accordingly in the next version.

Regarding the per-QP TX socket in init_net, agreed that it should be
investigated separately. I will keep that out of this series and look
at selecting the TX socket from the relevant GID/netns as a follow-up.

  reply	other threads:[~2026-07-19 18:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-18 14:26 [RFC PATCH 1/2] RDMA/rxe: drive UDP tunnel socket lifetime from the GID table Serhat Kumral
2026-07-18 14:26 ` [RFC PATCH 2/2] RDMA/nldev: remove the unused dellink link op Serhat Kumral
2026-07-18 15:39 ` [RFC PATCH 1/2] RDMA/rxe: drive UDP tunnel socket lifetime from the GID table Jason Gunthorpe
2026-07-19 17:54   ` Serhat Kumral [this message]
2026-07-18 16:01 ` Zhu Yanjun
2026-07-18 16:04   ` Jason Gunthorpe
2026-07-19  5:08 ` Zhu Yanjun
2026-07-19 17:59   ` Serhat Kumral
2026-07-19 20:50     ` Zhu Yanjun
2026-07-19 21:13       ` Zhu Yanjun
2026-07-20 18:15         ` Serhat Kumral
2026-07-20 19:19           ` yanjun.zhu

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=20260719175447.196499-1-serhatkumral1@gmail.com \
    --to=serhatkumral1@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=syzbot+8c9eede336e3a843750e@syzkaller.appspotmail.com \
    --cc=yanjun.zhu@linux.dev \
    --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