From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.55 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796222949; b=DpeKSI5AV55T35VQqG/B32NNen5ErMQaui2pze81rk8wZ0g2ZY49byinm5ilBrEuMMJ+ whUlCAs1/FIr8suwDsPuVekUfwbCAfoXRz0878JT459oaq1pFyakTQ926qPkYfhyhn3KL xG8yHFqw/3iJGn/hJ+ut2sf6T3eBO35yAi7yc8aBI0syNaYBN4UqgjMb+ITYWFgxXrH5X IMwvoVy3VmIux/hEqv10AtKbcmh7h/aKVVGm+Sy0oqNL/4oaUDyLg+v6R4WeadkhgBJ8s 9VwoCzGcQNwGr6tYYW+HTnyPQ4WVEIBsoHL/9R5lf7wxmoYl2x1Mjv1/dcTu3FFzH3w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796222949; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=P0oN/5nAafqKzKwzYdB3NdXPjkMUb1uHCn/+re2zB/g=; b=lC5uAdVWxgUo+uSEfpilSBGzhAPgeDjG1w4wRiYUpnrMifEPVpzKj5HIcck2DjO0Gdxq uJ1VxOkUTjsT35q6kFuixYLQ2yKCtamAiLqm4OzgV6Vvigemfmlb4vD4cLh3fHIQeNhtx hpAoy6oLmEVLsfbeYVt6ioS5zU8oeRXyHRVCEr1QT6cmmIiiUUpQUQzPpSYlzLTEzLpl4 R4hd548A30PoeYXKUoy811f/yO+fQo9zk9jw7erIVuoJhqSz8Mwukqf+4HJAEsFl8sRdt ENybWskY/1nw8C7X0ItBKZY503YN+t6tODcnEtJLMyM89fUkG1oduKNSByJ7tDkz66Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=A7AamvOI; arc=none smtp.remote-ip=95.215.58.55 Received: from mta1.migadu.com (out-55.mta1.migadu.com [95.215.58.55]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A27A6606A32A for ; Wed, 2 Dec 2026 14:49:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A27A6606A32A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=A7AamvOI X-Envelope-To: stable@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=ISRahBZ2PTrvHm0eJdqUJXGaqq+MqbxVmL8kTdWQKNY=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796222946; v=1; x=1796827746; b=A7AamvOIJcyw7XRW/i4ylJDFC40QKYjbNcf4HLfzgAv+XYWwRX4Tnw/0zgbA6cpi3wsq5RMf zbKSAEzgN1EpdJZNFRHc3MLSaA8ZJIM1/GEE02r1d9mFHTpb9kXY6ASwDgxw5zcbuWUOL9akhX3 RR/d68HtcIbnAo2zUS29rBtM= X-Envelope-To: stable@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 34266921ae7ec88c; Wed, 02 Dec 2026 14:49:06 +0000 X-Mizu-Trace-ID: 34266921ae7ec88c X-Migadu-Flow: FLOW_OUT Message-ID: Date: Wed, 2 Dec 2026 15:49:01 +0100 X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] RDMA/siw: avoid exposing kernel addresses in Read requests To: Jiwoong Wi , Jason Gunthorpe , Leon Romanovsky Cc: linux-rdma@vger.kernel.org, bobtobabz@gmail.com, stable@vger.kernel.org References: <20261130061347.50309-1-dwdnlzj@gmail.com> From: Bernard Metzler In-Reply-To: <20261130061347.50309-1-dwdnlzj@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 > --- > 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