From: netdev-bot+sashiko@kernel.org
To: hexlabsecurity@proton.me
Cc: mjambigi@linux.ibm.com, dust.li@linux.alibaba.com,
edumazet@kernel.org, pabeni@redhat.com, davem@davemloft.net,
kuba@kernel.org, alibuda@linux.alibaba.com,
sidraya@linux.ibm.com, ubraun@linux.ibm.com,
wenjia@linux.ibm.com, raspl@linux.ibm.com,
linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
guwen@linux.alibaba.com, tonylu@linux.alibaba.com,
horms@kernel.org, guangguan.wang@linux.alibaba.com,
linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
hidayath@linux.ibm.com
Subject: Re: [PATCH net v9 5/6] net/smc: keep an RDMA write inside the peer's RMBE
Date: Mon, 16 Nov 2026 13:00:38 +0000 [thread overview]
Message-ID: <179483403898.3136.8882184057960679731@kernel.org> (raw)
In-Reply-To: <20261112-b4-disp-0287c16e-v9-5-e5e8fa688177@proton.me>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message gives the impact of the bug as "With one RMBE
per RMB, as Linux allocates them, the peer's HCA refuses the write and…
- [Low] The patch rewrites the `peer_rmbe_space` invariant comment in
`smc_tx_advance_cursors()` (net/smc/smc_tx.c:365) to "can be out of…
--
net/smc: keep an RDMA write inside the peer's RMBE
This commit limits a single RDMA write in smc_tx_rdma_writes() to one
peer RMBE. It also always ends the first destination chunk at the end of
the peer's RMBE, rather than choosing the chunking from the producer and
consumer cursor wraps. The goal is to stop writes past the peer's RMBE,
caused either by a forged consumer cursor or by a conforming peer reading
across the RMBE end before a resend after link failover.
Closes: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261013-b4-disp-f345196c-v7-0-ef3dddfbfa68%40proton.me?part=4
> net/smc: keep an RDMA write inside the peer's RMBE
>
> smc_tx_rdma_writes() takes the length of a write from peer_rmbe_space
> and decides from the cursor wraps whether the destination is one chunk
> or two. Both follow the peer's consumer cursor, which nothing bounds: a
> forged one takes a one-chunk write past the peer's RMBE, and so does a
> conforming peer that keeps reading across the end of its RMBE before
> the resend after an SMC-R link failover. With one RMBE per RMB, as
> Linux allocates them, the peer's HCA refuses the write and the link
> goes down.
[Severity: Low]
Does this impact statement cover every peer? It describes peers with one
RMBE per RMB, but the Linux sender also accepts an RMBE index chosen by
the peer:
net/smc/af_smc.c:smcr_conn_save_peer_info() {
...
smc->conn.peer_rmbe_idx = clc->r0.rmbe_idx;
...
smc->conn.tx_off = bufsize * (smc->conn.peer_rmbe_idx - 1);
}
Only the local side hard-codes it, in smc_clc_send_confirm_accept():
clc->r0.rmbe_idx = 1; /* for now: 1 RMB = 1 RMBE */
smc_tx_rdma_write() then targets the peer's RMB base plus tx_off plus
offset, under the rkey that covers the whole RMB.
Take a peer that puts several RMBEs in one RMB. Wouldn't the overlong
write from before this patch stay inside the registered RMB? Then the HCA
would not refuse it, and the write would overwrite the next connection's
RMBE on that peer.
A conforming peer in the failover case described above looks like it can
hit this too. Could the commit message mention this outcome? Stable
maintainers will use the message to judge urgency.
> diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c
> index d37c747544618..c90bdc77f82de 100644
> --- a/net/smc/smc_tx.c
> +++ b/net/smc/smc_tx.c
> @@ -362,7 +362,7 @@ static inline void smc_tx_advance_cursors(struct smc_connection *conn,
> smp_mb__before_atomic();
> /* data in flight reduces usable snd_wnd */
> atomic_sub(len, &conn->peer_rmbe_space);
> - /* guarantee 0 <= peer_rmbe_space <= peer_rmbe_size */
> + /* can be out of range, see smc_tx_rdma_writes() */
> smp_mb__after_atomic();
> smc_curs_add(conn->sndbuf_desc->len, sent, len);
> }
[Severity: Low]
This comment now says peer_rmbe_space can be out of range. Should the
matching comment in smc_cdc_msg_recv_action() change as well? It still
states the old guarantee, right after the credit that can push the value
above peer_rmbe_size:
net/smc/smc_cdc.c:smc_cdc_msg_recv_action() {
...
atomic_add(diff_cons, &conn->peer_rmbe_space);
/* guarantee 0 <= peer_rmbe_space <= peer_rmbe_size */
...
}
For example, in the conforming failover case from the notes, a peer that
reads after the switch is credited peer_rmbe_size + 9000.
Nearby code still relies on the old invariant. The same function clears
urg_tx_pend only when the two values are exactly equal:
if (diff_cons && conn->urg_tx_pend &&
atomic_read(&conn->peer_rmbe_space) == conn->peer_rmbe_size) {
The header comment of smc_curs_diff() in net/smc/smc_cdc.h says
"difference cannot exceed size". That is not true when the consumer
cursor comes off the wire unbounded.
The notes say the smc_cdc.c hunk was left out because it would not apply
to 6.6.y. Could a comment-only fix go in as a separate change that is not
tagged for stable?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112-b4-disp-0287c16e-v9-0-e5e8fa688177%40proton.me
next prev parent reply other threads:[~2026-11-16 13:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 12:59 [PATCH net v9 0/6] net/smc: bound wire-controlled CDC cursors against the local buffers Bryam Vargas via B4 Relay
2026-11-12 12:59 ` [PATCH net v9 1/6] net/smc: bound the wire-controlled producer cursor to the RMB Bryam Vargas via B4 Relay
2026-11-12 13:30 ` sashiko-bot
2026-11-12 12:59 ` [PATCH net v9 2/6] net/smc: bound the receive length " Bryam Vargas via B4 Relay
2026-11-12 13:30 ` sashiko-bot
2026-11-16 13:00 ` netdev-bot+sashiko
2026-11-12 12:59 ` [PATCH net v9 3/6] net/smc: bound the send length to the send buffer in smc_tx_sendmsg() Bryam Vargas via B4 Relay
2026-11-12 13:30 ` sashiko-bot
2026-11-16 13:00 ` netdev-bot+sashiko
2026-11-12 12:59 ` [PATCH net v9 4/6] net/smc: keep the source of an RDMA write inside the send buffer Bryam Vargas via B4 Relay
2026-11-12 13:30 ` sashiko-bot
2026-11-12 12:59 ` [PATCH net v9 5/6] net/smc: keep an RDMA write inside the peer's RMBE Bryam Vargas via B4 Relay
2026-11-12 13:30 ` sashiko-bot
2026-11-16 13:00 ` netdev-bot+sashiko [this message]
2026-11-12 12:59 ` [PATCH net v9 6/6] net/smc: bound the link failover cursor advance to the send buffer Bryam Vargas via B4 Relay
2026-11-12 13:30 ` sashiko-bot
2026-11-16 13:00 ` netdev-bot+sashiko
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=179483403898.3136.8882184057960679731@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--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=hexlabsecurity@proton.me \
--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@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