Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Tymbark7372 <tymbark7372@proton.me>
Cc: linux-rdma@vger.kernel.org, zyjzyj2000@gmail.com, jgg@nvidia.com,
	leonro@nvidia.com, stable@vger.kernel.org
Subject: Re: [PATCH 1/4] RDMA/rxe: Fix u64 iova+length overflow in mr_check_range
Date: Fri, 22 May 2026 06:44:47 +0200	[thread overview]
Message-ID: <2026052221-deceiver-grafting-58e9@gregkh> (raw)
In-Reply-To: <20260521194402.811-2-tymbark7372@proton.me>

On Thu, May 21, 2026 at 07:44:08PM +0000, Tymbark7372 wrote:
> In mr_check_range(), the IB_MR_TYPE_USER and IB_MR_TYPE_MEM_REG case
> computes both iova + length and mr->ibmr.iova + mr->ibmr.length without
> overflow check.  Both iova (u64) and length (size_t) are 64-bit on
> 64-bit platforms.  An attacker setting iova = 0xFFFFFFFFFFFFFC00 and
> length = 0x400 wraps the sum to 0, so the bound check
> "iova + length > mr->ibmr.iova + mr->ibmr.length" passes.
> 
> After the bypass, rxe_mr_iova_to_index() computes a huge index value;
> WARN_ON(idx >= mr->nbuf) fires but does not abort, and
> rxe_mr_copy_xarray() then dereferences page_info[huge_idx], an
> attacker-controlled out-of-bounds slot.  In the RXE_TO_MR_OBJ
> direction this becomes an OOB write of attacker payload bytes through
> info->page + info->offset.
> 
> Use check_add_overflow() on both ends to reject any iova/length pair
> that wraps.  Also explicitly scope the local declarations introduced
> by the helper variables.
> 
> Reachable from any unprivileged local process with
> /dev/infiniband/uverbs0 open (world-rw on distros that ship the
> rdma-core udev rules) and from an unauthenticated remote peer over
> UDP/4791 (RoCEv2) when the target rkey/QPN are known.  Reproduced on
> v7.1.0-rc3 + KASAN with a single ibv_post_send(IBV_WR_RDMA_WRITE) and
> the wrap iova above; the kernel oopses in rxe_mr_copy+0x20d after
> WARN at rxe_mr_iova_to_index+0x135.
> 
> Site A in rxe_resp.c (check_rkey()) reaches mr_check_range() with
> attacker iova as well, so this patch also closes that path; Site B
> (duplicate_request, also in rxe_resp.c) has an independent inline
> check that wraps and is fixed in patch 3 of this series.
> 
> Fixes: 8700e3e7c485 ("Soft RoCE driver")
> Cc: stable@vger.kernel.org # v4.8+
> Reported-by: Tymbark7372 <tymbark7372@proton.me>
> Signed-off-by: Tymbark7372 <tymbark7372@proton.me>

We need a real name for the From: and signed-off-by line, and no need
for the duplicate reported-by line.

thanks,

greg k-h

  reply	other threads:[~2026-05-22  4:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21 19:44 [PATCH 0/4] RDMA/rxe: Fix u64 iova-overflow family in MR/ODP/RESP/MW paths Tymbark7372
2026-05-21 19:44 ` [PATCH 1/4] RDMA/rxe: Fix u64 iova+length overflow in mr_check_range Tymbark7372
2026-05-22  4:44   ` Greg KH [this message]
2026-05-21 19:44 ` [PATCH 2/4] RDMA/rxe: Fix u64 iova+length overflow in rxe_check_pagefault Tymbark7372
2026-05-21 19:44 ` [PATCH 3/4] RDMA/rxe: Fix u64 iova+resid overflow in duplicate_request Tymbark7372
2026-05-21 19:44 ` [PATCH 4/4] RDMA/rxe: Fix u64 addr+length overflow in rxe_check_bind_mw Tymbark7372
2026-05-22  2:54 ` [PATCH 0/4] RDMA/rxe: Fix u64 iova-overflow family in MR/ODP/RESP/MW paths Zhu Yanjun
2026-05-25 11:15   ` Tymbark7372
2026-05-25 20:54     ` Zhu Yanjun

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=2026052221-deceiver-grafting-58e9@gregkh \
    --to=greg@kroah.com \
    --cc=jgg@nvidia.com \
    --cc=leonro@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tymbark7372@proton.me \
    --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