Article View: linux.kernel.netdev
Article #23318Re: [PATCH net v2] net/rds: tcp: bound the message length announced by the peer
From: netdev-bot+sashiko
Date: Fri, 27 Nov 2026 03:40
Date: Fri, 27 Nov 2026 03:40
109 lines
11907 bytes
11907 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The new check in rds_tcp_data_recv() (net/rds/tcp_recv.c:219-220
and 230-234) limits the number of payload bytes a peer can announce…
--
net/rds: tcp: bound the message length announced by the peer
This patch limits the h_len announced in an incoming RDS/TCP header to
RDS_MAX_MSG_SIZE in rds_tcp_data_recv(). If a header is larger, the
connection is dropped. The rest of the stream is then consumed and
discarded until shutdown, so the receive queue keeps draining.
> diff --git a/net/rds/tcp_recv.c b/net/rds/tcp_recv.c
> index ffe843ca219c7..4ca25b9d25d40 100644
> --- a/net/rds/tcp_recv.c
> +++ b/net/rds/tcp_recv.c
> @@ -210,9 +210,29 @@ static int rds_tcp_data_recv(read_descriptor_t *desc, struct sk_buff *skb,
> be32_to_cpu(tinc->ti_inc.i_hdr.h_len);
> tinc->ti_inc.i_rx_lat_trace[RDS_MSG_RX_START] =
> local_clock();
> + /*
> + * The payload is queued on tinc until the
> + * whole message has arrived, so a peer must
> + * not announce more than a sender is allowed
> + * to send.
> + */
> + if (tc->t_tinc_data_rem > RDS_MAX_MSG_SIZE)
> + rds_conn_path_drop(cp, false);
[Severity: High]
Does this check bound the memory held for a partially received message,
or only the announced length?
A peer can announce h_len = RDS_MAX_MSG_SIZE, which passes this check.
It can then send the payload as roughly one million 1-byte segments.
Each segment goes through:
rds_tcp_data_ready()
rds_tcp_read_sock(cp, GFP_ATOMIC)
tcp_read_sock()
rds_tcp_data_recv()
pskb_extract()
Each one ends up as its own clone on tinc->ti_skb_list, further down in
rds_tcp_data_recv():
clone = pskb_extract(skb, offset, to_copy, arg->gfp);
...
skb_queue_tail(&tinc->ti_skb_list, clone);
pskb_extract() calls skb_clone(). The clone has no sk and no destructor,
so nothing is charged to the socket.
It then calls pskb_carve(). For linear data, pskb_carve_inside_header()
allocates a new head of skb_end_offset(skb) bytes with kmalloc_reserve().
For nonlinear data, pskb_carve_inside_nonlinear() also takes
skb_frag_ref() on the rx page frags. Either way, the allocation does not
depend on how few bytes are extracted.
rds_tcp_data_ready() drains sk_receive_queue on every data_ready. That
means tcp_try_coalesce() never has a tail skb to merge small segments
into, so every segment becomes a separate clone.
Wouldn't that leave on the order of 1M uncharged clones per connection
path? Each has an sk_buff plus a new head or pinned page, so the total
is roughly 1 GiB or more, and the receive window stays open.
rds_recv_incoming() later charges only h_len to rs_rcv_bytes, so the
actual truesize is never accounted.
The commit message describes the problem as the receiver holding large
amounts of memory that is not charged to the socket. To close that
fully, could this bound the total truesize on ti_skb_list, or copy or
coalesce small chunks, rather than only check h_len?
> }
> }
>
> + /*
> + * After an oversized header the connection is being dropped:
> + * consume and discard the rest of the stream until it is shut
> + * down, so that the receive queue drains and the shutdown is
> + * not held up.
> + */
> + if (!tc->t_tinc_hdr_rem &&
> + tc->t_tinc_data_rem > RDS_MAX_MSG_SIZE) {
> + left = 0;
> + break;
> + }
> +
> if (left && tc->t_tinc_data_rem) {
> to_copy = min(tc->t_tinc_data_rem, left);
>
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125-h047-send-v2-1-b29031cf6b93%40illinois.edu
Technical Details
Message-ID:
<179575083740.3135.167711549334185146@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372438-linux-kernel-netdev=dewy.ruReferences:
<20261125-h047-send-v2-1-b29031cf6b93@illinois.edu>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372438-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2] net/rds: tcp: bound the message length announced by the peer Date: Fri, 27 Nov 2026 03:40:37 +0000 Organization: Usenet Network Message-ID: <179575083740.3135.167711549334185146@kernel.org> References: <20261125-h047-send-v2-1-b29031cf6b93@illinois.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="629898"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:lKqONkyx9eN2enM9RodtMBQ6R38= sha256:iEWEAU29FJ1dD/yPZ2LDalP0jn4Oyhbwu+OJxHMqM94= sha1:/qtzJgpwe+a9FHcq3CIy7cvReXI= sha256:NjadIGSeIKfbK6Kr/yKTrv/rJwMNyCJoeHLVpbScqSc= 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 5DFA7125F0E; Fri, 27 Nov 2026 06:40:57 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.501 X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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=kernel.org 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 8kpNApYXsJY6; Fri, 27 Nov 2026 06:40:53 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-372438-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 9352B125F0C; Fri, 27 Nov 2026 06:40:45 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 30FF36049F7; Fri, 27 Nov 2026 03:40:45 +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=1795750844; b=j9jUjk4a7rYPTKLnvmbjwo5Y8ou/xEcDwQSQJLP+xQNzTD4QZc7hSqedj8/UZpTGyxiJ Ld2XOr+QExKmOcOSMG1eCo+Ps6x0G34mnq3sf9W6rxKVcJJpIpOUcsd7MfEoGOFyR/7vF AHIAjkZxD5n5ASyE5Z3f0JlLxOTNIrZTErHhAJnXLVDA23WaRneLoCm70HjMEeWJbyCOx /uGOYRBxv0XTJgCsmrMlxubYzKrUzAOKh3SnIUmiMNb643HfDJFbzYVWiCGrIWZvTjWgB E1M6WULtQMkjkSHkmusjbHK84d1xE7QwdyOrDatP6IKsgmCxfbsj01O+Vsf8QaIOUyg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795750844; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=8/qQkcae65QKdmEUw9cyp/yjiIcf3CtxelHf3pV2GhU=; b=qQPRbpa19aigq+h58Y/2cvB2nF+bs0CV/H90sb516y5xYWUBRVlnInX/LtDqYVUYMwRa qAliZMH/1+B03zl7Y9ulSxi3Q5zx3OMnYVYzNW7uMdltKBECQ56F8nNcd3pBjSMyemVIF JxqNl2naQrKiN1x2iJj6+9gEimC2DFug6ALEY/IaOUkp+IUePAzxR9pJw1QWC2rzc8gk4 UYO9bhfY4ipP4azRMwPIL8a6CoNDtrOaV1TONdl5nGtKw5bJC1iNlMdCoCMN0I3AKvecj Npu/F+Jt4Ddoxka0sNqO7xCnMKzN+7JmkLkg7bNGSaQvuPOGYerN4FoDZX8psX/yHTA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=orESze8m; 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 931FA606A32A; Fri, 27 Nov 2026 03:40:44 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=orESze8m X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795750838; b=hafrZBCjRMM8Yzd6a2w7JH0mv/unIMK45QqHKdPPJr8S743xYLohOcT3MYMYFMe8OalC JsZyYq324c6DUr7NCpLxUFQ8IhtZSB23uFclvrGFyWBU8sXNA/B9WvEzKZ2kgYF2iSwCx H31QQ/TqpofUk5vjplSZpwjN13ASJYafDAk9pvJ65pBNHU+o1NnODvsRdDwICPa7nVYwD yFx06VoL5u+uEE42ihHXGdInA4LSAOzUolijXzc9FTI+d+JRPAZ7yX9JgyQbwTb8YkuuL xBeedSQKelmNoDT7taonWgZYgRvfTEQi1Awi844GCOmXCKFHg3QftnU4eqVRL5xLaJA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795750838; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=8/qQkcae65QKdmEUw9cyp/yjiIcf3CtxelHf3pV2GhU=; b=0tKnfwuLQ7dFai20c905L4wz2G7zyogdGDyh67SY7ZZH8JjTbGc0AMMV7fos5FnHH+r1 8vbIFKxc/wHX4ZKz6/ygkn0O0JCbt8kpg76/OW+TQmyV36dUBnPIdsLIR2r2gS8bsEi7u eud9ox6WV3OBBYXL2rIdNTTR8R1NycpMw9DR51xztahzONW2MzSOii6epRiUPwhGJ9LtS DD/DsxIA8mjPId7HsOJgqXWZKXla9hrgcI0S3e5Ts3MHgZ4VLzSG6WhYz0Ukre1fQBNiD iGyFWofYLdKkM9kWoH5JEDe4pYTlta9/bEJUXQhelz4sid/yYEVF6T8Ef23o1BEGh8g== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=orESze8m; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFF35606A31C; Fri, 27 Nov 2026 03:40:38 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCD3C1F000C1; Fri, 27 Nov 2026 03:40:37 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795750838; bh=8/qQkcae65QKdmEUw9cyp/yjiIcf3CtxelHf3pV2GhU=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=orESze8mqEofav3l7R19Sv4/btDUWEWOypOTmQ/g2jKWZTVlzbKqlVvY9p68bJUCH RFZiUo8W8e4EPJ0siaXMvKlk7fKpP2+blPFQALlcAuzsY2VZm/3GC4QsC7zR29wgDb DFViYlToNj0AbaMEBfBaJx9OW6lQV2KkdSjlStec4dNQEqqeoIwo+zVOjm5NmbvcbM +BdMSu/NM6eKUpSC1qaYe9edZ0ehtjmaaR9TbXb9Dki53KjjBRJ44DgrY9M/tO4V0k 2CxkfaSTTsGR1T7SRwvavnSlgv8UGnvapbcCyMuZ11o40FonaKgbRqx5jy0OoStY3W /cYlBPncFO79g== X-Cc: achender@kernel.org, andy.grover@oracle.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com, linux-kernel@vger.kernel.org, stable@vger.kernel.org, zijie4@illinois.edu X-In-Reply-To: <20261125-h047-send-v2-1-b29031cf6b93@illinois.edu> X-sashiko-severity: High 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