From: Bryam Vargas <hexlabsecurity@proton.me>
To: Paolo Abeni <pabeni@redhat.com>, netdev-bot+sashiko@kernel.org
Cc: Sidraya Jayagond <sidraya@linux.ibm.com>,
Jakub Kicinski <kuba@kernel.org>,
Mahanta Jambigi <mjambigi@linux.ibm.com>,
"D . Wythe" <alibuda@linux.alibaba.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Guangguan Wang <guangguan.wang@linux.alibaba.com>,
Ursula Braun <ubraun@linux.ibm.com>,
Stefan Raspl <raspl@linux.ibm.com>,
linux-s390@vger.kernel.org, Wen Gu <guwen@linux.alibaba.com>,
linux-kernel@vger.kernel.org,
Hidayath Khan <hidayath@linux.ibm.com>,
Simon Horman <horms@kernel.org>,
Wenjia Zhang <wenjia@linux.ibm.com>,
Tony Lu <tonylu@linux.alibaba.com>,
linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
Dust Li <dust.li@linux.alibaba.com>
Subject: Re: [PATCH net v8 4/4] net/smc: bound the link failover cursor advance to the send buffer
Date: Fri, 13 Nov 2026 01:02:45 +0000 [thread overview]
Message-ID: <20261113010235.418440-1-hexlabsecurity@proton.me> (raw)
In-Reply-To: <fc454b46-b66c-4a16-aa1c-3ea0c2e91d15@redhat.com>
On 11/3/26 11:22, Paolo Abeni wrote:
> On 11/2/26 19:24, netdev-bot+sashiko@kernel.org wrote:
> > - [Medium] The patch adds a cons.count < peer_rmbe_size gate to
> > smc_switch_cursor().
> > - [Medium] The new bound in smc_switch_cursor(), diff <=
> > smc_curs_diff(len, &tx_curs_sent, &prep), is computed from a snapshot...
> I think the above are the last 2 comments standing that need to be addressed,
> (the high one in patch 1 is addressed by patch 2, the high one in patch 2 is
> addressed by a separate patch).
Both are right; v9 [1] changes the code for each.
> > - [Medium] The patch adds a cons.count < peer_rmbe_size gate to
> > smc_switch_cursor().
For a count past the RMBE, v8 turned a stalled connection into a write
past the peer's RMBE. A check in smc_write_space() isn't enough:
smc_cdc_msg_recv_action() credits peer_rmbe_space from the next
consumer cursor, so one more CDC after the switch opens the window
again. A conforming peer gets the same write if it keeps reading across
the end of its RMBE before the resend.
v9 bounds the write where its length and destination are computed (new
5/6): at most one RMBE per call, and the first chunk ends no later than
the RMBE whatever the wraps say. On rxe with a 16K RMBE and the count
forged at RMBE + 4096, v8 posts 16384 bytes from offset 1 and the link
goes down; v9 posts 16383 + 1 and the link stays up. With a conforming
peer, 9000 bytes unconfirmed at the failover and read before the
resend, then 2000 more sent, unpatched and v8 post the 11000 bytes in
one chunk from offset 12001 and the surviving link goes down; v9 posts
4383 + 6617 and the peer reads the stream intact.
5/6 turns one-chunk writes into two, so it sits on a fix for how
smcr_tx_rdma_writes() sizes the second chunk's source (new 4/6, the
pre-existing [High] on the source SGE in the review of v7's 4/4). A
conforming peer reaches that one: a completion handled between the
first two cursor copies of smc_switch_cursor() leaves tx_curs_sent 600
bytes behind prod, and unpatched and v8 then build a source SGE that
ends 4536 bytes past the send buffer (KASAN splat on the unpatched
run).
> > - [Medium] The new bound in smc_switch_cursor(), diff <=
> > smc_curs_diff(len, &tx_curs_sent, &prep), is computed from a snapshot...
6/6 (v8's 4/4) sets tx_curs_fin and local_tx_ctrl_fin from the advanced
tx_curs_sent and local_tx_ctrl.prod, which change only under send_lock,
instead of adding to the live cursors: the first of the review's two
options. With a completion handed to smc_cdc_tx_handler() inside the
switch (test hook), v8 leaves local_tx_ctrl_fin at count 16713 for a
16384-byte RMBE; v9 leaves it on prod.
The switch still isn't serialized against smc_cdc_tx_handler(): a
completion handled inside it is still credited to sndbuf_space more
than once (the pre-existing [High] on that race) and can make the next
write hand the peer bytes it has already read. 3/6 keeps send() inside
the send buffer, but send() can then overwrite data the peer has not
received (by inspection). Serializing the switch means taking the
socket spinlock around send_lock in smc_switch_conns(); v9 doesn't do
that. In two races with a completion inside the switch v9 ends worse
than unpatched; the cover has both.
The [Low] of that review, on the new comment in smc_switch_cursor():
6/6's comment no longer says "else that peer stalls", and the message
no longer says "still sizes".
[1] https://lore.kernel.org/all/20261112-b4-disp-0287c16e-v9-0-e5e8fa688177@proton.me/
Thanks,
Bryam
prev parent reply other threads:[~2026-11-13 1:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 18:21 [PATCH net v8 0/4] net/smc: bound wire-controlled CDC cursors against the local buffers Bryam Vargas via B4 Relay
2026-10-29 18:21 ` [PATCH net v8 1/4] net/smc: bound the wire-controlled producer cursor to the RMB Bryam Vargas via B4 Relay
2026-10-29 18:43 ` sashiko-bot
2026-11-02 18:24 ` netdev-bot+sashiko
2026-10-29 18:21 ` [PATCH net v8 2/4] net/smc: bound the receive length " Bryam Vargas via B4 Relay
2026-10-29 18:43 ` sashiko-bot
2026-11-02 18:24 ` netdev-bot+sashiko
2026-10-29 18:21 ` [PATCH net v8 3/4] net/smc: bound the send length to the send buffer in smc_tx_sendmsg() Bryam Vargas via B4 Relay
2026-10-29 18:43 ` sashiko-bot
2026-11-02 18:24 ` netdev-bot+sashiko
2026-10-29 18:21 ` [PATCH net v8 4/4] net/smc: bound the link failover cursor advance to the send buffer Bryam Vargas via B4 Relay
2026-10-29 18:43 ` sashiko-bot
2026-11-02 18:24 ` netdev-bot+sashiko
2026-11-03 10:22 ` Paolo Abeni
2026-11-13 1:02 ` Bryam Vargas [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=20261113010235.418440-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=guangguan.wang@linux.alibaba.com \
--cc=guwen@linux.alibaba.com \
--cc=hidayath@linux.ibm.com \
--cc=horms@kernel.org \
--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=raspl@linux.ibm.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;
as well as URLs for NNTP newsgroup(s).