cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chen Ridong <chenridong@huaweicloud.com>
To: Tejun Heo <tj@kernel.org>
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: Fri, 22 Aug 2025 09:57:51 +0800	[thread overview]
Message-ID: <38ef3ff9-b380-44f0-9315-8b3714b0948d@huaweicloud.com> (raw)
In-Reply-To: <aKUo7BuX-teh4IzF@slm.duckdns.org>



On 2025/8/20 9:46, Tejun Heo wrote:
> 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.
> 

Thank you Tj,

This is reasonable, I will try.

-- 
Best regards,
Ridong


      reply	other threads:[~2025-08-22  1:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-15  1:34 [PATCH] kernfs: Fix UAF in PSI polling when open file is released 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
2025-08-22  1:57       ` Chen Ridong [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=38ef3ff9-b380-44f0-9315-8b3714b0948d@huaweicloud.com \
    --to=chenridong@huaweicloud.com \
    --cc=cgroups@vger.kernel.org \
    --cc=chenridong@huawei.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=tj@kernel.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;
as well as URLs for NNTP newsgroup(s).