Article View: linux.kernel.netdev
Article #24314Re: [PATCH net] net/smc: cap ADD LINK v2 rkeys to the receive limit
From: Dust Li
Date: Mon, 30 Nov 2026 02:22
Date: Mon, 30 Nov 2026 02:22
48 lines
10749 bytes
10749 bytes
On 2026-11-28 14:17:30, 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
>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.
How did you force the connection to 508? Connections in a link group
are supposed to be limited to 255. Did you modified the kernel?
If this comes from a malicious/non-compliant peer bypassing the 255
limit, we should look closely at the receive path.
Best regards,
Dust
Technical Details
Message-ID:
<awzd3U0ESwkeze_F@linux.alibaba.com>Path:
mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373775-linux-kernel-netdev=dewy.ruReferences:
<20261128191730.30196-1-bugs@stellman-greene.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373775-linux-kernel-netdev=dewy.ru
From: dust.li@linux.alibaba.com (Dust Li)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] net/smc: cap ADD LINK v2 rkeys to the receive limit
Date: Mon, 30 Nov 2026 10:22:21 +0800
Organization: Usenet Network
Message-ID: <awzd3U0ESwkeze_F@linux.alibaba.com>
References: <20261128191730.30196-1-bugs@stellman-greene.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
logging-data="1310300"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:vED70mfwLSTkkw8OugDKFO8Y8yg= sha256:1sv54cs+aHL2FpPPj8uxk+0IGDzDBvvRgzIms4R7IH4=
sha1:XGjU8+NwqwVoE2WyhKc9Gu2UFt4= sha256:nIZHT/U3GqS+LgARFQvzfBVdXfmgw5CsJCMgd4eCKZM=
Content-Disposition: inline
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 1C4AF125FB8; Mon, 30 Nov 2026 05:22:56 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -10.55
X-Spam-Status: No, score=-10.55 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-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, UNPARSEABLE_RELAY=0.001, USER_IN_DEF_DKIM_WL=-7.5]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
header.d=linux.alibaba.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 D_2V2Wh4A6KU;
Mon, 30 Nov 2026 05:22:51 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373775-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 79A4D125F08; Mon, 30 Nov 2026 05:22:43 +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 2855C260E1; Mon, 30 Nov 2026 02:22:41 +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=1796005361;
b=5aMJqXzEU3LDpepaXqwmjT7jRTqAIFe8vMez1/zt/5wXFvkOL+Mg/rwrturT67ekZaFz
3sYEMg+xvBmlG7O5JyrovM4wcPyLs/OVYsWQB/ztI26cHmwcCJVf3gYN+ZIK0+Oy0pYk0
fJLwO1UdDGOeygUb96T9wSiSmzAFzbz1B0KCMscT5j5SM7qed/nMhhrJ23JH0ay7wv8FS
oFeqe5rSP5vyr0tOmWPA6DBiTmhuLpCdFiB1TTRH7JObgEpVzfQoPQkYqNO0S7Z2u3Gi2
f5Z/pZTKHdZan1sBvfqRg8UtLAi6V1t9zT3zu4V6DU4NsMetRWTxo1tLOqUvDnzRxsQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796005361;
h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:
X-Alimail-AntiSpam:Received:Date:From:To:Cc:Subject:Message-ID:
Reply-To:References:X-Mailing-List:List-Id:List-Post:List-Help:
List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To;
bh=PD31jYlOm/jdunnbS2nDfT5hfDrCByYHyBPJyjHVKZM=;
b=129U/QLBvmRnNVr8o0rAJJdkVJxpcLTQMiMo4uwm6KgtB7rsZZmPhYJMc7fJ4TBY2tMw
NHtrHk4WPWfHMDIMlOdk2gXEd7mB7GyNZMLA8bYNJbrc2PASEsHG6EDpmzatmVjKfs24F
loGEyiIYiMB78Yu9YepjS7ipVuKtGBBdIpBZxCA4hpPgHu35l9h/spxvNv7JO7wEwhYHw
T/36h/riDflULAiuGMrSpFgnpgx/M8Ifg8yP0JwCWcjA+JKjPe4w87fPY2kMhh4PX1iGn
JnMnlFWCUKzqcBOgWDkFjrGXHiiB4i70VlU6wm0vc5TtcqmrGFjpWLbrDjfBAzGLP0g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=h35ZWVly;
dmarc=pass header.from=linux.alibaba.com;
spf=pass smtp.mailfrom=linux.alibaba.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 F40F2606A32C;
Mon, 30 Nov 2026 02:22:40 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=h35ZWVly
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.30.99
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796005355;
b=Pu3VaiZCpIsh4E4Tm6cLoPFTbA4MNn5WvMxcMPji2vz0AQU14gNpXSmvfKx7pMm0nYHf
4FdoVFjGBiq+E6T4/V0SNpQcpS/MghhpYolaHf8gyCMCZR9eRedR+svGZCocnG+tTf2dh
QIvCwelnB4FB64i94KvrF9Hy6gdd9g0uMvp/uSca21FCHuQ1G3ehlEj2qbMTxCAgZB4ob
0sK4q9DQlY2PFKdTKIwnJQoxQWpfPWSoEnZPEb26YQU4XXDXUwAs0UogSTszAwx7NNfrA
lDuujlXlXlmvGJvE7ND5sefwC8XTUShPZQbkMNUWOZOR7GAKZGmu/LEtWXkWDjEw/jA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796005355;
h=DMARC-Filter:DKIM-Signature:X-Alimail-AntiSpam:Received:Date:From:To:
Cc:Subject:Message-ID:Reply-To:References:MIME-Version:Content-Type:
Content-Disposition:In-Reply-To;
bh=PD31jYlOm/jdunnbS2nDfT5hfDrCByYHyBPJyjHVKZM=;
b=JZ8jiZbExxFyRa/FbPfTNHpjf6FBsGzYz5aHLDYTMRdaMHpitCHO/o/TfDUpVOdUncIr
qIPzTd3BRaWL2ld5aGL+RD6xa/w8XzWvoLQPxSpDNyv6HnlRQei65HFXCtJNHsqIKhPJx
hWlM+Vk+pZPyNpWKEPYM2rgNkhc3OTfAFPsrB6kZGu6lJRjvkJqgfKKv0MDabr3ujGSVK
blUg9e7Vaj0LTEW69l17SwBH5GMcOZ9DpunlNxfkr2mM9FmL8bo+zt58rrTZyibDdOhvY
ZmD8/pmWvekYcZqC5eEHXrf6gVX1kinQFwlrHTD8D6fMfPxtxvpky307JqUrz31ZTSg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=linux.alibaba.com;
spf=pass smtp.mailfrom=linux.alibaba.com;
dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=h35ZWVly;
arc=none smtp.remote-ip=115.124.30.99
X-Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99])
(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 DE5E9606A31C;
Mon, 30 Nov 2026 02:22:32 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DE5E9606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linux.alibaba.com; s=default;
t=1796005343; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type;
bh=PD31jYlOm/jdunnbS2nDfT5hfDrCByYHyBPJyjHVKZM=;
b=h35ZWVlyjSaCvnBaNus+E6v+Vy+Xk/W/tnL6kra/XRULPf6uR9eNa3lAjt0sNCrhIJJUi3tOn+FFZojMzXh5N4+PaIj0bK6P/Z9KVu1bFaXISiHiF/eZe7bMWrDhKxdjqJWhS0KXpCHUNhjYD3aKQvsDBwwE6/FLN3n27/I5e7A=
X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045133197;MF=dust.li@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0XFdvWWW_1796005342;
X-Received: from localhost(mailfrom:dust.li@linux.alibaba.com fp:SMTPD_---0XFdvWWW_1796005342 cluster:ay36)
by smtp.aliyun-inc.com;
Mon, 30 Nov 2026 10:22:22 +0800
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-Reply-To: dust.li@linux.alibaba.com
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-In-Reply-To: <20261128191730.30196-1-bugs@stellman-greene.com>