From: sashiko-bot@kernel.org
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: Thu, 24 Sep 2026 10:17:36 +0000 [thread overview]
Message-ID: <20260924101736.9FA281F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260924100515.502912-1-yaojiale02@163.com>
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?
> + 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;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260924100515.502912-1-yaojiale02@163.com?part=1
next prev parent reply other threads:[~2026-09-24 10:17 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 [this message]
2026-09-25 17:23 ` Zhu Yanjun
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=20260924101736.9FA281F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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