From: Greg KH <gregkh@linuxfoundation.org>
To: Siddh Raman Pant <code@siddh.me>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Jarkko Sakkinen <jarkko@kernel.org>,
James Morris <jmorris@namei.org>,
David Howells <dhowells@redhat.com>,
linux-security-modules <linux-security-module@vger.kernel.org>,
keyrings <keyrings@vger.kernel.org>,
linux-kernel-mentees
<linux-kernel-mentees@lists.linuxfoundation.org>,
"Serge E. Hallyn" <serge@hallyn.com>
Subject: Re: [PATCH] keys/keyctl: Use kfree_rcu instead of kfree
Date: Sat, 23 Jul 2022 16:43:11 +0200 [thread overview]
Message-ID: <YtwI/3/Qp3lSKuls@kroah.com> (raw)
In-Reply-To: <1822b7c129a.14411444236159.6380883938307880248@siddh.me>
On Sat, Jul 23, 2022 at 08:05:27PM +0530, Siddh Raman Pant wrote:
> On Sat, 23 Jul 2022 19:35:16 +0530 Greg KH <gregkh@linuxfoundation.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.
You need to explain all of this in a changelog text. Don't say what you
do, but say why you are doing it.
> > 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.
How does the watch queue stuff relate to this keyctl logic?
Again, be specific as to why you are doing things.
thanks,
greg k-h
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
next prev parent reply other threads:[~2022-07-23 14:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-23 13:50 [PATCH] keys/keyctl: Use kfree_rcu instead of kfree Siddh Raman Pant via Linux-kernel-mentees
2022-07-23 14:05 ` Greg KH
2022-07-23 14:35 ` Siddh Raman Pant via Linux-kernel-mentees
2022-07-23 14:43 ` Greg KH [this message]
2022-07-23 15:28 ` Siddh Raman Pant via Linux-kernel-mentees
2022-07-23 14:50 ` James Bottomley
2022-07-23 15:28 ` Siddh Raman Pant via Linux-kernel-mentees
2022-07-28 8:11 ` Jarkko Sakkinen
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=YtwI/3/Qp3lSKuls@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=code@siddh.me \
--cc=dhowells@redhat.com \
--cc=jarkko@kernel.org \
--cc=jmorris@namei.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=serge@hallyn.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).