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]
Date:   Wed, 15 Jun 2022 12:13:48 +1000
From:   Imran Khan <imran.f.khan@...cle.com>
To:     Tejun Heo <tj@...nel.org>
Cc:     gregkh@...uxfoundation.org, viro@...iv.linux.org.uk,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 1/4] kernfs: make ->attr.open RCU protected.

Hello Tejun,

On 15/6/22 2:20 am, Tejun Heo wrote:
> On Tue, Jun 14, 2022 at 05:03:43PM +1000, Imran Khan wrote:
>> +/**
[...]
> 
> Hey, so, the difference between rcu_dereference_check() and
> rcu_dereference_protected() is that the former can be called either with rcu
> read locked or under the extra condition (here, open_file_mutex held) while
> the latter can't be used under rcu read lock. The two can generate different
> codes too - the former enforces dependency ordering which makes accesses
> under rcu read lock safe, while the latter doesn't.
> 
> In the above, you're saying that the accessor is only to be used while
> holding kernfs_open_file_mutex but then using rcu_dereference_check() which
> is odd. There are two ways you can go 1. ensure that the accessor is always
> used under the mutex and use rcu_dereference_protected() or 2. if the
> function can be used under rcu read lock, rename so that the differentiation
> between the two accessors is based on the parameter type, not whether
> they're protected or not.
> 
I am going with option 1 suggested above, since the accessor will always operate
under kernfs_open_file_mutex.

> Can you please post the updated patch as a reply to this one? No need to
> post the whole thing over and over again.
> 
I am sending the full patch-set because after modifying
PATCH-1 we will get a conflict like below when applying previous version of PATCH-3

static struct kernfs_open_node *
kernfs_deref_open_node_protected(struct kernfs_node *kn)
{
<<<<<<< HEAD
        return rcu_dereference_protected(kn->attr.open,
                                lockdep_is_held(&kernfs_open_file_mutex));
=======
        return rcu_dereference_check(kn->attr.open,
                               lockdep_is_held(kernfs_open_file_mutex_ptr(kn)));
>>>>>>> 80411dbfe1890 (kernfs: Introduce interface to access global
kernfs_open_file_mutex.)

Full patch-set will avoid this small conflict. I hope sending full
patch-set is okay for this time. The full patch-set (v7) is available at [1]

Thanks
 -- Imran

[1]:https://lore.kernel.org/lkml/20220615021059.862643-1-imran.f.khan@oracle.com/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ