Article View: linux.kernel.netdev
Article #85Re: [PATCH net] net/rds: ib: drop fragments shorter than the header-declared length
From: Allison Henderson
Date: Wed, 07 Oct 2026 06:06
Date: Wed, 07 Oct 2026 06:06
121 lines
10283 bytes
10283 bytes
On Wed, 2026-10-07 at 07:13 +0530, Shubham Antil wrote:
> Hi Allison,
>
> Thanks very much — I'll carry your Reviewed-by on the next revision:
>
> Reviewed-by: Allison Henderson <achender@kernel.org>
>
> And no objection at all to crediting the earlier private report:
>
> Reported-by: sungbyeongchan <tjdqudcks0424@naver.com>
>
> This bug was found and reported by our team at Octane Security. Would
> it be okay if we add Reported-by tags for the people on our side who
> reported it along with the first reporter in the V2 patch?
>
> Reported-by: Shubham Antil <shubham@octane.security>
> Reported-by: Giovanni Vignone <gio@octane.security>
> Reported-by: Robert van Eijk <robert@octane.security>
> Reported-by: Paolo Gentry <paolo@octane.security>
Sure, that's fine. Thank you!
Allison
>
> I'm happy to send a v2 with everything folded in - your Reviewed-by,
> sungbyeongchan's Reported-by and ours. Just let me know which you
> prefer.
>
> Thanks again,
> Shubham Antil
>
> On Wed, Oct 7, 2026 at 6:43 AM Allison Henderson <achender@kernel.org> wrote:
> >
> > On Tue, 2026-10-06 at 18:27 +0530, Shubham Antil wrote:
> > > rds_ib_process_recv() accepts an incoming RDS/IB fragment once the
> > > receive completion reports at least an RDS header
> > > (data_len >= sizeof(struct rds_header)). It then trusts the
> > > header-declared total message length h_len: for the first fragment of
> > > a message it stores be32_to_cpu(hdr->h_len) in ic->i_recv_data_rem,
> > > and rds_ib_inc_copy_to_user() later copies up to h_len bytes from the
> > > fragment pages to userspace on recvmsg().
> > >
> > > The number of payload bytes actually received into the fragment page is
> > > data_len (after subtracting the header), but it is never checked against
> > > the amount the fragment is accounted to contribute to the message,
> > > min(i_recv_data_rem, RDS_FRAG_SIZE). A fragment whose header advertises
> > > a larger h_len than the payload it delivers is still linked onto the
> > > reassembly list. The fragment page comes from the per-CPU receive cache
> > > and is not zeroed, so rds_ib_inc_copy_to_user() then copies up to h_len
> > > bytes to the PF_RDS reader, including the uninitialized tail the receive
> > > never wrote.
> > >
> > > Reject a fragment that carries fewer payload bytes than it is accounted
> > > to contribute before linking it onto the reassembly list.
> > >
> > > The issue is reproducible under KMSAN with two hosts over rdma_rxe
> > > (Soft-RoCE); the same reproducer confirms the fix stops it.
> > >
> > > Fixes: 1e23b3ee0e94 ("RDS/IB: Receive datagrams via IB")
> > > Assisted-by: Claude:claude-opus-4-8
> > > Signed-off-by: Shubham Antil <shubham@octane.security>
> >
> > Hi Shubham,
> >
> > Thanks for working on this. This patch looks good to me, you can add my rvb:
> > Reviewed-by: Allison Henderson <achender@kernel.org>
> >
> > Also, this bug was found and reported privately by another contributor, whom I had
> > counseled to send a patch publicly before I had noticed this one.
> > https://lore.kernel.org/netdev/20261006205204.1322102-1-tjdqudcks0424@naver.com/
> >
> > I find that patches equivalent, and this patch was posted first. But I would like to apply
> > the reported by tag since sungbyeongchan was the first to report it.
> > Reported-by: sungbyeongchan <tjdqudcks0424@naver.com>
> >
> > Thank you both for working on this bug!
> > Allison
> >
> > > ---
> > > net/rds/ib_recv.c | 9 +++++++++
> > > 1 file changed, 9 insertions(+)
> > >
> > > diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c
> > > index bd6cb3ffa..fee77b6d7 100644
> > > --- 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,
> > > }
> > > }
> > >
> > > + /* h_len must be backed by the payload actually received (data_len),
> > > + * else the unwritten frag-page tail is copied to userspace.
> > > + */
> > > + 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;
> > >
> >
Technical Details
Message-ID:
<8a6ee1d5336ae65b8ffdc8c40a1135657207e204.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-342217-linux-kernel-netdev=dewy.ruReferences:
<20261006125720.81227-1-shubham@octane.security> <661e8b900c97d701382af26462bead7277eaa41f.camel@kernel.org> <CAEBzjKEFZdKWHa5puYH6dKvaesCf-KGmZ+Z=fFECRi_0PhiY_A@mail.gmail.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-342217-linux-kernel-netdev=dewy.ru From: achender@kernel.org (Allison Henderson) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] net/rds: ib: drop fragments shorter than the header-declared length Date: Tue, 06 Oct 2026 23:06:26 -0700 Organization: Usenet Network Message-ID: <8a6ee1d5336ae65b8ffdc8c40a1135657207e204.camel@kernel.org> References: <20261006125720.81227-1-shubham@octane.security> <661e8b900c97d701382af26462bead7277eaa41f.camel@kernel.org> <CAEBzjKEFZdKWHa5puYH6dKvaesCf-KGmZ+Z=fFECRi_0PhiY_A@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="587704"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:1O8///uCH9RqAI/1IxLf5h3TuPw= sha256:GHgms/Swhd4r6HH5oXiMMfUCsOvw0mRDQLPbJJB39aI= sha1:UjTUibPetW1W2wzRvfASY9UkIJM= sha256:qdhKn9+489cmCYNqId/2ffNtPz7Oam4daFVoYVeu0DA= 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 7AF7910F0F0; Wed, 7 Oct 2026 09:08:01 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.641 X-Spam-Status: No, score=-3.641 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.241, 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 S07gaV-WETnJ; Wed, 7 Oct 2026 09:07:58 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-342217-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 CF64810F054; Wed, 7 Oct 2026 09:07:54 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id 0A88F26745; Wed, 7 Oct 2026 06:06:29 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC83B3F1AD3; Wed, 7 Oct 2026 06:06:28 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jptXhDFi" 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 AD2D83DC4B6; Wed, 7 Oct 2026 06:06:27 +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=1791353188; cv=none; b=aQHxWwzos1wKDKPE9pjdgxAHyL5gXlcvAjsar1gmMvWd5bT837qn0opKw6lDJUTgxySpCycaScH/kaSmGyARcGj5ej2FLt+OdWVfG+o6Smz6KcWy6vD4RJQIX4+OMcF2PtOY9S6CtMNwJjGmTwMPdlcGpcVIu9Bx5dD9ZPBWyhk= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791353188; c=relaxed/simple; bh=Y8hgSlKcZdst4akLUIhYEfpydL2AlM7dh1YB5EurAhw=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=EeHJENM9QrqJ97R0gHDRlRbpDlN5i5bgGDstsAjAu8hDEuNz80hLVLS5SMjtTLr0yMFz0GXR26UWtqv9kLzVWUVE++Itl/zDQ9D44I+OIktpwSu9jqcaZTcSmyoq0IKK86q+9tUq9ZS7mDmKxK+8rP/h87Gt4fDMBbWrBRIGpAk= 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=jptXhDFi; arc=none smtp.client-ip=100.103.45.18 X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E77CB1F0089D; Wed, 7 Oct 2026 06:06:26 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1791353187; bh=30i1+/6CEnTdtu6RDIJk92KycF7EWDwxoP3fTD81ago=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=jptXhDFiBOA9qc+bjMA1h6vQ7HXMkmsEPzhghR1pnbeyi6BQ5yPwJV4S+kfeiHNyK T3lXuFSDzAGSWFHECC/aUiObjtVLGgwd2VacQZLTKDczw89QVZOgYBDrJXztR0ymku 6a/py1jtaiQK9DnroKpnU2STTmGtGYmMzNpFGj773B9EmB2eVYF0qfhyhfRwe8GSiY RL/qsoNEL+sm3vC/qSOOMipUvriWDMfx/aP/uh0CfObGYTFor6urfII47bTjJBMW2b X/jelbB5Ge1v7R1DXtQKzsktUt0Fz2xC6kHUKp14xrtevrobL+7oo1hSxB4DlD1Nc2 Hc7XON4chCeEw== X-Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, linux-kernel@vger.kernel.org, Giovanni Vignone <gio@octane.security> X-In-Reply-To: <CAEBzjKEFZdKWHa5puYH6dKvaesCf-KGmZ+Z=fFECRi_0PhiY_A@mail.gmail.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>