mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhu Yanjun <yanjun.zhu@linux.dev>
To: Nicolas Morey <nmorey@suse.com>,
	Zhu Yanjun <zyjzyj2000@gmail.com>, Jason Gunthorpe <jgg@ziepe.ca>,
	Leon Romanovsky <leon@kernel.org>,
	Tristan Madani <tristmd@gmail.com>,
	"open list:SOFT-ROCE DRIVER (rxe)" <linux-rdma@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"yanjun.zhu@linux.dev" <yanjun.zhu@linux.dev>
Subject: Re: [PATCH] RDMA/rxe: Use validated num_sge in local buffer
Date: Mon, 7 Sep 2026 20:07:54 -0700	[thread overview]
Message-ID: <4bb04e58-7e69-46bc-9ecf-283605b18340@linux.dev> (raw)
In-Reply-To: <681ae665-523a-441b-bbd8-dbae51ee64f1@suse.com>

在 2026/9/7 14:44, Nicolas Morey 写道:
> On 2026-09-07 23:20, Zhu Yanjun wrote:
>> 在 2026/9/7 9:15, Nicolas Morey 写道:
>>> For both SRQ and non-SRQ receive paths, the WQE is copied into a local
>>> buffer to provide a kernel-owned, validated copy. While calculating the
>>> memcpy size from the validated num_sge prevents overflow during the
>>> copy, memcpy() itself still copies num_sge from shared memory.
>>>
>>> A concurrent userspace modification before or during memcpy() leaves
>>> an unvalidated num_sge in the local buffer, leading to potential
>>> out-of-bounds reads in rxe_resp_check_length() and copy_data().
>>>
>>
>> Hi Nicolas,
>>
>> Thanks for the patch. The logic makes total sense to prevent the TOCTOU race condition after memcpy.
>>
>> Just out of curiosity, do you happen to have a reproducer or a POC script that demonstrates this race in practice?
>>
>> It would be great to know if this can be reliably reproduced or integrated into testing setups (like rdma-core tests, or tools/testing/selftests/rdma) to catch similar double-read issues in the future.
>>
> 
> No reproducer or PoC sadly. I haven't tried to make one though.
> This got caught by one of our AI tools when checking the backport of CVE-2026-74377.

Hi, Nicolas

Thanks for sharing this. Could you clarify whether your AI tool detected 
this purely through static analysis (and provided a suggested fix), or 
if it actually triggered a runtime bug with a backtrace/calltrace?

If you have a calltrace, please share it—that would help a lot in 
understanding the issue. Also, if this was flagged and fixed by a 
specific AI tool, adding an Assisted-by: tag (or referencing the tool in 
the commit description) would be appropriate.

Thanks,

Zhu Yanjun

> 
> I assumed from the 2 existing fixes (ending up as CVEs) that this could happened.
> 
> Nicolas


  reply	other threads:[~2026-09-08  3:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07 16:15 Nicolas Morey
2026-09-07 21:20 ` Zhu Yanjun
2026-09-07 21:44   ` Nicolas Morey
2026-09-08  3:07     ` Zhu Yanjun [this message]
2026-09-08  7:35       ` Nicolas Morey
2026-09-09 14:15         ` Zhu Yanjun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4bb04e58-7e69-46bc-9ecf-283605b18340@linux.dev \
    --to=yanjun.zhu@linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=nmorey@suse.com \
    --cc=tristmd@gmail.com \
    --cc=zyjzyj2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®