Netdev List
 help / color / mirror / Atom feed
From: Bryam Vargas <hexlabsecurity@proton.me>
To: netdev-bot+sashiko@kernel.org
Cc: Mahanta Jambigi <mjambigi@linux.ibm.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Dust Li <dust.li@linux.alibaba.com>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Sidraya Jayagond <sidraya@linux.ibm.com>,
	Paolo Abeni <pabeni@redhat.com>,
	"D . Wythe" <alibuda@linux.alibaba.com>,
	Hans Wippel <hwippel@linux.ibm.com>,
	linux-kernel@vger.kernel.org, Wenjia Zhang <wenjia@linux.ibm.com>,
	netdev@vger.kernel.org, Hidayath Khan <hidayath@linux.ibm.com>,
	Ursula Braun <ubraun@linux.ibm.com>,
	Tony Lu <tonylu@linux.alibaba.com>,
	linux-rdma@vger.kernel.org, Wen Gu <guwen@linux.alibaba.com>,
	linux-s390@vger.kernel.org, Simon Horman <horms@kernel.org>
Subject: Re: [PATCH net v6 2/3] net/smc: clear the buffer pointers before registering a connection
Date: Sat, 28 Nov 2026 15:53:56 +0000	[thread overview]
Message-ID: <20261128155344.1427660-1-hexlabsecurity@proton.me> (raw)
In-Reply-To: <179487758425.3136.7345936021290037161@kernel.org>

On Tue, 17 Nov 2026 01:06:24 +0000, netdev-bot+sashiko@kernel.org wrote:
> - [High] This patch still leaves rmb_desc and sndbuf_desc dangling while
>   the connection can be found by its token.

It does, and the cover says so: it's the first item under "Not fixed
here". A handler still runs on the released RMB if it found the
connection before smc_conn_free() unregistered it. That predates this
series, and it's the window Weiming Shi's patch [1] is about.

2/3 is for another case, the retry that registers the connection again
under a new token with the pointers from the failed attempt still set.
A CDC with the new token then finds them at any time, with no race
against the release. The note under 2/3 ("a pointer seen set stays
set") is only about the pointer not going back to NULL under the lock;
it says nothing about who owns the buffer.

> Could the pointers instead be cleared under the slock where the buffers
> are released, in smc_buf_unuse()/smc_conn_free()? Or could the token be
> unregistered before the buffers are released? Either would replace the
> clear in smc_conn_create() rather than add to it.

Not with a clear in smc_buf_unuse(): smc_conn_free() skips it when the
link group is already off its list, so the pointers stay set on that
path and a later retry registers them again. Unregistering the token
first clears nothing. Every registration goes through
smc_conn_create(), so the one clear there covers them all.

A clear in smc_conn_free() itself is different. Under the spinlock,
before the buffers are released and on every path through the
function, it would do what the clear in smc_conn_create() does. A
handler that takes the spinlock after that clear would also find NULL
at the check 2/3 adds, which closes the window above for that handler.
By inspection; not written or run.

2/3 keeps its clear in smc_conn_create(). That is enough for the retry,
and the window above is left to [1].

The two cases you list, is_reg_err set or not, are the ones the cover
measured: after the negative CONFIRM_RKEY, the descriptor is back in
the pool and the forged CDC runs on it; after a failed MR registration,
KASAN reports the UAF. Both with the retry; without one, i.e. the
window above, nothing was run here.

[1] https://lore.kernel.org/all/20261021171256.166870-2-bestswngs@gmail.com/

Thanks,
Bryam


  reply	other threads:[~2026-11-28 15:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13  0:32 [PATCH net v6 0/3] net/smc: order the CDC receive path against buffer publication Bryam Vargas via B4 Relay
2026-11-13  0:32 ` [PATCH net v6 1/3] net/smc: order the CDC receive path against RMB publication Bryam Vargas via B4 Relay
2026-11-13  0:32 ` [PATCH net v6 2/3] net/smc: clear the buffer pointers before registering a connection Bryam Vargas via B4 Relay
2026-11-17  1:06   ` netdev-bot+sashiko
2026-11-28 15:53     ` Bryam Vargas [this message]
2026-11-13  0:32 ` [PATCH net v6 3/3] net/smc: skip the DMB nocopy accounting until the send buffer is set Bryam Vargas via B4 Relay
2026-11-17  1:06   ` netdev-bot+sashiko
2026-11-28 15:54     ` Bryam Vargas

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=20261128155344.1427660-1-hexlabsecurity@proton.me \
    --to=hexlabsecurity@proton.me \
    --cc=alibuda@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=dust.li@linux.alibaba.com \
    --cc=edumazet@kernel.org \
    --cc=guwen@linux.alibaba.com \
    --cc=hidayath@linux.ibm.com \
    --cc=horms@kernel.org \
    --cc=hwippel@linux.ibm.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjambigi@linux.ibm.com \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sidraya@linux.ibm.com \
    --cc=tonylu@linux.alibaba.com \
    --cc=ubraun@linux.ibm.com \
    --cc=wenjia@linux.ibm.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