Skip to content

RDMA/rxe: copy send WQE to kernel buffer (TOCTOU hardening)

Tristan Madani linux-rdma lkml stable 10 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v10 Latest2 patches 3 repliesApplied
  2. v92 patches 0 repliesSuperseded
  3. v82 patches 0 repliesSuperseded
Earlier versions · 7
VersionPostedPatchesRepliesStatus
v72 patches0 repliesSuperseded
v62 patches1 replySuperseded
v52 patches0 repliesSuperseded
v42 patches3 repliesSuperseded
v32 patches0 repliesSuperseded
v22 patches3 repliesSuperseded
v12 patches3 repliesSuperseded

Changes in v10 from the cover letter

- Patch 1: check dma.resid != sizeof(u64) instead of just > to also catch undersized resid that leaks uninitialized pad bytes.
- Bisection fix: move qp->comp.comp_wqe_valid invalidation from patch 1 to patch 2, where the field is first defined.

Patches in v10 Applied

#Subject and filesSizeRepliesApplied
1/2RDMA/rxe: copy send WQE to kernel buffer before processingdrivers/infiniband/sw/rxe/rxe_qp.c drivers/infiniband/sw/rxe/rxe_req.c drivers/infiniband/sw/rxe/rxe_verbs.h+73 -51 reply
2/2RDMA/rxe: copy send WQE to kernel buffer in completer pathdrivers/infiniband/sw/rxe/rxe_comp.c drivers/infiniband/sw/rxe/rxe_qp.c drivers/infiniband/sw/rxe/rxe_req.c +1 more+82 -21 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchZhu Yanjun
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v10 thread

Cover letter [PATCH v10 0/2] RDMA/rxe: copy send WQE to kernel buffer (TOCTOU hardening)

The SoftRoCE (rxe) send queue is mmap-ed into userspace, allowing the requester and completer to process work queue entries (WQEs) whose fields can change between kernel reads.

This series copies each WQE to a kernel-private buffer before
processing: patch 1 for the requester, patch 2 for the completer. Both paths validate opcode bounds and SGE indices after copying, preserve DMA progress across multi-packet operations, and write back updated fields to the shared queue via WRITE_ONCE / smp_store_release.

Changes since v9:
- Patch 1: check dma.resid != sizeof(u64) instead of just > to also catch undersized resid that leaks uninitialized pad bytes.
- Bisection fix: move qp->comp.comp_wqe_valid invalidation from patch 1 to patch 2, where the field is first defined.

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  | 76 ++++++++++++++++++++++++++-
 drivers/infiniband/sw/rxe/rxe_qp.c    |  2 +
 drivers/infiniband/sw/rxe/rxe_req.c   | 72 +++++++++++++++++++++++--
 drivers/infiniband/sw/rxe/rxe_verbs.h | 12 +++++
 4 files changed, 155 insertions(+), 7 deletions(-)
Signature · 1 line
2.47.3