Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: "jiale yao" <19888972804@163.com>
To: "Zhu Yanjun" <yanjun.zhu@linux.dev>
Cc: linux-rdma@vger.kernel.org
Subject: Re:Re: [PATCH] RDMA/rxe: Validate inline data range in user WQEs
Date: Sun, 4 Oct 2026 12:57:46 +0800 (CST)	[thread overview]
Message-ID: <1c28994b.869.1a105467816.Coremail.19888972804@163.com> (raw)
In-Reply-To: <a1ef2c45-431f-4dad-b812-0b6cccf9ecc5@linux.dev>

At 2026-09-26 01:23:28, "Zhu Yanjun" <yanjun.zhu@linux.dev> wrote:
>在 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
How about this one,
https://lore.kernel.org/all/20260926070403.3005250-1-yaojiale02@163.com/
>
>> 
>>> +		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;
>> 

  reply	other threads:[~2026-10-04  4:58 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
2026-10-04  4:57     ` jiale yao [this message]
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=1c28994b.869.1a105467816.Coremail.19888972804@163.com \
    --to=19888972804@163.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=yanjun.zhu@linux.dev \
    /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