From: Bernard Metzler <bernard.metzler@linux.dev>
To: Jiwoong Wi <dwdnlzj@gmail.com>, Jason Gunthorpe <jgg@ziepe.ca>,
Leon Romanovsky <leon@kernel.org>
Cc: linux-rdma@vger.kernel.org, bobtobabz@gmail.com, stable@vger.kernel.org
Subject: Re: [PATCH] RDMA/siw: avoid exposing kernel addresses in Read requests
Date: Wed, 2 Dec 2026 15:49:01 +0100 [thread overview]
Message-ID: <e1109575-2e20-41db-9984-2bb01af29aab@linux.dev> (raw)
In-Reply-To: <20261130061347.50309-1-dwdnlzj@gmail.com>
On 30.11.2026 07:13, Jiwoong Wi wrote:
> siw_qp_prepare_tx() copies the local sink SGE address into the Tagged
> Offset of an outgoing RDMA Read Request. For kernel consumers using
> virtual DMA, this is a kernel virtual address. An unauthenticated peer
> can trigger this disclosure through an RPC-over-RDMA Read chunk before
> the server processes the RPC credentials.
>
I cannot yet follow that line of reasoning. Can you make that
readable? Who is doing what and what is the potential thread?
What is the "unauthenticated peer" in that respect?
The siw READ initiator context keeps the target offset of the
RREQUEST message to be sent and enforces that it gets the very same
target offset back in the RRESPONSE (in siw_rresp_check_ntoh()).
How can that be circumvented?
Thanks.
> Use a zero-based sink Tagged Offset for Reads on kernel QPs and expect
> the same initial offset when receiving the response. The outstanding
> Read queue already retains the local SGE, and siw_proc_rresp() uses that
> SGE for the local access check and data placement. Keep that address
> unchanged and advance the wire offset as response segments arrive.
>
> RFC 5040 Sections 4.4 and 5.2.2 allow a zero initial Tagged Offset and
> require the peer to return Read responses in request order. No peer-side
> change is needed. Preserve the existing offsets for userspace QPs and
> leave RDMA Write and Read Response transmission unchanged.
>
> The patch applies cleanly to nfsd-testing at
> commit 36fd4049e3c2bb901118e11be63bf7a7922bea8c ("NFSD: Remove the
> dead session slot retirement code"). The affected SIW files match the
> RDMA for-rc patch base, e7732ec135b501e87ab060d992b3b5f2ec4396c9.
> Both x86-64 kernels used in the runtime tests below built with GCC
> 12.2, W=1, CONFIG_WERROR=y, CONFIG_RDMA_SIW=y, and RPC-over-RDMA
> enabled.
>
> In a two-VM Soft-iWARP test, a raw MPA peer running as uid/gid 65534 with
> no capabilities and NoNewPrivs set triggered eight NFSv4 NULL calls with
> a four-byte Read chunk. Before this change, all eight Read Requests
> exposed the same kernel virtual address as SinkTO. After this change, all
> eight carried a zero SinkTO. In both runs, every Read completed and
> received its matching RPC reply. No WARN, Oops, or panic occurred.
>
> The patched kernel also completed four outstanding Reads, a segmented
> Read Response, and MPA CRC, exercising SIW_OP_READ_LOCAL_INV. A userspace
> QP control retained its original nonzero address on the wire. Repeating
> the kernel-QP tests with Generic KASAN and lockdep produced no diagnostic.
>
> The vulnerability research and validation were conducted by members of
> the Tobabz team as part of the Best of the Best 15th program.
>
> Fixes: b9be6f18cf9e ("rdma/siw: transmit path")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jiwoong Wi <dwdnlzj@gmail.com>
> ---
> drivers/infiniband/sw/siw/siw.h | 5 +++++
> drivers/infiniband/sw/siw/siw_qp_rx.c | 3 ++-
> drivers/infiniband/sw/siw/siw_qp_tx.c | 6 ++++--
> 3 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/infiniband/sw/siw/siw.h b/drivers/infiniband/sw/siw/siw.h
> index 4ec9c2ac75e7b..692d0017807d7 100644
> --- a/drivers/infiniband/sw/siw/siw.h
> +++ b/drivers/infiniband/sw/siw/siw.h
> @@ -478,6 +478,11 @@ struct siw_qp {
> #define rx_type(wqe) ((wqe)->rqe.opcode)
> #define tx_flags(wqe) ((wqe)->sqe.flags)
>
> +static inline u64 siw_read_wire_offset(const struct siw_qp *qp, u64 laddr)
> +{
> + return rdma_is_kernel_res(&qp->base_qp.res) ? 0 : laddr;
> +}
> +
> struct iwarp_msg_info {
> int hdr_len;
> struct iwarp_ctrl ctrl;
> diff --git a/drivers/infiniband/sw/siw/siw_qp_rx.c b/drivers/infiniband/sw/siw/siw_qp_rx.c
> index e5b641c8d694a..608bb442d42b6 100644
> --- a/drivers/infiniband/sw/siw/siw_qp_rx.c
> +++ b/drivers/infiniband/sw/siw/siw_qp_rx.c
> @@ -174,7 +174,8 @@ static int siw_rresp_check_ntoh(struct siw_rx_stream *srx,
>
> if (frx->first_ddp_seg) {
> srx->ddp_stag = wqe->sqe.sge[0].lkey;
> - srx->ddp_to = wqe->sqe.sge[0].laddr;
> + srx->ddp_to = siw_read_wire_offset(rx_qp(srx),
> + wqe->sqe.sge[0].laddr);
> frx->pbl_idx = 0;
> }
> /* Below checks extend beyond the semantics of DDP, and
> diff --git a/drivers/infiniband/sw/siw/siw_qp_tx.c b/drivers/infiniband/sw/siw/siw_qp_tx.c
> index 2675bc0b20195..7d1cf94f8382c 100644
> --- a/drivers/infiniband/sw/siw/siw_qp_tx.c
> +++ b/drivers/infiniband/sw/siw/siw_qp_tx.c
> @@ -118,6 +118,7 @@ static int siw_qp_prepare_tx(struct siw_iwarp_tx *c_tx)
> {
> struct siw_wqe *wqe = &c_tx->wqe_active;
> char *crc = NULL;
> + u64 sink_to;
> int data = 0;
>
> switch (tx_type(wqe)) {
> @@ -133,8 +134,9 @@ static int siw_qp_prepare_tx(struct siw_iwarp_tx *c_tx)
> htonl(++c_tx->ddp_msn[RDMAP_UNTAGGED_QN_RDMA_READ]);
> c_tx->pkt.rreq.ddp_mo = 0;
> c_tx->pkt.rreq.sink_stag = htonl(wqe->sqe.sge[0].lkey);
> - c_tx->pkt.rreq.sink_to =
> - cpu_to_be64(wqe->sqe.sge[0].laddr);
> + sink_to = siw_read_wire_offset(tx_qp(c_tx),
> + wqe->sqe.sge[0].laddr);
> + c_tx->pkt.rreq.sink_to = cpu_to_be64(sink_to);
> c_tx->pkt.rreq.source_stag = htonl(wqe->sqe.rkey);
> c_tx->pkt.rreq.source_to = cpu_to_be64(wqe->sqe.raddr);
> c_tx->pkt.rreq.read_size = htonl(wqe->sqe.sge[0].length);
>
> base-commit: e7732ec135b501e87ab060d992b3b5f2ec4396c9
prev parent reply other threads:[~2026-12-02 14:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 6:13 [PATCH] RDMA/siw: avoid exposing kernel addresses in Read requests Jiwoong Wi
2026-12-02 8:16 ` Leon Romanovsky
2026-12-02 14:49 ` Bernard Metzler [this message]
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=e1109575-2e20-41db-9984-2bb01af29aab@linux.dev \
--to=bernard.metzler@linux.dev \
--cc=bobtobabz@gmail.com \
--cc=dwdnlzj@gmail.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.