lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YwU5Ou78/WVqrYwS@slm.duckdns.org>
Date:   Tue, 23 Aug 2022 10:31:54 -1000
From:   Tejun Heo <tj@...nel.org>
To:     Chengming Zhou <zhouchengming@...edance.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        Johannes Weiner <hannes@...xchg.org>,
        Imran Khan <imran.f.khan@...cle.com>, kernel-team@...com
Subject: Re: [PATCH 6/7] kernfs: Allow kernfs nodes to be deactivated and
 re-activated

Hello,

On Tue, Aug 23, 2022 at 01:49:07PM +0800, Chengming Zhou wrote:
> > -		if (pos->flags & KERNFS_ACTIVATED)
> > +		if (kernfs_active(pos) || (kn->flags & KERNFS_REMOVING))
> 
> May I ask a question, what's the difference between kernfs_active() and KERNFS_ACTIVATED?
> 
> KERNFS_ACTIVATED is always set when kernfs_activate() and never clear, so I think it means:
> 
> 1. !KERNFS_ACTIVATED : allocated but not activated
> 2. KERNFS_ACTIVATED && !kernfs_active() : make deactivated by kernfs_deactivate_locked()
> 
> I see most code check kernfs_active(), but two places check KERNFS_ACTIVATED, I'm not sure where
> should check KERNFS_ACTIVATED, or is there any chance we can remove KERNFS_ACTIVATED?

Yeah, ACTIVATED means taht created but never activated while kernfs_active()
means currently active. I tried to substitute all ACTIVATED tests with
kernfs_active() and remove the former but I wasn't sure about changing
kernfs_add_one() behavior.

I think it's too confusing to combine the initial activated state with
user-requested show/hide state and causes other problems like
kernfs_activate() used to activate newly created files unhiding files
explicitly deactivated. Lemme separate out show/hide state into something
separate so that the distinction is clear.

Thanks.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ