Article View: linux.kernel.netdev
Article #3435Re: [PATCH net v4] RDS/IB: validate receive fragment completions
From: Allison Henderson
Date: Thu, 15 Oct 2026 02:15
Date: Thu, 15 Oct 2026 02:15
104 lines
9741 bytes
9741 bytes
On Tue, 2026-10-13 at 08:27 +0530, Shubham Antil wrote:
> rds_ib_process_recv() accounts every receive fragment as contributing
> min(i_recv_data_rem, RDS_FRAG_SIZE) bytes, regardless of the completion
> length. When a completion is shorter than the header-declared amount,
> receive accounting can advance beyond the payload supplied by the
> completion.
>
> Only an IB_WC_RECV completion has the buffer layout expected by this
> receive path. Other successful completion opcodes must not be interpreted
> as ordinary receive completions.
>
> Reject successful completions with any other opcode before processing
> their length. For ordinary receive completions, require enough payload
> to cover the amount accounted to the fragment before linking its page
> into the incoming message.
>
> This is compatible with the current transmit paths. MSG_ZEROCOPY is
> restricted to RDS/TCP, while RDS/IB copied and page-vector messages use
> full-sized non-final scatterlist entries.
>
> Found during an LLM-assisted source audit and validated under KMSAN with
> a malformed short receive completion.
>
> Reported-by: sungbyeongchan <tjdqudcks0424@naver.com>
> Closes: https://lore.kernel.org/netdev/20261006205204.1322102-1-tjdqudcks0424@naver.com/
> Reported-by: Giovanni Vignone <gio@octane.security>
> Link: https://lore.kernel.org/netdev/8a6ee1d5336ae65b8ffdc8c40a1135657207e204.camel@kernel.org/
> Reported-by: Robert van Eijk <robert@octane.security>
> Link: https://lore.kernel.org/netdev/8a6ee1d5336ae65b8ffdc8c40a1135657207e204.camel@kernel.org/
> Reported-by: Paolo Gentry <paolo@octane.security>
> Link: https://lore.kernel.org/netdev/8a6ee1d5336ae65b8ffdc8c40a1135657207e204.camel@kernel.org/
> Fixes: 1e23b3ee0e94 ("RDS/IB: Receive datagrams via IB")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM (OpenAI Codex, gpt-5.6-sol)
> Signed-off-by: Shubham Antil <shubham@octane.security>
Thanks Shubham,
This version looks good to me. I also tested it and found no regressions.
Reviewed-by: Allison Henderson <achender@kernel.org>
Tested-by: Allison Henderson <achender@kernel.org>
Thank you!
Allison
> ---
> Changes in v4:
> - Reject malformed short fragments instead of normalizing their length.
> - Reject successful non-IB_WC_RECV completions before trusting byte_len.
> - Explain why MSG_ZEROCOPY cannot reach the RDS/IB transmit path.
> - Add the source-audit and KMSAN discovery details.
> - Remove the author's self-Reported-by while retaining linked reporters.
> - Leave maximum h_len validation to a separate investigation.
>
> v3: https://lore.kernel.org/netdev/20261008124940.13371-1-shubham@octane.security/
> v2: https://lore.kernel.org/netdev/20261007062135.49946-1-shubham@octane.security/
>
> net/rds/ib_recv.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c
> index bd6cb3ffaa..aa50b85b0f 100644
> --- a/net/rds/ib_recv.c
> +++ b/net/rds/ib_recv.c
> @@ -949,6 +949,12 @@ static void rds_ib_process_recv(struct rds_connection *conn,
> }
> }
>
> + if (data_len < min_t(u32, ic->i_recv_data_rem, RDS_FRAG_SIZE)) {
> + rds_ib_conn_error(conn,
> + "fragment shorter than header-declared length; forcing reconnect\n");
> + goto done;
> + }
> +
> list_add_tail(&recv->r_frag->f_item, &ibinc->ii_frags);
> recv->r_frag = NULL;
>
> @@ -1004,7 +1010,12 @@ void rds_ib_recv_cqe_handler(struct rds_ib_connection *ic,
> * event is processed.
> */
> if (wc->status == IB_WC_SUCCESS) {
> - rds_ib_process_recv(conn, recv, wc->byte_len, state);
> + if (wc->opcode != IB_WC_RECV)
> + rds_ib_conn_error(conn,
> + "recv completion had unexpected opcode %u, disconnecting and reconnecting\n",
> + wc->opcode);
> + else
> + rds_ib_process_recv(conn, recv, wc->byte_len, state);
> } else {
> /* We expect errors as the qp is drained during shutdown */
> if (rds_conn_up(conn) || rds_conn_connecting(conn))
>
> base-commit: 72d3fcf802c45d00b300f25b848a93c3a2bd7c7e
Technical Details
Message-ID:
<b5d28ed79b3d7039aadeb445b62882cf3e970c7a.camel@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346521-linux-kernel-netdev=dewy.ruReferences:
<20261013025729.40815-1-shubham@octane.security>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346521-linux-kernel-netdev=dewy.ru From: achender@kernel.org (Allison Henderson) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v4] RDS/IB: validate receive fragment completions Date: Wed, 14 Oct 2026 19:15:09 -0700 Organization: Usenet Network Message-ID: <b5d28ed79b3d7039aadeb445b62882cf3e970c7a.camel@kernel.org> References: <20261013025729.40815-1-shubham@octane.security> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="2432514"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:iy+2KIHzDBVaUVJds+6XuPrm19s= sha256:Hb2uy+PwrPW8VeWd64idBK+IXZBCzupYUtnGnfLTTyk= sha1:Y1Br66zlecbJhBo/Zq9MgYQl+3U= sha256:hFtxsFKOIE0nuhLa1ws2JWhRPdwVmZQSX33NmyYGVNY= 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 9D930110231; Thu, 15 Oct 2026 05:15:41 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -1.34 X-Spam-Status: No, score=-1.34 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, 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 KxiQkgDhtg0e; Thu, 15 Oct 2026 05:15:34 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-346521-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id AF0DB1101A3; Thu, 15 Oct 2026 05:15:24 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by tor.lore.kernel.org (Postfix) with ESMTP id 156B033656; Thu, 15 Oct 2026 02:15:14 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C9483BB9E0; Thu, 15 Oct 2026 02:15:13 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NLKTo0dF" X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2DD03B995E; Thu, 15 Oct 2026 02:15:11 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792030513; cv=none; b=uLiBcrQNYcFF3SVwva0Gu1HATBhfMg3AyG2p0RFEo2axRFEF81Fwmu5Yt7WQzMhaO3n+jY5aDaSD49qA07ULIzeuC2kaVyUREcfBTGdCQj7EAZW+JTJ77IBniRBsWSmbj4aGfdrrzuJI3mzQtDMOpWB4+q/eZ+ppRqCmi5bQD/I= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792030513; c=relaxed/simple; bh=nC+Ea8VuZ9s/+ylbktqMK3Faszr0wVmFAFNiGBbdnGQ=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=K3+oJcZklJ4zljCYJcCWUFYO8Qoh4KPFHFvEbBOil9JZOIbA9H7Sok1503eA4YC6QzV0c5wsX9VAyhKPRb1YONHa0dPvbz6XKmhwKdjqtJuul/GSL7/rB9BSSTZWo7xqZENiWCdgmSmB/vZVVFqhmS+s432srDmWaHOUI25BCNk= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NLKTo0dF; arc=none smtp.client-ip=100.103.45.18 X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA6031F000C4; Thu, 15 Oct 2026 02:15:10 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792030511; bh=+rXf/xKMRpoP2YDqUubFyOYnj4r2y2GwZMRV5dIrDGg=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=NLKTo0dFxGsWNzHpSl2OQ2luouswLzOdwtk9AnHnvstPmwFTCX3ieaNOKmKkMWC4q C5t5S1IdQADX1K+gZm3sPg0WV7Pyfw1N+Nkx88jmTyMAnCNVtdSxTTehSh+A6CNirR 6EmaA19yWRott3XaK8MoVwjZMvy5RgFkd2ScUyzYBeUzoLbJ12WYvukBG4vPkfFRnH I/HCjCwDrFVtnSRbHs7KaJmkjmuoiaQQgELsfDWOHdLDDZEuFEYokvOTK/2gXKD9dR ElnWpyLwsAlnRefG2rOe+4kj6Tj0UA2Llv+YnhFU2Fxs6kTwEvURuO5iokFXJq5jXf /bhU3j/tfZxiw== X-Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, andy.grover@oracle.com, linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com, linux-kernel@vger.kernel.org, gio@octane.security, sungbyeongchan <tjdqudcks0424@naver.com>, Robert van Eijk <robert@octane.security>, Paolo Gentry <paolo@octane.security>, stable@vger.kernel.org X-In-Reply-To: <20261013025729.40815-1-shubham@octane.security> X-User-Agent: Evolution 3.52.3-0ubuntu1.1 X-Precedence: bulk X-Mailing-List: netdev@vger.kernel.org X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>