From: Zhu Yanjun <yanjun.zhu@linux.dev>
To: Jiale Yao <yaojiale02@163.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH] RDMA/rxe: Validate inline data range in user WQEs
Date: Fri, 25 Sep 2026 10:23:28 -0700 [thread overview]
Message-ID: <a1ef2c45-431f-4dad-b812-0b6cccf9ecc5@linux.dev> (raw)
In-Reply-To: <20260924101736.9FA281F000FF@smtp.kernel.org>
在 2026/9/24 3:17, sashiko-bot@kernel.org 写道:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Critical] RDMA/rxe: TOCTOU bypass of inline WQE validation
> --
>
> commit e272f5be8d762ea2e78301c1339c440a19e1130b
> Author: Jiale Yao <yaojiale02@163.com>
>
> RDMA/rxe: Validate inline data range in user WQEs
>
> This commit adds bounds validation for the inline data range in user WQEs to
> prevent kernel memory disclosure or vmalloc out-of-bounds accesses. It checks
> the offset and length against the per-WQE inline area to ensure they fit.
>
> Link: https://lore.kernel.org/all/20260708224534.1206-1-security@auditcode.ai/
>
>> diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
>> index 53f7c1e7fe55b..06b7669d7f737 100644
>> --- a/drivers/infiniband/sw/rxe/rxe_req.c
>> +++ b/drivers/infiniband/sw/rxe/rxe_req.c
>> @@ -716,6 +716,15 @@ int rxe_requester(struct rxe_qp *qp)
>> goto err;
>> }
>>
>> + if (unlikely((wqe->wr.send_flags & IB_SEND_INLINE) &&
>> + (wqe->dma.sge_offset > qp->sq.max_inline ||
>> + wqe->dma.resid >
>> + qp->sq.max_inline - wqe->dma.sge_offset))) {
>
> [Severity: Critical]
> Since wqe points directly to a memory-mapped ring buffer shared with
> userspace, can this validation be bypassed via a TOCTOU race?
>
> A malicious userspace program could provide a valid sge_offset here to
> pass the bounds check, but then concurrently modify wqe->dma.sge_offset
> in shared memory to an out-of-bounds value.
>
> When finish_packet() executes later on:
>
> finish_packet() {
> ...
> u8 *tmp = &wqe->dma.inline_data[wqe->dma.sge_offset];
> ...
> }
>
> Could it re-fetch the modified, now out-of-bounds sge_offset directly
> from shared memory, resulting in the same kernel memory disclosure or
> vmalloc out-of-bounds access this patch intends to fix?
Hi, Jiale
Please fix the problem that Sashiko mentioned. Then send out a new commit.
Thanks a lot.
Yanjun Zhu
>
>> + rxe_dbg_qp(qp, "invalid inline data range in send wqe\n");
>> + wqe->status = IB_WC_LOC_QP_OP_ERR;
>> + goto err;
>> + }
>> +
>> if (rxe_wqe_is_fenced(qp, wqe)) {
>> qp->req.wait_fence = 1;
>> goto exit;
>
next prev parent reply other threads:[~2026-09-25 17:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 10:05 [PATCH] RDMA/rxe: Validate inline data range in user WQEs Jiale Yao
2026-09-24 10:17 ` sashiko-bot
2026-09-25 17:23 ` Zhu Yanjun [this message]
2026-10-04 4:57 ` jiale yao
2026-10-04 6:14 ` Zhu Yanjun
2026-10-04 7:02 ` jiale yao
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=a1ef2c45-431f-4dad-b812-0b6cccf9ecc5@linux.dev \
--to=yanjun.zhu@linux.dev \
--cc=linux-rdma@vger.kernel.org \
--cc=yaojiale02@163.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