Article View: linux.kernel.netdev
Article #5172Re: [rds-devel] [External] : Re: [PATCH net] RDS/IB: validate receive completion payload length
From: Allison Henderson
Date: Mon, 19 Oct 2026 22:44
Date: Mon, 19 Oct 2026 22:44
161 lines
14424 bytes
14424 bytes
On Sun, 2026-10-18 at 18:32 +0000, Gerd Rausch wrote:
> Hi Allison,
>
> > On Oct 17, 2026, at 22:38, Allison Henderson <achender@kernel.org> wrote:
> > On Fri, 2026-10-16 at 13:18 -0700, Gerd Rausch wrote:
> > >
> > > 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?
> > >
>
> [...]
>
> >
> > 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.
>
> Correct. But this check was presumably added for a reason.
>
> 1) An incorrect implementation of RDS (other than the one we're looking at)
> 2) A bad actor, intentionally crafting such messages.
>
> > > 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.
>
> Wait. This patch was created for a hypothetical case, no?
> Based on analysis of "Assisted-by: LLM".
Per Documents/process/coding-assistants.rst it means an LLM contributed in
some way, but sungbyeongchan patch had a reproducer and Shubham validated
it under KMSAN
>
> This patch does *not* refuse to deliver the bogus message.
> That would have been a fine choice.
>
> This patch just drops the underlying connection, in the hopes
> that when this message gets sent again, it'll somehow be different.
The short fragment is never linked, and the half-built inc is freed when the
connection shuts down, so it doesn't reach the socket.
>
> What would make it different?
> Some unknown and non-deterministic sender?
>
> >
> > 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.
>
> How much benefit a 16bit IPv4 checksum calculation adds on top of
> the underlying InifiniBand CRC-32 protection is debatable.
>
> But let's just say somehow (I don't know how) the CRC-32 check missed
> a header corruption that ip_fast_csum() catches:
> You're correct, the connection would be dropped.
> So the assumption here is that this is a transport error,
> that fixes itself with a retransmit, and not that it's a bogus
> or malicious sender.
>
> Does this patch also assume we're looking at a transport
> error, that the CRC-32 didn't catch, and consider that more likely
> than a bad or malicious sender?
>
> I suggest that just dropping this message, not tearing down the connection,
> would have been a much better choice here.
>
> > >
> >
> > > 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.
> >
>
> Not exactly true.
> There's already code for the RDMA_CM_EVENT_REJECTED case to downgrade
> protocol version.
>
> The RDS code can be changed. The RDS protocol can be extended.
> A receiver could be made to tell a sender to drop a message,
> if we'd consider that beneficial.
>
> But in this case, since the message itself violates the "unwritten rules"
> of the RDS protocol, I'd say just dropping the message would be been
> a fine choice.
>
> Dropping the connection however, doesn't do anything.
> It just asks the sender to send the same bogus message again.
>
> > 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.
> >
>
> Again, we don't need to do that.
> Dropping the message would have been a fine choice here.
I think dropping just the offending message, and skipping the rest
of its fragments by sequence, would be a reasonable refinement for
net-next. And it would make sense to treat the header-mismatch exit
the same way at the same time. I'd be happy to review patches for those.
The landed fix does refuse to deliver the message though. The conn drop is
the same policy the other exits in that function use too, so it's the right
solution for stable. Patches welcome on the other points though.
Thanks!
Allison
>
> Thanks,
>
> Gerd
>
Technical Details
Message-ID:
<b5ed40d362375f5e93669a974b1ca03b716afa2a.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-348878-linux-kernel-netdev=dewy.ruReferences:
<20261006205204.1322102-1-tjdqudcks0424@naver.com> <c1efb25a93739dfe2c16828bbcdc9bd7535850c1.camel@kernel.org> <7e69b862-7cad-443f-912b-ce2db7854d60@oracle.com> <f1504e3ae8da8789bcd6cd474ce51fec7dd15555.camel@kernel.org> <30C797F2-FB1B-494D-8E36-B50C58BB8A03@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-348878-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: Mon, 19 Oct 2026 15:44:03 -0700 Organization: Usenet Network Message-ID: <b5ed40d362375f5e93669a974b1ca03b716afa2a.camel@kernel.org> References: <20261006205204.1322102-1-tjdqudcks0424@naver.com> <c1efb25a93739dfe2c16828bbcdc9bd7535850c1.camel@kernel.org> <7e69b862-7cad-443f-912b-ce2db7854d60@oracle.com> <f1504e3ae8da8789bcd6cd474ce51fec7dd15555.camel@kernel.org> <30C797F2-FB1B-494D-8E36-B50C58BB8A03@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="3731441"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:7yQTU0r0YzLfdb1buGtR/K0JJK8= sha256:Lia5Nva5ySqN1iwKdPczrar1acEOlQDe3d7TipwvEfY= sha1:JJORGM427aBsNob59TirGZZlo7I= sha256:HYxmUWs5vZDPSGXt1tnUTMMxlLhP35iVasAzA1ZAUL8= 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 09C55110B61; Tue, 20 Oct 2026 01:44:31 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.729 X-Spam-Status: No, score=-3.729 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.329, 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 SUF8kj-Unz9m; Tue, 20 Oct 2026 01:44:28 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-348878-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 0379F110B5A; Tue, 20 Oct 2026 01:44:19 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id AE64444724; Mon, 19 Oct 2026 22:44:11 +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=1792449851; b=apMG0k6DMt2pPQvavXXQ9MK6Y/VSYwtZX9k5yZxMpSCBwg0eqfIEugubUj9BScIZ8uky RoFIQawniTxDLlPVGJRRP8YlpuTsbCGlPRLXEhYD85cU91BPxU2kqx2V69yPF1HnOhmuy UBdnCDvbAmrVZRhDTcwfDLB32/osbLB0034B3UjgV/KoZYC97Lk6R6x+ppcXSz8R/i5y3 D58FsxLB9SWVu37DXazdDBKZ/4V7pkWWUOLnVH79mNgMNdQU5y4Yo3t4W50rR6zVZ8DVc mSxBN2j83t4yvz+Y2kY/3vuUYBNl9aKyQbZYvw1hpNi37g9D3TdYj4FY3gloikEpjhw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792449851; h=X-Original-To:Received:Received:DKIM-Signature:Message-ID:Subject: From:To:Cc:Date:In-Reply-To:References:Content-Type: Content-Transfer-Encoding:User-Agent:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version; bh=+dNjgBC2+QzhU+cjcTNlNzFVT+rLL5KRnH7o4DHsvCk=; b=06uBu5qjwbnsN3Zvhl++sHgX8m/+Yej01Fy1MQ4rjEngnJFojvrqUioi24TaZbolznWe i1/UqL6qNfII2P3sHtq4bYDa5gBYneZuhqTFFgSovRsaTIoiuNneTiU9dACuGHI5InObi Iz5oLFtwFHztSsuGoGWxmm2f+loJ53PV7gsXrjqufd6G7BIZ8fK2NLndIuLm6mQYbHW6R EYWGvfWDTvKUDw7ixmrvGlZqsiEgWv1pkeZern7xst+PMvrumx7QZsqZJqox+R+4ImfLi ApJpKyxsJmWPoptIMZkzJumuG05a2wX5UXhcPGNq7OZEMEIZP+OkAmxng9jMKiSJq1A== 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=iKISpuaY; 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 E5F38606A324; Mon, 19 Oct 2026 22:44:10 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iKISpuaY 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=1792449845; b=qUO8WLGWxmaGfBv+CA0nU7KrvayRs8BhrIe2u72+x3o93ruOVD40E0DWIYnkX+4YDd2s dd0cYrONu2xvTOPHMCwfrMG4cjOVqqTSJnRpEJUe7OHXHtydFHajje9MpxbSpIQoK5XXx j0ZEOHnynz+j0c+t6NkPnX4gyIZM6ZrnB2cOPbWMtbPZO71nqEOosWD1Zpu24c1U942t2 4wV6seOzczJjG0aiL7dbKjbzHvSQ4X2X5Biv921jV/AeP1VdFjfuLod/Ehnw0R2/nD3sT gLTfVj/AWpij81YxCh/IbPHa9n45omj+FtMlWMsbRHrd0fAvFgTQ6NmatRvZJblTSBw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792449845; h=Received:DKIM-Signature:Message-ID:Subject:From:To:Cc:Date: In-Reply-To:References:Content-Type:Content-Transfer-Encoding: User-Agent:MIME-Version; bh=+dNjgBC2+QzhU+cjcTNlNzFVT+rLL5KRnH7o4DHsvCk=; b=HzSwkntTqFigLgzQcCMkm+C9aK+ZmwpzeQnqSaiYLLNXrva7DUpQcEkBPq+ezI7OBWob j8O/19MoAdCAzg6ew6lBydJnyBxq9fVLR4+4dBY1JYlxcEErionMc7YhLi+U6Lmty36u+ nFAZ/lBhYSAZY5njgUTQNYc/MKM1monE5NSFYID3UIfA18FJsbRvEHEg5jJU31vVy/v/v OTzQauh2rbWGi/rqQm38Kg22jute3uguMJ5U9dUvk5lKUoAv6/JbuR3KPYdiKZZk43IBX zF8H5erIu0WyavPXemmP2HeXDRgebiIoWCgbB8bcu+Ah4uAbyWuVAPYbpxho4C4I+0A== 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=iKISpuaY; 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 BD466606A319; Mon, 19 Oct 2026 22:44:04 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4F4A1F000C4; Mon, 19 Oct 2026 22:44:03 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792449844; bh=+dNjgBC2+QzhU+cjcTNlNzFVT+rLL5KRnH7o4DHsvCk=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=iKISpuaYGy1oGof2BsP8zRzRcOoi/dmugJgX16sfDIJg+7RGTWP0FfD1a+Hz04R4r AG9aNlCv1S6mMdKFOIUC+v38IDqdU0NkbnUxsPaPXfXjerslcrSZEITvBDg7KBVdhO N4h2PFrB//KC1nmOWmU67cnK68RqZ2lbf4+97rEoVFMCPeCBAM76dlcbgupE1PrFWh gF6SbG9H+j65iH7nUpOid2FBblp8mX1aOdH53jnf5q4/dhp9X5hP9NSHk9PKlVfVru pvCIgmn7XmHr/iy5MSghhm3HJrjWHTivGPY3ih6NjyppK8keBU+sbkIzsT+lmSYpmU /8LRYHriQsu4w== X-Cc: sungbyeongchan <tjdqudcks0424@naver.com>, "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, Andy Grover <andy.grover@oracle.com>, "netdev@vger.kernel.org" <netdev@vger.kernel.org>, "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>, "rds-devel@oss.oracle.com" <rds-devel@oss.oracle.com>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org> X-In-Reply-To: <30C797F2-FB1B-494D-8E36-B50C58BB8A03@oracle.com> X-User-Agent: Evolution 3.52.3-0ubuntu1.1 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