Article View: linux.kernel.netdev
Article #9182Re: [PATCH] net/rds: Do not unpin a page after a failed atomic pin
From: Allison Henderson
Date: Sat, 31 Oct 2026 19:23
Date: Sat, 31 Oct 2026 19:23
81 lines
10355 bytes
10355 bytes
On Thu, 2026-10-29 at 21:21 -0700, Kyle Zeng wrote:
> rds_cmsg_atomic() assumes that a non-NULL output from rds_pin_pages()
> represents a pin that it owns. However, pin_user_pages_fast() can roll
> back a fast-GUP pin after racing fork() and then fail in the slow path,
> for example after a concurrent mprotect(PROT_NONE). The output slot can
> still contain the already-unpinned page.
>
> The common error path calls unpin_user_page() on that stale pointer.
> This can consume another subsystem's pin and allow the page to be
> freed while it is still in use.
>
> Clear page when rds_pin_pages() does not return one. The error path
> continues to release the page on errors after a successful pin, and
> successful requests retain their existing ownership and behavior. All
> four RDS atomic ancillary operations share this path.
>
> Signed-off-by: Kyle Zeng <kylebot@openai.com>
Hi Kyle,
Thanks for the patch, the fix itself looks good to me. Some things we need
add to move you forward: First, your subject line specify which branch the
patch is applied to. Since this is a fix for code already in mainline, we
should target the net tree. So rebase the patch on the latest net branch and
format the subject line like this:
[PATCH net v2] net/rds: Do not unpin a page after a failed atomic pin
Also, since this patch is a bug fix, it should cc stable@vger.kernel.org and
carry a fixes tag that identifies which commit the patch is fixing. For this
fix, I think we want 15133f6e67d8:
Fixes: 15133f6e67d8 ("RDS: Implement atomic operations")
Lastly, remember to add a short change log below the --- line. Just something
brief like this:
v2: Target net, add Fixes and Cc stable tags
> ---
> I have a reproducer for this issue and can share via DM
Thanks, could you post it on-list with the v2? Either below the --- line or as
a reply. That way others can see and verify the fix too.
Thank you!
Allison
>
> net/rds/rdma.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/rds/rdma.c b/net/rds/rdma.c
> index 078090d292fa..71b57abb96c4 100644
> --- a/net/rds/rdma.c
> +++ b/net/rds/rdma.c
> @@ -957,8 +957,11 @@ int rds_cmsg_atomic(struct rds_sock *rs, struct rds_message *rm,
> }
>
> ret = rds_pin_pages(args->local_addr, 1, &page, 1);
> - if (ret != 1)
> + if (ret != 1) {
> + /* A failed pin can leave a stale page pointer. */
> + page = NULL;
> goto err;
> + }
> ret = 0;
>
> sg_set_page(rm->atomic.op_sg, page, 8, offset_in_page(args->local_addr));
>
> base-commit: d89e1d186ec9271bf78e62771779e9fc03bf0fc3
Technical Details
Message-ID:
<24b80e47c623063ee9d717ff051a746b9d226a86.camel@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354130-linux-kernel-netdev=dewy.ruReferences:
<20261030042110.73571-1-kylebot@openai.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354130-linux-kernel-netdev=dewy.ru From: achender@kernel.org (Allison Henderson) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH] net/rds: Do not unpin a page after a failed atomic pin Date: Sat, 31 Oct 2026 12:23:21 -0700 Organization: Usenet Network Message-ID: <24b80e47c623063ee9d717ff051a746b9d226a86.camel@kernel.org> References: <20261030042110.73571-1-kylebot@openai.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="2534112"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:/nB3JNm63r6m17klaUMv/gnrNiQ= sha256:Kxirhp0aeLyABSxpperPGzIzKypYMOXyI/l5rfYTb2A= sha1:pTyagkebsxTiGfGL3ldXu9zC4Mo= sha256:HePRUyLg41mAYYL/9q9RwGwlUe414b4g+cF28P7pDGQ= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 7BA0A125CBC; Sat, 31 Oct 2026 22:23:53 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1B2ZDraRXUKi; Sat, 31 Oct 2026 22:23:46 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-354130-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 5382F125CB5; Sat, 31 Oct 2026 22:23:37 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id CF9DE2629F; Sat, 31 Oct 2026 19:23:35 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793474615; b=0egczpA+Jv+eK+KQWIj7onBYKJbDXtHD5qrvYwaVTtNkBsFZWyQnOsBjAo8FwCx8AGTF Nwo/9dUsgGiOZIIv9g3cC2Bc3jfJ+2tkrhP6nU5tfeCsRdsOlSTPSjxqAd5qPnom4g+cx Y84BRN2SHVhjJHEYzb3gmKRLJwMexUfJHryIF31MHHodfVnJVti5LRHE/73JI8Y1xTuEa qLV7p1Fc4aW1pqfy7pmtS2suGbyfQXoHtmpMkmLBixEfVDsZKplZsCPgWQVxCqcbpHEz5 0VGnhjszmHSq1KvOe55GYl0II8i40qmokU50rV67ZTbpVL52JMODUNU/2gBA+tVkjQw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793474615; h=X-Original-To:Received:Received:DKIM-Signature:Message-ID:Subject: From:To:Cc:Date:In-Reply-To:References:Content-Type: Content-Transfer-Encoding:User-Agent:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version; bh=wiIzSjn+mtGawNfvo8XnzlYZC4Y8Z4jY/HqNPQcZhLE=; b=CFWDHEGacN8K9whsg2ojF+beHwwtMlf3bqr/9i+BCgbTj5sbEhVBEb23qa2ZryZlnkTh 3qvwGnQuah5caPbKtuvJjQEkTqCS4kDn0EXtulAokaEfUhQ60RONeD5EcyiH3t/y5ZAWX qpGN2rrfNI2ri16+xP+B8Rwvt46dc0NNCpN74Y0gjZyeHsyM0GRrBVGPSR/hjC7hW0O8x dAR0kwI+QuNyesDQCy1lafvvNK9AjCeVhJthv9B5aHVZqN0uArLM6kl7/WOrovuzVwJLu tanI8lzoAUdKyC2+qA2I8VGPv5ux03HjOB4QaYMlHZVPUIDYqopVmSCp6pI1x/O3Lrw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YczLZU9N; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 33041606A31D; Sat, 31 Oct 2026 19:23:35 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YczLZU9N X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793474604; b=L/wyNEtTBq1ngSoC+e3YDsQdxZUJSdhV4lzRQeWkWMBxbfH4le6fKh9pS3LsztEXiYw6 H89wA7nkTa4o8nZpu68dSUQJO6OXxPMXwOkytpsykl48kJ0GTt+CKpFZHTUHOA87i0+KL 8vhw5sA6n11VPEUZOX3F5E89mtrX/Gi+/tZLLF9aXry83u6ny5OEj1ZpfO2VfIQBf9n4x W2z/loMOW7z/bUCdRc5ijpOw6UVKn3WGg8veVVRl1iiDdYx3Moxfh6vD1hlZlsFEhbN2s VDgjDXy9qVqhjGpjYI/My+z4aEpOkJfjpr97e98DCmXV86W/6GCLmm5LKv4a895Fd7A== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793474604; h=Received:DKIM-Signature:Message-ID:Subject:From:To:Cc:Date: In-Reply-To:References:Content-Type:Content-Transfer-Encoding: User-Agent:MIME-Version; bh=wiIzSjn+mtGawNfvo8XnzlYZC4Y8Z4jY/HqNPQcZhLE=; b=V5oIZKB0OhxkopMBOdBfcxJ+45Q8PIfM87jkcslXvr/Ro+F3wSY7NDnu9zKmxhwZWPVH 6TfeRskf7MhnNjcitmMwhJNU90u4qamEAtAUkQqhVjaOz5/y15BA+jgv+/cL7OTV9FSWS 8kR+f5QVIePMDwWmRKLuBZtA6CS9HTYljMxso2hagB5IIDMk8EIYaPSSFr2cH6ba4bHl9 1vZqkZBUVZV1Ts3GIDWXPaJEuUPIpJ45smRsdef57hzEbu1lUDegF+QgWlND0h77XmAKk iRY2tkt8UmATrdGszSXFgXFje3rjSRJTBIDBArwTm/YDwkPwIntWIS438zz41XAPMNA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YczLZU9N; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02CD2606A31A; Sat, 31 Oct 2026 19:23:23 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 216DD1F000C1; Sat, 31 Oct 2026 19:23:23 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793474603; bh=wiIzSjn+mtGawNfvo8XnzlYZC4Y8Z4jY/HqNPQcZhLE=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=YczLZU9NpkjU9wmqof2jos1q9/iRyf8vM+JLnDIj993oHoTpDSuv2SIj4Tc1/UFAZ ITiFlieiA9eaAF/zw/PpxBHhoUW3SkEO0pjoUhRHVpxKIwE0C/dgqwxM1PqIcrDTJf Jxf6YMZW2xYYQAo7B2WXCnCyYLxODmzrrMtQoC5ajUdicAYuIdXuUXShpBWnvAT7pq u7JxXTWMld7l63bJOfhVeSQT2a1N3QgYgvHaO5L04t831wyEIuPRX0Uw9JgbgRGKq/ ntzDE7TSDqSsUFDw/iG5vszYGQ6B2uVr+g3vTv1MK+Jc1+JfaTKXKIjzdao9ju8csi WT5Bl4r2KeHYg== X-Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, outbounddisclosures@openai.com X-In-Reply-To: <20261030042110.73571-1-kylebot@openai.com> X-User-Agent: Evolution 3.52.3-0ubuntu1.1 X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list