[PATCH v3 0/2] RDMA/rxe: Fix TOCTOU races on mmap'd send queue
From: Tristan Madani
Date: Wed Oct 07 2026 - 17:28:00 EST
From: Tristan Madani <tristan@xxxxxxxxxxxxxxxxxxx>
The rxe driver maps the send queue into userspace via mmap. Both the
requester and completer process Work Queue Entries (WQEs) directly from
this shared buffer without first copying them to kernel memory. This
allows userspace to modify WQE fields concurrently, causing inconsistent
state in the kernel.
This series fixes both paths:
- Patch 1/2: requester (rxe_req.c) - copy WQE before processing,
with WRITE_ONCE per-field writeback
- Patch 2/2: completer (rxe_comp.c) - same treatment, with reuse
across multi-packet operations to preserve DMA progress
This is the send-path counterpart to the receive-path fixes:
- commit 22b8fbded65b8 ("RDMA/rxe: Fix TOCTOU heap overflow in
get_srq_wqe")
- commit d6ab440240a04 ("RDMA/rxe: Copy WQE to local buffer in
non-SRQ receive path")
Changes since v2:
- Replaced bulk memcpy() writeback with targeted WRITE_ONCE() for
individual fields and smp_store_release() for state transitions,
avoiding the tearing risk of bulk memcpy on the shared queue
- Added smp_load_acquire() in the completer to pair with the
requester's smp_store_release() for state ordering
Changes since v1:
- Same as v2 changes (v2 only covered patch 2/2)
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 | 58 +++++++++++++++++++++++++--
drivers/infiniband/sw/rxe/rxe_req.c | 61 +++++++++++++++++++++++++----
drivers/infiniband/sw/rxe/rxe_verbs.h | 12 ++++++
3 files changed, 119 insertions(+), 12 deletions(-)
--
2.39.5