From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.30.99 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== 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== 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 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) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DE5E9606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=h35ZWVly 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; 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 Date: Mon, 30 Nov 2026 10:22:21 +0800 From: Dust Li To: Andrew Stellman , "D. Wythe" , Sidraya Jayagond , Mahanta Jambigi Cc: Tony Lu , Wen Gu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Willem de Bruijn , linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH net] net/smc: cap ADD LINK v2 rkeys to the receive limit Message-ID: Reply-To: dust.li@linux.alibaba.com References: <20261128191730.30196-1-bugs@stellman-greene.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261128191730.30196-1-bugs@stellman-greene.com> On 2026-11-28 14:17:30, Andrew Stellman wrote: >From: Andrew Stellman > >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 >--- >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