From: Tymbark7372 <tymbark7372@proton.me>
To: linux-rdma@vger.kernel.org
Cc: zyjzyj2000@gmail.com, jgg@nvidia.com, leonro@nvidia.com,
stable@vger.kernel.org, Tymbark7372 <tymbark7372@proton.me>
Subject: [PATCH 4/4] RDMA/rxe: Fix u64 addr+length overflow in rxe_check_bind_mw
Date: Thu, 21 May 2026 19:44:19 +0000 [thread overview]
Message-ID: <20260521194402.811-5-tymbark7372@proton.me> (raw)
In-Reply-To: <20260521194402.811-1-tymbark7372@proton.me>
rxe_check_bind_mw() validates that a Type 2 memory window's range
[addr, addr + length) is contained within its parent MR's range
[mr->ibmr.iova, mr->ibmr.iova + mr->ibmr.length). Both end-addition
sums wrap modulo 2^64. An attacker can bind a memory window whose
nominal range exceeds the parent MR by wrapping the comparison sum
to a value below the parent's iova.
This is the same wrap class as patch 1 of this series; it was found
by sibling-site grep against the other rxe iova checks and is not on
the OOB-write path of the three primary bugs. I have not
demonstrated a downstream OOB primitive that uses this specific
escape, so it is filed here as a defensive sibling fix rather than as
a separate exploitable bug. Folding it into the same series keeps
the wrap-class fixes together.
Use check_add_overflow() on both ends.
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>
Assisted-by: Claude:claude-opus-4-7
---
drivers/infiniband/sw/rxe/rxe_mw.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_mw.c b/drivers/infiniband/sw/rxe/rxe_mw.c
--- a/drivers/infiniband/sw/rxe/rxe_mw.c
+++ b/drivers/infiniband/sw/rxe/rxe_mw.c
@@ -120,9 +120,14 @@
return -EINVAL;
}
} else {
- if (unlikely((wqe->wr.wr.mw.addr < mr->ibmr.iova) ||
- ((wqe->wr.wr.mw.addr + wqe->wr.wr.mw.length) >
- (mr->ibmr.iova + mr->ibmr.length)))) {
+ u64 mw_end, mr_end;
+
+ if (unlikely(check_add_overflow(wqe->wr.wr.mw.addr,
+ wqe->wr.wr.mw.length, &mw_end) ||
+ check_add_overflow(mr->ibmr.iova,
+ mr->ibmr.length, &mr_end) ||
+ wqe->wr.wr.mw.addr < mr->ibmr.iova ||
+ mw_end > mr_end)) {
rxe_dbg_mw(mw,
"attempt to bind a VA MW outside of the MR\n");
return -EINVAL;
--
2.43.0
next prev parent reply other threads:[~2026-05-21 19: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
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 ` Tymbark7372 [this message]
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=20260521194402.811-5-tymbark7372@proton.me \
--to=tymbark7372@proton.me \
--cc=jgg@nvidia.com \
--cc=leonro@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=stable@vger.kernel.org \
--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