Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Zhu Yanjun <yanjun.zhu@linux.dev>
To: Tristan Madani <tristmd@gmail.com>, 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, 8 Oct 2026 12:34:49 -0700	[thread overview]
Message-ID: <2d95155a-3701-4090-80d1-45e63e7471fa@linux.dev> (raw)
In-Reply-To: <179146091623.3840242.8978910812704841884@gmail.com>


在 2026/10/8 5:01, Tristan Madani 写道:
> 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/

Thanks a lot. I checked the V5 patchset, and Sashiko is still 
complaining about quite a few things. I’m not sure whether the latest 
complaints from Sashiko are different from the previous ones or if they 
are essentially the same issues.

BTW, the V5 patchset is not a standalone patchset. Maybe there is 
something wrong with the way the patchset was sent out.

The following steps can be used to generate and send the latest patchset 
as a standalone patchset:

1. git format-patch -2 -n -s -o ./tmp --cover-letter -v 6
This command generates the patchset, including the cover letter, in the 
`./tmp` directory.

2. git send-email --to linux-rdma@vger.kernel.org --to xxx --to xxx ... 
./tmp/*
This command sends all the patches in ./tmp/ as a standalone patchset.

Thanks,

Yanjun Zhu

>
> Best,
> Tristan

-- 
Best Regards,
Yanjun.Zhu


  reply	other threads:[~2026-10-08 19:34 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
2026-10-08 19:34     ` Zhu Yanjun [this message]
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=2d95155a-3701-4090-80d1-45e63e7471fa@linux.dev \
    --to=yanjun.zhu@linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox