From: Zhu Yanjun <yanjun.zhu@linux.dev>
To: Tristan Madani <tristmd@gmail.com>,
linux-rdma@vger.kernel.org,
"yanjun.zhu@linux.dev" <yanjun.zhu@linux.dev>
Cc: jgg@ziepe.ca, leon@kernel.org, zyjzyj2000@gmail.com,
bob.pearson@hpe.com, Tristan Madani <tristan@talencesecurity.com>
Subject: Re: [PATCH v4 0/2] RDMA/rxe: fix TOCTOU races in send WQE processing
Date: Wed, 7 Oct 2026 22:11:50 -0700 [thread overview]
Message-ID: <714b1a9e-560d-4fbb-9dfa-6f1fee5cb13f@linux.dev> (raw)
In-Reply-To: <20261007223222.2342804-1-tristmd@gmail.com>
在 2026/10/7 15:32, Tristan Madani 写道:
> From: Tristan Madani <tristan@talencesecurity.com>
>
> The SoftRoCE driver maps its send work queue into userspace for direct
> posting. The kernel reads WQE fields directly from this shared mapping,
> which allows a concurrent userspace thread to modify fields between
> kernel reads -- classic TOCTOU.
>
> This series copies each send WQE to a kernel-private buffer before
> processing, in both the requester (patch 1) and completer (patch 2)
> paths.
>
> Changes since v3:
> - Copy the full queue element (max_sge SGEs) instead of computing a
> per-WQE copy size from num_sge. This ensures inline data (which
> shares the flex array with SGEs) is always captured, and eliminates
> a TOCTOU on the copy size itself.
> - Clamp dma.num_sge against qp->sq.max_sge after copy (patch 2)
> instead of against the global RXE_MAX_SGE constant.
> - Invalidate the cached copy on QP reset (rxe_qp_reset), on the
> ERR flush path, and on the RESET state check in the requester.
> This prevents stale-cache reuse after state transitions.
> - Each patch now also touches rxe_qp.c for the reset invalidation.
>
> Changes since v2:
> - Addressed review comments on naming and ordering.
> - Writeback status using WRITE_ONCE() instead of plain store.
> - Added smp_store_release() in requester for state transitions.
>
> Changes since v1:
> - Split into per-path patches (requester, completer).
> - Cache the local copy across retransmits and multi-packet operations.
> - Added writeback of completion status and rd_atomic state.
>
> Tristan Madani (2):
Hi,
Please check the feedback from Sashiko.
Thanks a lot.
Yanjun Zhu
> RDMA/rxe: copy send WQE to kernel buffer before processing
> RDMA/rxe: copy send WQE to kernel buffer in completer path
>
> drivers/infiniband/sw/rxe/rxe_comp.c | 53 +++++++++++++++++++++++++-
> drivers/infiniband/sw/rxe/rxe_qp.c | 2 +
> drivers/infiniband/sw/rxe/rxe_req.c | 55 +++++++++++++++++++++++++--
> drivers/infiniband/sw/rxe/rxe_verbs.h | 12 ++++++
> 4 files changed, 116 insertions(+), 6 deletions(-)
>
next prev parent reply other threads:[~2026-10-08 5:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 22:32 [PATCH v4 0/2] RDMA/rxe: fix TOCTOU races in send WQE processing Tristan Madani
2026-10-07 22:32 ` [PATCH v4 1/2] RDMA/rxe: copy send WQE to kernel buffer before processing Tristan Madani
2026-10-07 22:47 ` sashiko-bot
2026-10-07 22:32 ` [PATCH v4 2/2] RDMA/rxe: copy send WQE to kernel buffer in completer path Tristan Madani
2026-10-07 22:48 ` sashiko-bot
2026-10-08 5:11 ` Zhu Yanjun [this message]
2026-10-08 12:01 ` [PATCH v4 0/2] RDMA/rxe: fix TOCTOU races in send WQE processing Tristan Madani
2026-10-08 19:34 ` Zhu Yanjun
2026-10-08 9:37 ` [PATCH v5 0/2] RDMA/rxe: fix send-path TOCTOU races on shared WQEs Tristan Madani
2026-10-08 9:37 ` [PATCH v5 1/2] RDMA/rxe: copy send WQE to kernel buffer before processing Tristan Madani
2026-10-08 9:54 ` sashiko-bot
2026-10-08 9:37 ` [PATCH v5 2/2] RDMA/rxe: copy send WQE to kernel buffer in completer path Tristan Madani
2026-10-08 9:55 ` sashiko-bot
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=714b1a9e-560d-4fbb-9dfa-6f1fee5cb13f@linux.dev \
--to=yanjun.zhu@linux.dev \
--cc=bob.pearson@hpe.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=tristan@talencesecurity.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.