Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH v8 0/2] RDMA/rxe: copy send WQE to kernel buffer before processing
@ 2026-10-30 16:50 Tristan Madani
  2026-10-30 16:50 ` [PATCH v8 1/2] " Tristan Madani
  2026-10-30 16:50 ` [PATCH v8 2/2] RDMA/rxe: copy send WQE to kernel buffer in completer path Tristan Madani
  0 siblings, 2 replies; 5+ messages in thread
From: Tristan Madani @ 2026-10-30 16:50 UTC (permalink / raw)
  To: Zhu Yanjun, Jason Gunthorpe, Leon Romanovsky
  Cc: linux-rdma, linux-kernel, stable, Tristan Madani

The SoftRoCE send queue is mmapped into userspace. Both the requester and
completer read WQE fields directly from shared memory, so userspace can
modify them between kernel reads.

This series copies each send WQE to a kernel-private buffer before
processing in both the requester and completer paths, with field-level
writeback to the shared queue and cache invalidation on completion,
retry, and QP reset.

Patch 1 covers the requester path (req_next_wqe).
Patch 2 covers the completer path (get_wqe).

Changes since v7:
  - Patch 1/2: reject atomic write WQEs with oversized resid to
    prevent OOB read in finish_packet() (sashiko finding).
  - Patch 2/2: write back DMA progress before invalidating completer
    cache on error retry, so req_retry() resumes multi-packet reads
    from the correct offset (sashiko finding).
  - Patch 2/2: invalidate completer cache in COMPST_RNR_RETRY to
    prevent stale state after RNR timer fires (sashiko finding).

Changes since v6:
  - Fixed all sashiko review findings (2 Critical + 9 High).
  - FORTIFY_SOURCE: memcpy into enclosing struct, not inner member.
  - Copy size: max(max_sge * sizeof(ib_sge), max_inline).
  - Opcode bound: IB_WR_REG_MR (was IB_WR_ATOMIC_WRITE).
  - Requester: removed silent num_sge clamp, use mask=0 for invalid opcodes.
  - Completer: validate num_sge + cur_sge, preserve smp_load_acquire state.
  - Both paths: DMA progress writeback (resid, cur_sge, sge_offset).
  - Completer: *wqe_p = NULL for posted state, invalidate on retry.
  - Addressed Zhu Yanjun review feedback.

Changes since v5:
  - Added opcode bounds check and num_sge clamp after copy.

Changes since v4:
  - Resent from the correct sender address.

Changes since v3:
  - Copy full queue element (max_sge SGEs) instead of per-WQE size.
  - Invalidate on QP reset, ERR flush, RESET state check.

Changes since v2:
  - WRITE_ONCE/smp_store_release for field writeback.

Changes since v1:
  - Split into per-path patches. Cache across multi-packet ops.

Tristan Madani (2):
  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  | 75 +++++++++++++++++++++++++-
 drivers/infiniband/sw/rxe/rxe_qp.c    |  2 +
 drivers/infiniband/sw/rxe/rxe_req.c   | 71 ++++++++++++++++++++++---
 drivers/infiniband/sw/rxe/rxe_verbs.h | 12 +++++
 4 files changed, 151 insertions(+), 9 deletions(-)

-- 
2.47.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-30 17:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-30 16:50 [PATCH v8 0/2] RDMA/rxe: copy send WQE to kernel buffer before processing Tristan Madani
2026-10-30 16:50 ` [PATCH v8 1/2] " Tristan Madani
2026-10-30 17:04   ` sashiko-bot
2026-10-30 16:50 ` [PATCH v8 2/2] RDMA/rxe: copy send WQE to kernel buffer in completer path Tristan Madani
2026-10-30 17:13   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox