From: Bryam Vargas <hexlabsecurity@proton.me>
To: Sidraya Jayagond <sidraya@linux.ibm.com>
Cc: Dust Li <dust.li@linux.alibaba.com>,
"David S . Miller" <davem@davemloft.net>,
Mahanta Jambigi <mjambigi@linux.ibm.com>,
Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
"D . Wythe" <alibuda@linux.alibaba.com>,
Alexandra Winter <wintera@linux.ibm.com>,
Hidayath Khan <hidayath@linux.ibm.com>,
linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
netdev@vger.kernel.org, Simon Horman <horms@kernel.org>,
Tony Lu <tonylu@linux.alibaba.com>,
Wen Gu <guwen@linux.alibaba.com>,
linux-s390@vger.kernel.org, Wenjia Zhang <wenjia@linux.ibm.com>,
Julian Ruess <julianr@linux.ibm.com>
Subject: Re: [PATCH net v2 2/2] net/smc: do not reuse the DMB of a nocopy device
Date: Sat, 28 Nov 2026 15:13:53 +0000 [thread overview]
Message-ID: <20261128151348.1410275-1-hexlabsecurity@proton.me> (raw)
In-Reply-To: <3b16c6c2-7bf1-4261-9c0c-abc56aa6d608@linux.ibm.com>
On Thu, 19 Nov 2026 12:25:12 +0530, Sidraya Jayagond wrote:
> I don't see what this branch buys us on this path. The link group is
> already off its device list here, so no new connection can join it and
> take the pooled DMB, and __smc_lgr_free_bufs() unregisters anything left
> in lgr->rmbs[] at teardown anyway, neither race from the commit
> message can happen on this path.
Agreed, the unregister buys nothing there. v3 [1] drops it and leaves
that DMB to the link group's free.
> Could you point at the path that dereferences conn->rmb_desc after
> smc_conn_free(), or drop the branch before it goes to stable?
A client that calls connect() again on the same socket. When the
handshake fails with a negative code the socket stays in SMC_INIT, and
a later connect() runs the handshake again with the same
smc_connection. conn->rmb_desc is still the first attempt's: always on
net, and with 2/2 when that attempt was freed with its link group
already off the list. If the retry then cannot allocate its RMB,
smc_conn_free() runs in the new link group with that pointer:
smc_ism_unset_conn() reads it and smc_buf_unuse() acts on it. On net
smc_buf_unuse() then zeroes the freed buffer, 65568 bytes in the test,
and clears ->used in the freed descriptor. With 2/2 and the pointer
left set it unlinks and frees the descriptor.
Measured on the loopback device with KASAN kernels and a non-blocking
connect(): the second call returns ECONNABORTED and the third runs the
handshake again. Three test knobs force the steps: the negative return
of the first attempt, its link group terminated before the attempt is
freed, and the failed RMB allocation of the retry. With
kasan_multi_shot, net gives five UAF reports, the first in
smc_ism_unset_conn(), and falls back to TCP. v1's 2/2, which had no
branch, gives five as well, the first in the same place, then a GPF in
smc_conn_free(), and close() hangs. v2 is clean, and so is v3. I
haven't found a way to get there without the knobs.
So v3 keeps only the clear on that path, WRITE_ONCE(conn->rmb_desc,
NULL), and the commit message says what the retry does with the
pointer. v6 2/3 of the CDC receive ordering series [2] clears both
pointers in smc_conn_create(), which closes the stale use on net too;
2/2's clear is there so that this path doesn't need that patch in
stable.
[1] https://lore.kernel.org/all/20261128-b4-disp-2c190c90-v3-0-c566f64196c8@proton.me/
[2] https://lore.kernel.org/all/20261112-b4-disp-1c8d3a53-v6-0-36a38ae35021@proton.me/
Thanks,
Bryam
next prev parent reply other threads:[~2026-11-28 15:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 19:09 [PATCH net v2 0/2] " Bryam Vargas via B4 Relay
2026-11-14 19:09 ` [PATCH net v2 1/2] dibs: loopback: reset the client id when the owner unregisters a DMB Bryam Vargas via B4 Relay
2026-11-19 9:05 ` Alexandra Winter
2026-11-14 19:09 ` [PATCH net v2 2/2] net/smc: do not reuse the DMB of a nocopy device Bryam Vargas via B4 Relay
2026-11-19 6:55 ` Sidraya Jayagond
2026-11-28 15:13 ` Bryam Vargas [this message]
2026-11-19 0:24 ` [PATCH net v2 0/2] " Jakub Kicinski
2026-11-19 9:06 ` Alexandra Winter
2026-11-28 15:14 ` 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=20261128151348.1410275-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=julianr@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@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sidraya@linux.ibm.com \
--cc=tonylu@linux.alibaba.com \
--cc=wenjia@linux.ibm.com \
--cc=wintera@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
all inboxes | Powered by JetHome®