🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20426

Re: [PATCH net v2] net/smc: validate the peer's CDC cursors against our own buffers

#20426
From: Dust Li
Date: Sun, 22 Nov 2026 13:39
28 lines
9844 bytes
On 2026-11-22 09:51:20, Piyus Kedia wrote:
>A peer's CDC message carries two cursors that are offsets into buffers
>described on this side: the producer cursor counts the bytes the peer has
>written into the RMB we published to it, and the consumer cursor the bytes
>it has taken from the RMB it published to us.  Neither is checked, on either
>transport.
>
>smcr_cdc_msg_to_host() and smcd_cdc_msg_to_host() copy both into the
>connection as they arrive, and every later user treats them as trustworthy:
>
> - smc_cdc_msg_recv_action() adds the producer difference to
>   conn->bytes_to_rcv under a comment asserting
>   "guarantee 0 <= bytes_to_rcv <= rmb_desc->len", which nothing enforces;
> - smc_cdc_handle_urg_data_arrival() reads
>   *(base + conn->urg_curs.count - 1), an unbounded index into the RMB;
> - smc_rx_recvmsg() clamps only the first of its two ring chunks
>   (rmb_desc->len - cons.count) and uses the remainder unclamped for the
>   second, so bytes_to_rcv becomes a copy length;
> - smc_rx_splice() walks PAGE_ALIGN(len + offset) / PAGE_SIZE pages calling
>   vmalloc_to_page() without checking the result, and get_page() then
>   dereferences NULL once the walk passes the end of the RMB.

I think Bryam's patch is solving the same problem here:
https://lore.kernel.org/netdev/20261112-b4-disp-0287c16e-v9-0-e5e8fa688177@proton.me

Best regards,
Dust
Technical Details
Message-ID: <awLwiDzVpdJOr6BZ@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-368695-linux-kernel-netdev=dewy.ru
References: <20261122042120.2430434-1-piyus@iiitd.ac.in>

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-368695-linux-kernel-netdev=dewy.ru
From: dust.li@linux.alibaba.com (Dust Li)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2] net/smc: validate the peer's CDC cursors against
 our own buffers
Date: Sun, 22 Nov 2026 21:39:20 +0800
Organization: Usenet Network
Message-ID: <awLwiDzVpdJOr6BZ@linux.alibaba.com>
References: <20261122042120.2430434-1-piyus@iiitd.ac.in>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="3644058"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:xqrG/zzj7keX9Vsz3DcbevdH7I8= sha256:ySZOynBb4HOqGe7gFZ09pFS2ZtiFPSPRPNYhfxF2aV4=
	sha1:fJMOIwEgc0J0GNML8tMH2SEyW34= sha256:se3NMlTgfDoZKxkItVdcBwGgf3p7n0SfsbC5JkVQh68=
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 1EA1E125D77; Sun, 22 Nov 2026 16:39:59 +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 L9l5fWZIHTaX;
	Sun, 22 Nov 2026 16:39:55 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-368695-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 6AF17125D79; Sun, 22 Nov 2026 16:39:44 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 7E65D26009; Sun, 22 Nov 2026 13:39:40 +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=1795354774;
	b=wQv+mGU3AxEBw9r+SKE4In40zVj6oojsEGsBZuY+Klt55VWrc4UFlrGa1XiP6cXa3F6y
	 iHVF8hmVvTtvr/2IaRd2Qy+QHuTW4ncIDs0f+BNXpBAeIYZVXMCy8HxNUgnUo0/3s9pI4
	 wBgkP2X+ghIMe50jXMGi5btHI57kyvTC/TpEqqC1V47ylvphb8FF2P6cQT7l7P6/8lREP
	 wXQe+MjV92VrZFK5rlOCN9N1gSMz/r/aD2dGn2BYhqVmdgOl+r6GDJnG7tzC06eWDU6lj
	 njWoNVJbZ9BI/R7aAIJgTy4bnW5ggLMlZcZlpNaKiG0pgGRxNdIaM2fsBbJLGghVwhQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795354774;
	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=X8TSjd+WfGzDMUdlZJT7yri6iqipvuTY9+Zv1zoCN9Q=;
	b=kVbHpeqPHm2limk/uBZt0Ww63mC4vKZOFn/xFhX4kl7ESXEiqZLK1PGkecNMOTCXdyHH
	 Gu597q4E7GuEfp0u2cCBAGNUqLpeFYesZmKjL7VJS3dBuez42T+Ahdbfc6dMxjogLM2Tp
	 ft1Di3h5W1EXHa+tfy4JDqbhPeoIiazr4JaagJ5yD2Sf1S7TDCQlCl4mciLVwS5K5tUCH
	 nK3gtRzIr4mv/3IWEto2iLkyDIXK/SapsPjh8TjuZY3O3VZ/YCvppp6WVVd63iqqYsMqi
	 xiNd65K93N3rOI2eBWTv/lB86hpicFt/Az5BM5mtQ00f577LN3v5+mZAPL1XymqMFAw==
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=rJ2HZwgi;
	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 9A081606A33E;
	Sun, 22 Nov 2026 13:39:34 +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=rJ2HZwgi
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.30.100
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795354773;
	b=nKUwPsZxgoHQP7n+yR/4nrezFtJwfWrW0+a7UPwxppZrQiaFqRGOzusqFwTFINvvunMe
	 thviN3opTL/0uQv5Ct5b2p1rdFc+AnwbtQEzsCPKv9Ml/6jXuud1drqWejES7ghmfBYih
	 PmjRYUJm1EbxdVkuIV70iOXOhoyoNMs4YzuZAYxf+uEw15DxlMKlR6rFVj2BRdqG8k7bX
	 Y7HdG5zg06Rox7LeSVcqFNU9wHkNfqXQc+vRXdB3O1hqX3/ZXQiAIXVHxslDTLFCpQ3x7
	 iqK6GyppOzTaC8WogGBFY/yz4kcIIsStg4DH6eEVv+rGQNt3zYl041bQLX9Hf2UG+uQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795354773;
	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=X8TSjd+WfGzDMUdlZJT7yri6iqipvuTY9+Zv1zoCN9Q=;
	b=5aqgnQbVzsy9Ra1dCKCwTEYX8cYzRk79PHJQoGMI+VlmR/7tqhAH9pWRYScTBI9aM43r
	 2ZbeZdy7O/g4gbfLP2GLSvRKJM3OgEBATpU6bBTfWzLgE3UpuQXGXlszllA30sROtXc8V
	 1MFNW1vxoP/T+KTjjUD+KirWlKe2Zp7vqpz1osTm9nAYkf2JFqkyNFtWl54OCijLBNjA4
	 6P/Il0vcv/0CcHLsYtB8CGTmQZnxoLqrIi3YgG6OdglnuRmWOsdK2Yl/NjPD+rqGTm6Im
	 3JRoaaIiEmIQKYFeY0JEF0ZwdjTH7ID575dVE8rK/XXY+x69qhe3lDYa7hg8WpUStWA==
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=rJ2HZwgi;
	arc=none smtp.remote-ip=115.124.30.100
X-Received: from out30-100.freemail.mail.aliyun.com (out30-100.freemail.mail.aliyun.com [115.124.30.100])
	(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 B08FF606A334;
	Sun, 22 Nov 2026 13:39:30 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B08FF606A334
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=1795354762; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type;
	bh=X8TSjd+WfGzDMUdlZJT7yri6iqipvuTY9+Zv1zoCN9Q=;
	b=rJ2HZwgiANhJqOTYNSHQbI2QZt20aBIuWCBm02dqSIjFp2lrf8+/aIuyK32Pxx5OppvYch7eeOPGo5hm5VoseSwMcoxpkyRbbNg5OcgvavrHa6j47RDQjP4NPBEaQQg50OdFUnN/K5SDeo8mPEd9RbX9boANsSOYKm8zAYWQybQ=
X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R471e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045098064;MF=dust.li@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0XFB.rel_1795354760;
X-Received: from localhost(mailfrom:dust.li@linux.alibaba.com fp:SMTPD_---0XFB.rel_1795354760 cluster:ay36)
          by smtp.aliyun-inc.com;
          Sun, 22 Nov 2026 21:39:21 +0800
X-Cc: Tony Lu <tonylu@linux.alibaba.com>, Wen Gu <guwen@linux.alibaba.com>,
	linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-kernel@vger.kernel.org, Kapil Vaswani <kapil@presceralabs.ai>
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: <20261122042120.2430434-1-piyus@iiitd.ac.in>