From: Tristan Madani <tristmd@gmail.com>
To: yanjun.zhu@linux.dev
Cc: linux-rdma@vger.kernel.org, jgg@ziepe.ca, leon@kernel.org,
zyjzyj2000@gmail.com, tristan@talencesecurity.com
Subject: Re: [PATCH v4 0/2] RDMA/rxe: fix TOCTOU races in send WQE processing
Date: Thu, 08 Oct 2026 12:01:56 -0000 [thread overview]
Message-ID: <179146091623.3840242.8978910812704841884@gmail.com> (raw)
In-Reply-To: <714b1a9e-560d-4fbb-9dfa-6f1fee5cb13f@linux.dev>
Hi Yanjun,
Thanks for flagging the Sashiko review. I went through all 8 findings
across both patches.
One was a genuine issue: the memcpy size used qp->sq.max_sge * sizeof(sge),
which truncates when max_inline_data is not a multiple of sizeof(struct
ib_sge). For example, if a QP is created with max_inline_data=20, the
integer division gives max_sge=1, and only 16 bytes of the flex array are
copied instead of 20. v5 fixes this by using qp->sq.max_inline directly,
which is the exact data portion size stored at QP creation.
The remaining 7 seem to be false positives:
- FORTIFY_SOURCE (raised on both patches): struct rxe_send_wqe ends
with struct rxe_dma_info which contains __DECLARE_FLEX_ARRAY, so
__builtin_object_size returns (size_t)-1. The merged receive-path
fix (d6ab440240a04) uses the same pattern without issues.
- Inline data / sge_offset / resid / cur_sge validation: these fields
were already unvalidated against max_inline before this series. The
requester path bounds-checks num_sge and cur_sge (lines 754-760 in
rxe_req.c); adding resid/sge_offset validation is a valid hardening
improvement, but it is a pre-existing gap, not introduced here.
- wr_opcode_mask() OOB via untrusted opcode: the call existed at the
same location before this series. We did not add it.
- DMA state writeback for RDMA READ retry: on retry, the requester
changes the WQE state via smp_store_release(). The completer's
smp_load_acquire() detects the change, bypasses the reuse path, and
takes a fresh copy from shared memory with the original DMA offsets.
- ERR flush path barriers: when send_wqe_valid is false, writes go
directly to shared memory, which is identical to the pre-patch
behavior.
- Shared pointer for wqe_state_posted: posted WQEs cause the
completer to return COMPST_DONE/COMPST_EXIT without processing.
v5 is already sent with the max_inline fix:
https://lore.kernel.org/linux-rdma/20261008093740.3034881-1-tristmd@gmail.com/
Best,
Tristan
next prev parent reply other threads:[~2026-10-08 12:01 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 ` [PATCH v4 0/2] RDMA/rxe: fix TOCTOU races in send WQE processing Zhu Yanjun
2026-10-08 12:01 ` Tristan Madani [this message]
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=179146091623.3840242.8978910812704841884@gmail.com \
--to=tristmd@gmail.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=tristan@talencesecurity.com \
--cc=yanjun.zhu@linux.dev \
--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