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: <1822b7c129a.14411444236159.6380883938307880248@siddh.me>
Date:   Sat, 23 Jul 2022 20:05:27 +0530
From:   Siddh Raman Pant <code@...dh.me>
To:     "Greg KH" <gregkh@...uxfoundation.org>
Cc:     "David Howells" <dhowells@...hat.com>,
        "Jarkko Sakkinen" <jarkko@...nel.org>,
        "James Morris" <jmorris@...ei.org>,
        "Serge E. Hallyn" <serge@...lyn.com>,
        "linux-security-modules" <linux-security-module@...r.kernel.org>,
        "keyrings" <keyrings@...r.kernel.org>,
        "linux-kernel-mentees" 
        <linux-kernel-mentees@...ts.linuxfoundation.org>,
        "linux-kernel" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] keys/keyctl: Use kfree_rcu instead of kfree

On Sat, 23 Jul 2022 19:35:16 +0530  Greg KH <gregkh@...uxfoundation.org> wrote:
> That does not explain why this change is needed.  What problem does this
> solve?  Why use RCU if you don't have to?  What functionality did you
> just change in this commit and why?

We can avoid a race condition wherein some process tries to access them while
they are being freed. For instance, the comment on `watch_queue_clear()` also
states that:
        /*
         * Remove all the watches that are contributory to a queue.  This has the
         * potential to race with removal of the watches by the destruction of the
         * objects being watched or with the distribution of notifications.
         */
And an RCU read critical section is initiated in that function, so we should
use kfree_rcu() to not unintentionally free it while it is in the critical
section.

> And how was this tested?

It compiles locally for me, and I used syzbot on this along with testing the
other `watch_queue_clear` patch, which generated no errors.

Thanks,
Siddh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ