Article View: linux.kernel.netdev
Article #25114Re: [PATCH net] net/smc: cap ADD LINK v2 rkeys to the receive limit
From: Mahanta Jambigi
Date: Tue, 01 Dec 2026 09:15
Date: Tue, 01 Dec 2026 09:15
78 lines
15863 bytes
15863 bytes
On 29/11/26 12:47 am, Andrew Stellman wrote:
> From: Andrew Stellman <astellman@stellman-greene.com>
>
> smc_llc_fill_ext_v2() writes one 16-byte rkey entry per connection in
> the link group into the 8192-byte SMC-Rv2 work-request buffer. The
> count is lgr->conns_num and has no upper bound. After the headers there
> is room for 507 entries, so a count of 508 writes eight bytes past the
> buffer.
>
> smc_conn_create() checks max_conns and the rtoken bitmap only for the
> server role, and smc_rtoken_add() reuses an rtoken slot when the peer
> repeats an RMB rkey and address, so a client link group isn't limited
> to 255 connections. I didn't run a case where a peer brought a link
The overflow mechanism is right, but I think the missing bound belongs
one layer up: the client link group is the only one that can grow past
255, because smc_conn_create() exempts that role from the limit it
applies to the server:
(role == SMC_CLNT || ini->is_smcd ||
(lgr->conns_num < lgr->max_conns && ...))
Would dropping role == SMC_CLNT be the *better fix*? A conforming peer
never notices: max_conns is the negotiated minimum, so the server moves
to a new link group, with a new QPN(Queue Pair Number), before the
client's limit is reached, and smcr_lgr_match() then no longer matches
the old group. For a peer that keeps the QPN, smc_conn_create() already
returns SMC_CLC_DECL_SYNCERR when the client cannot join the group the
server reused, so the connection is declined instead of growing the
group. That bounds conns_num at 255, which is what keeps the rkey list
inside the work-request buffer.
> group to 508 connections.
>
> Cap the count at SMC_LLC_RKEYS_PER_MSG_V2 (255), the limit that
> smc_llc_save_add_link_rkeys() applies on receive. This changes existing
> behaviour: in a group with more than 255 connections, ADD LINK now
> carries only the first 255 rkeys, and later connections get no rkey on
> the new link.
>
> Tested on mainline (7.4.0-rc4) in arm64 QEMU with KASAN and SoftRoCE.
> A test-only change forced a count of 508 and reused one RMB for the
> extra entries, and KASAN reported an 8-byte out-of-bounds write. With
> this patch there was no report, and reverting only the cap brought it
> back. A two-connection SMC-R run with only this patch applied gave no
> KASAN report.
>
> The issue was found by Claude Opus 5 running Quality Playbook, an
> LLM-driven code review tool:
> https://github.com/andrewstellman/quality-playbook
> The fix was drafted with OpenAI GPT-6 (Codex) and this changelog with
> Claude Opus 5.5, and both were reviewed by me.
>
> Fixes: b4ba4652b3f8 ("net/smc: extend LLC layer for SMC-Rv2")
> Signed-off-by: Andrew Stellman <astellman@stellman-greene.com>
> ---
> A reproducer is available on request.
>
> net/smc/smc_llc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/smc/smc_llc.c b/net/smc/smc_llc.c
> index c9ccd8480369ca..9f6ba5f75b8f2b 100644
> --- a/net/smc/smc_llc.c
> +++ b/net/smc/smc_llc.c
> @@ -638,7 +638,8 @@ static int smc_llc_fill_ext_v2(struct smc_llc_msg_add_link_v2_ext *ext,
> prim_lnk_idx = link->link_idx;
> lnk_idx = link_new->link_idx;
> down_write(&lgr->rmbs_lock);
> - ext->num_rkeys = lgr->conns_num;
> + ext->num_rkeys = min_t(unsigned int, lgr->conns_num,
> + SMC_LLC_RKEYS_PER_MSG_V2);
> if (!ext->num_rkeys)
> goto out;
> buf_pos = smc_llc_get_first_rmb(lgr, &buf_lst);
Technical Details
Message-ID:
<d4a8844e-9c1c-48c9-969c-f03696ace29a@linux.ibm.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374885-linux-kernel-netdev=dewy.ruReferences:
<20261128191730.30196-1-bugs@stellman-greene.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374885-linux-kernel-netdev=dewy.ru
From: mjambigi@linux.ibm.com (Mahanta Jambigi)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] net/smc: cap ADD LINK v2 rkeys to the receive limit
Date: Tue, 1 Dec 2026 14:45:27 +0530
Organization: Usenet Network
Message-ID: <d4a8844e-9c1c-48c9-969c-f03696ace29a@linux.ibm.com>
References: <20261128191730.30196-1-bugs@stellman-greene.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
logging-data="1671377"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:MSxSsx2jz8YixNk+5HQeCw8VNcg= sha256:q2aqwpNAgROG0554rR3QRuPTkRhtKRZxoo2GrmQFtaU=
sha1:S0MKZrCbzNtPw7DhhQM3k4U+nkM= sha256:g9/gaGNp4C6K56CMDeAGOaHDZA7Ixbo82/tYFe7UZOA=
Content-Language: en-US
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 44BE61172F0; Tue, 1 Dec 2026 12:16:25 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=ibm.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 8_ewGpM4OOvm;
Tue, 1 Dec 2026 12:16:21 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374885-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=linux.ibm.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 1486A117251; Tue, 1 Dec 2026 12:16:11 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 3B2CA327D3; Tue, 1 Dec 2026 09:15:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1796116552;
b=1NxvCvV32wL8KX81iUB1m88Brc536zQVUionBd/5KJahBxp7pzL2v0VdTJZ9ExWywFne
nlGMGgMdzklmv2xw3osyNVl16T97XKDpVURpt7en4zmc4+7vBJTXnXxHz1uCW96In9/N9
t+3ax5KuPW+W2EwYgBmavL2lgxS9tMWOJhQT3V+JkQ0K8gIB0Dr4GxaVAZYDdy8CaYKMa
0G3wuRfJshRDkLYaL9DW0nk8zZI02uXD7LbTkTt/aeHf6rkDUQTu+BJyC9xR3rLRtfQuL
/6+wOCn7srCzRT347tyXpOF8wew6n6CTAPepkiwipBOSh/tVZoozZn+f4gemj7w/npw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796116552;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:Received:
Received:Received:Received:Received:Received:Received:Message-ID:Date:
X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent:
Subject:To:Cc:References:Content-Language:From:In-Reply-To:
Content-Type:Content-Transfer-Encoding:X-TM-AS-GCONF:
X-Proofpoint-Reinject:X-Proofpoint-Spam-Info:X-Proofpoint-ORIG-GUID:
X-Proofpoint-GUID:X-Authority-Analysis:X-Proofpoint-Spam-Details-Enc:
X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details;
bh=bQhpu7FVLQlL5yHb5W6A6lxcYnPa3coVDwhiAVdPZ8I=;
b=H9+0ncE85fxiixgal7Jsj0cPAQc/NZswj0qmjYnOkgRAAsh3xJhL/J1epm1zmUKMUM/A
sXVcwG3S30GO2fr9pBTV/t3oC0wggjAguCas/GNnuln/gOC7xbgJNy9ZIFyT4eJajObxB
TLwrWXfWqzwk1EysMXi/W6eJvGd3BjOh2UdmMNG5Mg/IPlxXtrGVTRBucrfb7p0SCoFep
J3Xc/7kwpidkWYMi43kk3oaVlgszh+u8rcaoMM84PGfBHPRdCh3nO649aRzLWUbeHBdhw
YMcRjie7cyQ+c3/ubWDJf2UTypbqG0HcoosSKXkltAOOaaGZFsvxiUZufDmckclyHiw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b="grS/hPSt";
dmarc=pass header.from=linux.ibm.com;
spf=pass smtp.mailfrom=linux.ibm.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 93BC5606A330;
Tue, 1 Dec 2026 09:15:52 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=grS/hPSt
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.163.156.1
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796116551;
b=TRJKLV4izWT9W3OAztQA2+YwzAUiTrPfxrqspNyiC00W4SV0WILbJLSAWwcD8iWD9hlp
aVumB1Hc9+zx2IBpZka0S0ighRbWtRxXNS9zdZjAiM/lb/HzyO5MbPe1L2XDbCeqNqukv
9pmPpzYvXTDwifvkuHhXGpegExxb0mlA/C64fxZpJ9ia40dWdID3HHUkXSl/biBvP+hwA
qM+WoU38qWOEJAY7S2Dkyc6rGj4ZeDrE5Q9dewT1UUo1bTlt8qzHNEPxgFtfWShiAEpf+
n4fE+5auK8NChhT30EMvr+U+G+Lt6YTn/mNIMt1ftaxkB1Ow75tcdYtVicWEdhGFOcw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796116551;
h=DMARC-Filter:Received:DKIM-Signature:Received:Received:Received:
Received:Received:Received:Received:Message-ID:Date:MIME-Version:
User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To:
Content-Type:Content-Transfer-Encoding:X-TM-AS-GCONF:
X-Proofpoint-Reinject:X-Proofpoint-Spam-Info:X-Proofpoint-ORIG-GUID:
X-Proofpoint-GUID:X-Authority-Analysis:X-Proofpoint-Spam-Details-Enc:
X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details;
bh=bQhpu7FVLQlL5yHb5W6A6lxcYnPa3coVDwhiAVdPZ8I=;
b=THQkVJsVhfhH3VH+bf655VmHanEpBcY01whEqGlM7Rlxa64+iOV8pbVwEncgu2VLCnyl
za4RcKroTaOOblxxHldcvOj6w0Z1sNe/umweEuIKZSHpDiScLwygJNmh3JUwRWdNlE8Kg
d95KUPa4K+nSu8X/zfUe9qx9RDF+aR1+NTl7sRdKcAUmPTBEYOesZWvLwDHwqUaqYLv/B
j3DcEmzloGcj0SQc0Jr8F72jmp2FeLh6Xg/4v2mR26Q5HvL+0bNa/AsI25Cu3eHD4vNLM
8hjiIAqgCi50pwM34AspcNLCJzEvk2KN7dQusKJgirC9RPNLJBjSWGsgiokxSWty5zg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=linux.ibm.com;
spf=pass smtp.mailfrom=linux.ibm.com;
dkim=pass header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b="grS/hPSt";
arc=none smtp.remote-ip=148.163.156.1
X-Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51243606A31A;
Tue, 1 Dec 2026 09:15:51 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 51243606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com
X-Received: from pps.filterd (m0360083.ppops.net [127.0.0.1])
by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B12ZEkC783404;
Tue, 1 Dec 2026 09:15:37 GMT
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc
:content-transfer-encoding:content-type:date:from:in-reply-to
:message-id:mime-version:references:subject:to; s=pp1; bh=bQhpu7
FVLQlL5yHb5W6A6lxcYnPa3coVDwhiAVdPZ8I=; b=grS/hPStXODSKDoD4toV5N
/wHDvkZ7qQVAVZfidS0zNkgg1XtUrfwNEdpKtRqnsJMY+uzQ/Q2JKPGx5X68Ck50
kR5bOFRoqDTVH0+/8+jZ+JPqLSJSiOXIeJ0R4S0Mtd7hsQrwNAiW05cenKfFI4ly
ek+GoO814oSd/W/C8e2LMFlr4TbGxyHylAoDph6OwWcAh0K3zMFSuI6S+zUhcIbC
iZwygxpgsYzVKTGNsZ5xpiOkgzaID1TZ6hedo+EH1aKTaOzdKcAZz0Ohatw3lT7c
BCoqa+QvS5nCqORETIhU2M4llgSrL/HIEJ8vGHC7TrjO/RDhM5jzBofwDmN5Jq2w
==
X-Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219])
by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4j7pf3v08c-1
(version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);
Tue, 01 Dec 2026 09:15:36 +0000 (GMT)
X-Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1])
by ppma11.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6B17hEoX939185;
Tue, 1 Dec 2026 09:15:36 GMT
X-Received: from smtprelay01.wdc07v.mail.ibm.com ([172.16.1.68])
by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4j8byy09gb-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Tue, 01 Dec 2026 09:15:35 +0000 (GMT)
X-Received: from smtpav04.wdc07v.mail.ibm.com (smtpav04.wdc07v.mail.ibm.com [10.39.53.231])
by smtprelay01.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6B19FZIA11207536
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Tue, 1 Dec 2026 09:15:35 GMT
X-Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1])
by IMSVA (Postfix) with ESMTP id 2FE6158054;
Tue, 1 Dec 2026 09:15:35 +0000 (GMT)
X-Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1])
by IMSVA (Postfix) with ESMTP id 90E2E58050;
Tue, 1 Dec 2026 09:15:29 +0000 (GMT)
X-Received: from [9.123.8.233] (unknown [9.123.8.233])
by smtpav04.wdc07v.mail.ibm.com (Postfix) with ESMTP;
Tue, 1 Dec 2026 09:15:29 +0000 (GMT)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-User-Agent: Mozilla Thunderbird
X-Cc: Tony Lu <tonylu@linux.alibaba.com>, Wen Gu <guwen@linux.alibaba.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Willem de Bruijn <willemb@google.com>, linux-rdma@vger.kernel.org,
linux-s390@vger.kernel.org, netdev@vger.kernel.org
X-In-Reply-To: <20261128191730.30196-1-bugs@stellman-greene.com>
X-TM-AS-GCONF: 00
X-Proofpoint-Reinject: loops=2 maxloops=12
X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAxMDAzNiBTYWx0ZWRfX7uPiyk3w9/Hq
TW7ZE4NXX62YY+GFg/Zt6D9bNJmZ7IqPsqOM8slDxzg5nq05l/O4ygOW7QIQV7t8Pf/mgoSdnxV
7Pq5VJcF/kaCOqEgJT5RRkOaMU5R6FQ=
X-Proofpoint-ORIG-GUID: GP9LYFoULF7LsJMTgLhwUEO8C_O3MI4B
X-Proofpoint-GUID: eXIfsDW_0SBXdoK_g9Vvdf5ux9FjD6Tp
X-Authority-Analysis: v=2.4 cv=R6eWitRX c=1 sm=1 tr=0 ts=6b0e9039 cx=c_pps
a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17
a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22
a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=NEAV23lmAAAA:8
a=9FA5dTSvAAAA:8 a=BoTYRqmFJG70V9sb93wA:9 a=QEXdDO2ut3YA:10
a=SJrKH111sO7Rm7Y-nST0:22
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAxMDAzNiBTYWx0ZWRfX+lfu8L5MGAjE
/JPntIw9e334/SRaLw+1P7FfoatEKvI+EjCEyDcaKKshGZbPTWuu6hFzKESly5YVWz1FlpVze5r
WobcYVTqGfI3YzJjOa/7X6wQItSxWeITmdoCutw+SjP8heeBIbRJf9w5FZzzYT7QyvvaU1zk3Du
OT8V2Y83ahZoqrhCw47GWI4AlveXPnIl4NVDpsjZt7PUBOnKu8O5MS6sZ69WUU+2W0+Tj34AW2I
CZJfUOv3HH0zo6qngT/hZdGR00vN7+4oS6+1YQV6C3vEWZ6MERHV26qialNj/N3mLzpt+8IFoYw
nbWFAaX2afT/j82VCWf4CIqKy4xf/Cx0VQoA1/UJ69aqVrTk1UeLguqX+pZK5SsmN1JT16qUreJ
r2p1n+rlqWkYFkrcqraAbZ7Pav3if/N6cm+Ro53cU+ChY1Bc4VaZtjC9p1ucZuBXN2ZJYdAHpFN
o+Q9cvosHx0wDh7s80g==
X-Proofpoint-Virus-Version: vendor=baseguard
engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49
definitions=2026-12-01_01,2026-11-30_01,2025-10-01_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
lowpriorityscore=0 priorityscore=1501 adultscore=0 spamscore=0 bulkscore=0
phishscore=0 suspectscore=0 malwarescore=0 clxscore=1015 impostorscore=0
classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0
reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612010036