From: Allison Henderson <achender@kernel.org>
To: Kyle Zeng <kylebot@openai.com>, rds-devel@oss.oracle.com
Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org, outbounddisclosures@openai.com
Subject: Re: [PATCH] net/rds: Do not unpin a page after a failed atomic pin
Date: Sat, 31 Oct 2026 12:23:21 -0700 [thread overview]
Message-ID: <24b80e47c623063ee9d717ff051a746b9d226a86.camel@kernel.org> (raw)
In-Reply-To: <20261030042110.73571-1-kylebot@openai.com>
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
prev parent reply other threads:[~2026-10-31 19:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 4:21 Kyle Zeng
2026-10-30 4:23 ` netdev-bot+sinfo
2026-10-31 19:23 ` Allison Henderson [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=24b80e47c623063ee9d717ff051a746b9d226a86.camel@kernel.org \
--to=achender@kernel.org \
--cc=kylebot@openai.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=outbounddisclosures@openai.com \
--cc=rds-devel@oss.oracle.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
all inboxes | Powered by JetHome®