All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
Cc: jmorris@namei.org, serge@hallyn.com,
	linux-integrity@vger.kernel.org,
	Matthew Garrett <mjg59@google.com>
Subject: Re: Fwd: a8d5875ce5 ("Default enable RCU list lockdep debugging with .."): WARNING: suspicious RCU usage
Date: Tue, 28 Apr 2020 08:59:01 -0400	[thread overview]
Message-ID: <1588078741.5195.6.camel@linux.ibm.com> (raw)
In-Reply-To: <20200428112349.GA19116@madhuparna-HP-Notebook>

On Tue, 2020-04-28 at 16:53 +0530, Madhuparna Bhowmik wrote:
> On Mon, Apr 27, 2020 at 08:58:26PM -0400, Mimi Zohar wrote:
> > [Cc'ing Matthew Garrett)
> > 
> > Hi Madhuparna,
> > 
> > On Sat, 2020-04-25 at 16:33 +0530, Madhuparna Bhowmik wrote:
> > > Hi,
> > > 
> > > This is regarding the warning reported by kernel test bot regarding
> > > suspicious RCU usage.
> > > Using a simple git grep, I can only see the following usage of RCU:
> > > 
> > > evm_crypto.c:   list_for_each_entry_rcu(xattr, &evm_config_xattrnames,
> > > list) {
> > > evm_main.c:     list_for_each_entry_rcu(xattr, &evm_config_xattrnames,
> > > list) {
> > > evm_main.c:     list_for_each_entry_rcu(xattr, &evm_config_xattrnames,
> > > list) {
> > > evm_secfs.c:    list_add_tail_rcu(&xattr->list, &evm_config_xattrnames);
> > > 
> > > So, the evm_config_xattrnames list is traversed using
> > > list_for_each_entry_rcu() but without the protection of rcu_read_lock()?
> > > If these are not really RCU read-side CS, and other locks are held then
> > > there is no need to use list_for_each_entry_rcu().
> > > And maybe we can completely remove the usage of rcu primitives here.
> > > Or if there is a bug and rcu_read_lock() should be held, please let me know
> > > and I can try fixing this.
> > 
> > Thank you for forwarding this report.  The list of EVM xattrs is
> > protected by the xattr_list_mutex, which is used when reading or
> > appending to the EVM list itself.  Entries in the list can not be
> > removed.
> >
> Hi Mimi,
> 
> Thank you for your reply.
> So, if the list is protected by xattr_list mutex and it is used during
> both reading and writing to the list, can we remove the usage of RCU
> here? 

I should have said the mutex is used when cat'ing the securityfs file
(security/integrity/evm/evm_xattrs) and when adding to the list, but
not in the above cases when walking the list.

> Since the read side critical section is already protected by the
> xattr_list mutex, we do not need list_for_each_entry_rcu() to read the
> list. Also, we can just simply add to the list using list_add_tail(),
> RCU primitives are not really required here.
> 
> Please let me know is this is fine, and I can send a patch removing the
> usage of RCU here.

Matthew, please correct me if I'm wrong, the reason it is safe, is not
because there is a mutex, but because entries are never removed from
the list.

Mimi

> > The examples, above, are all readers, which walk the EVM xattr list in
> > order to calculate or verify a file's security.evm xattr.



  reply	other threads:[~2020-04-28 12:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-25  2:30 a8d5875ce5 ("Default enable RCU list lockdep debugging with .."): WARNING: suspicious RCU usage kernel test robot
     [not found] ` <CAD=jOEYd-pAQMo3hukx6AhXN7CbH8yGLVLHe2=92wCq-HWS++Q@mail.gmail.com>
2020-04-28  0:58   ` Fwd: " Mimi Zohar
2020-04-28 11:23     ` Madhuparna Bhowmik
2020-04-28 12:59       ` Mimi Zohar [this message]
2020-04-29 10:04         ` Madhuparna Bhowmik
2020-04-29 22:40           ` Paul E. McKenney
2020-04-30 13:07             ` Madhuparna Bhowmik
2020-04-30 13:32               ` Mimi Zohar
2020-04-30 15:08                 ` Madhuparna Bhowmik

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=1588078741.5195.6.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=jmorris@namei.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=madhuparnabhowmik10@gmail.com \
    --cc=mjg59@google.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.