From: Tejun Heo <tj@kernel.org>
To: Chen Ridong <chenridong@huaweicloud.com>
Cc: Baokun Li <libaokun1@huawei.com>,
cgroups@vger.kernel.org, chenridong@huawei.com,
gregkh@linuxfoundation.org, hannes@cmpxchg.org,
linux-kernel@vger.kernel.org, lujialin4@huawei.com,
mkoutny@suse.com, peterz@infradead.org,
zhouchengming@bytedance.com, Yang Erkun <yangerkun@huawei.com>
Subject: Re: [PATCH] kernfs: Fix UAF in PSI polling when open file is released
Date: Tue, 19 Aug 2025 15:46:20 -1000 [thread overview]
Message-ID: <aKUo7BuX-teh4IzF@slm.duckdns.org> (raw)
In-Reply-To: <e485b38a-183b-42c8-9aed-9c2d939add0b@huaweicloud.com>
Hello,
On Mon, Aug 18, 2025 at 04:00:08PM +0800, Chen Ridong wrote:
> > A potential solution is to make the lifecycles of cgroup_file_ctx and
> > psi_trigger match the struct kernfs_open_file they're associated with.
> > Maybe we could just get rid of the kernfs_release_file call in
> > kernfs_drain_open_files?
> >
>
> Hi, Tj, what do you think about this solution?
So, I think it's really fragile for a killed (drained) kernfs_open_file to
be reused after the corresponding @kn is resurrected. Once killed, that file
should stay dead. I think it'd be best if we can do this in a generic manner
rather than trying to fix it only for poll.
kernfs_get_active() is the thing which gates active operations on the file.
Maybe we can add a wrapper, say, kernfs_get_active_of(struct
kernfs_open_file *of) which returns NULL if @of has already been killed or
the underlying @kn can't be activated?
Thanks.
--
tejun
next prev parent reply other threads:[~2025-08-20 1:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-15 1:34 Chen Ridong
2025-08-15 6:11 ` Greg KH
2025-08-15 6:22 ` Chen Ridong
2025-08-15 6:43 ` Greg KH
2025-08-15 7:16 ` Chen Ridong
2025-08-15 14:42 ` Michal Koutný
2025-08-18 7:41 ` Chen Ridong
[not found] ` <0319ee9b-ce2c-4c02-a731-c538afcf008f@huawei.com>
2025-08-18 8:00 ` Chen Ridong
2025-08-18 8:22 ` Chen Ridong
2025-08-20 1:46 ` Tejun Heo [this message]
2025-08-22 1:57 ` Chen Ridong
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=aKUo7BuX-teh4IzF@slm.duckdns.org \
--to=tj@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=chenridong@huawei.com \
--cc=chenridong@huaweicloud.com \
--cc=gregkh@linuxfoundation.org \
--cc=hannes@cmpxchg.org \
--cc=libaokun1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lujialin4@huawei.com \
--cc=mkoutny@suse.com \
--cc=peterz@infradead.org \
--cc=yangerkun@huawei.com \
--cc=zhouchengming@bytedance.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®