Article View: linux.kernel.netdev
Article #4498Re: [rds-devel] [External] : Re: [PATCH net] RDS/IB: validate receive completion payload length
From: Allison Henderson
Date: Sun, 18 Oct 2026 05:38
Date: Sun, 18 Oct 2026 05:38
109 lines
9834 bytes
9834 bytes
On Fri, 2026-10-16 at 13:18 -0700, Gerd Rausch wrote:
> Hi,
>
> On 2026-10-06 18:13, Allison Henderson via rds-devel wrote:
> > > --- a/net/rds/ib_recv.c
> > > +++ b/net/rds/ib_recv.c
> > > @@ -949,6 +949,15 @@ 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,
> > > + "incoming fragment payload length %u, expected %u; "
> > > + "disconnecting and reconnecting\n",
> > > + data_len,
> > > + min_t(u32, ic->i_recv_data_rem, RDS_FRAG_SIZE));
> > > + goto done;
> > > + }
> > > +
> > > list_add_tail(&recv->r_frag->f_item, &ibinc->ii_frags);
> > > recv->r_frag = NULL;
> > >
> How does forcing a reconnect help this situation?
>
> After the reconnect, the sender submits the exact same (incorrect) message again,
> which it kept in "cp_retrans".
>
> Therefore, the exact same conditional triggers again.
>
> All but the last fragment of an RDS/IB message are expected to be of RDS_FRAG_SIZE.
>
> While there's no good protocol specification (to the best of my knowledge),
> posting an insufficiently large message can be seen as protocol violation.
>
Hi Gerd,
First, some bookkeeping to catch up with: this patch was submitted
slightly after Shubham's "RDS/IB: validate receive fragment completions",
which effectively the same patch. Shubham's variant went through a few
revisions on netdev and is now in the net tree as 65cf6863606b. It
varies only slightly, so your questions still apply, but to a different
patch and one that's already merged:
https://lore.kernel.org/netdev/20261013025729.40815-1-shubham@octane.security/
On the retransmit loop: cp_retrans only matters if the sender is our
own RDS stack, and our stack can't produce the fragment this check
rejects. rds_ib_xmit() posts every fragment but the last at
RDS_FRAG_SIZE, because the scatterlist entries it works from are full
pages except the final one. It even BUG_ONs if it's ever asked to
resume a message at an offset that isn't a multiple of RDS_FRAG_SIZE,
which can only hold if everything sent so far went out in full
fragments.
MSG_ZEROCOPY is the only path that produces odd-sized entries, and
rds_sendmsg() refuses it for anything but TCP. So a Linux peer never
trips this, before or after a reconnect. The peer that does trip it
is already off the protocol, as you say, and whatever it retransmits
isn't governed by our cp_retrans.
> Therefore, apart from security concerns, the previous behavior of garbage-in / garbage-out
> is IMO better than this behavior of just endlessly forcing a reconnect.
The trouble is that the garbage going out wasn't the sender's. The
receiver delivered h_len bytes of a page that only had data_len bytes
written into it, so the tail was whatever the page held before: an
earlier message to another socket (the report demonstrated this across
UIDs), or unzeroed memory on a fresh page. That's the bug. And
refusing to deliver it is the whole fix.
Dropping the connection is also what rds_ib_process_recv() has always
done for the neighbouring case, a fragment whose header doesn't match
the message in progress. That check has been there since 1e23b3ee0e94
and has the same "a misbehaving peer can keep us reconnecting"
property. This patch doesn't add a new failure mode, it just closes
the one way a malformed fragment could still get through.
>
> If there's a strong desire to address this issue, the sender should be
> told to discard the message. A reconnect doesn't address this issue.
>
I don't think there's a way to say that today. The RDS header flags are
congestion-bitmap, ack-required, retransmitted and the extension-header
bit. The only error a receiver can signal to its peer is to drop the
connection.
A per-message reject would be a protocol extension that both ends have to
implement. But that would be net-next material, and it couldn't help
against the only peers that actually send these. I'd be happy to review it
if someone wants to take it on, but I don't think it should hold up a stable
fix for a data disclosure.
Hope that helps!
Allison
> Thanks,
>
> Gerd
>
Technical Details
Message-ID:
<f1504e3ae8da8789bcd6cd474ce51fec7dd15555.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-347950-linux-kernel-netdev=dewy.ruReferences:
<20261006205204.1322102-1-tjdqudcks0424@naver.com> <c1efb25a93739dfe2c16828bbcdc9bd7535850c1.camel@kernel.org> <7e69b862-7cad-443f-912b-ce2db7854d60@oracle.com>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-347950-linux-kernel-netdev=dewy.ru From: achender@kernel.org (Allison Henderson) Newsgroups: linux.kernel.netdev Subject: Re: [rds-devel] [External] : Re: [PATCH net] RDS/IB: validate receive completion payload length Date: Sat, 17 Oct 2026 22:38:09 -0700 Organization: Usenet Network Message-ID: <f1504e3ae8da8789bcd6cd474ce51fec7dd15555.camel@kernel.org> References: <20261006205204.1322102-1-tjdqudcks0424@naver.com> <c1efb25a93739dfe2c16828bbcdc9bd7535850c1.camel@kernel.org> <7e69b862-7cad-443f-912b-ce2db7854d60@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="3241198"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:eznNWkDSRwC3iy07cVMpgUQr1IY= sha256:OYO/jTzisB7dZnXo1Sj3VSxyXTCUYllaBM0NlA1utVM= sha1:01GfESSz4PQHNXw5nLmsw31xHUU= sha256:B5ZpOScHHzrYrx6Kme7s323xuBserVyJpVuGuefkgOo= 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 A043B125A41; Sun, 18 Oct 2026 08:38:34 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.64 X-Spam-Status: No, score=-3.64 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, 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 hSN0iVWeyxUL; Sun, 18 Oct 2026 08:38:26 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-347950-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 8D049125A3F; Sun, 18 Oct 2026 08:38:15 +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 5A86932F95; Sun, 18 Oct 2026 05:38:13 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 311753A9DBE; Sun, 18 Oct 2026 05:38:12 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VATH8ohg" 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 F3021348C6D; Sun, 18 Oct 2026 05:38:10 +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=1792301892; cv=none; b=CucdcSAf0f/vzCrArnhv4LDnE+lx+xzkl1qiB3KDbj2oRXsXgBc1EU6r0SueuMxZetTHcGRa7OIaqmkJGmlQuOhAcjr2BAcTlFrJ54WyiZsF01V283K+nLPg2j7n8gXdooIXkWW9F/P/o9iPBDYuRyR8C7KU3N0Cbg+PMNE7PU0= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792301892; c=relaxed/simple; bh=lpYfcbbp/dqOjzrL/y9t5SP6QJzos/hzcl6m09z3C0A=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=N59bn/rXky5JHcbOjIuR6kn+juD4cZO5JN4POC1f5vVMQNfxo1E2LXDPMPoZRxJD5KeIvZuN3WVZf0MzC/YwFignbQaYuognXqWojflY1Z+9aVEuAS8n3jgfqMM8P1azqIonn9mvPqQHGLv3wnFXWFjiL4xiTpnAx9U0PeIzBlM= 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=VATH8ohg; arc=none smtp.client-ip=100.103.45.18 X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02E501F000C4; Sun, 18 Oct 2026 05:38:09 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792301890; bh=Vtx062sMT267uR+1dahU2irvboi7cB2dSCiWZpp1Ywk=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=VATH8ohgIu8qqwvA8JX2vSZyjpWv2YecLAyICL7soR5e0gFRAGG5j86lrVfbu5Tje cKkxlezUn4iyYGUspZ81W8jUmha7yrX5g33HHIQBjSeqkf1pWsZuFWiicFHfgfOMmq yodAcsh/FCukeCXLlw+GJqY69YQrH+7CI3Yqr7z2soaE1erqokxS1A/okOgXTdZ9Eu EceqhVjW1Sd9FzslpDYJyH59BgHtSQrDSqWNfmM9qTkODQ9eYZbZlga6nN1BuX5N+X +tbelCAV04Be9Iwx+qeNKg3W4cLfPJ24RRC5ShsyOJPUAu5KNeYfEUJnQRWNy5aPJw sYxAyw/1vqTkQ== X-Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com, linux-kernel@vger.kernel.org X-In-Reply-To: <7e69b862-7cad-443f-912b-ce2db7854d60@oracle.com> 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>