All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeffrey Vander Stoep <jeffv@google.com>
To: Ondrej Mosnacek <omosnace@redhat.com>
Cc: Will Deacon <will@kernel.org>,
	SElinux list <selinux@vger.kernel.org>,
	Paul Moore <paul@paul-moore.com>,
	Stephen Smalley <sds@tycho.nsa.gov>,
	Jovana Knezevic <jovanak@google.com>
Subject: Re: [PATCH v5] selinux: sidtab: reverse lookup hash table
Date: Thu, 7 Nov 2019 21:06:33 +0100	[thread overview]
Message-ID: <CABXk95AMYEayjt_1v_hv-bft2V=9q4xMSWuMbAOmTOvFj+SC0A@mail.gmail.com> (raw)
In-Reply-To: <CAFqZXNuCugt05+4nejHYvkAGrW+WMmwsRQv8pjKEhKxdBMDVew@mail.gmail.com>

> > If you use the existing _rcu accessors you will get correctly enforced
> > dependency ordering on the reader side and correctly placed release
> > ordering on the updater side. I don't think that's a big overkill, and
> > you can use the RCU accessors to achieve the lockless traversal.
>
> OK, but you don't need the read_lock()/unlock(), rcu_head field in the
> entries, and kfree_rcu(), right?

Hmm... I can get rid of rcu_head/kfree_rcu in any case because we never
remove items during normal use so we don't require the "rcu grace period".
>
> >
> > hlist_add() is not safe against a concurrent traversal because the
> > WRITE_ONCE() provides no memory ordering guarantees, allowing the readers
> > to see an uninitialised node.
>
> Right, so we would need a new function that does smp_store_release() instead.
>
> >
> > How exactly would list_for_each_entry_lockless() and hlist_add_something()
> > differ from the RCU variants, assuming they're implemented correctly?
>
> Looking at the implementation of rcu_dereference() and
> rcu_assign_pointer(), they would probably be practically the same,
> except the rcu_read_lock_held() check in rcu_dereference(). That and
> they would clearly communicate that they are not doing actual RCU, but
> just allow lockless traversal of an add-only hlist.

>
> --
> Ondrej Mosnacek <omosnace at redhat dot com>
> Software Engineer, Security Technologies
> Red Hat, Inc.
>

      reply	other threads:[~2019-11-07 20:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07 10:17 [PATCH v5] selinux: sidtab: reverse lookup hash table Jeff Vander Stoep
2019-11-07 12:01 ` Jeffrey Vander Stoep
2019-11-14 23:35   ` Paul Moore
2019-11-07 14:54 ` Stephen Smalley
2019-11-07 15:42   ` Ondrej Mosnacek
2019-11-07 15:59     ` Jeffrey Vander Stoep
2019-11-07 15:49   ` Jeffrey Vander Stoep
2019-11-07 16:12 ` Ondrej Mosnacek
2019-11-07 16:44   ` Will Deacon
2019-11-07 18:41     ` Ondrej Mosnacek
2019-11-07 20:06       ` Jeffrey Vander Stoep [this message]

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='CABXk95AMYEayjt_1v_hv-bft2V=9q4xMSWuMbAOmTOvFj+SC0A@mail.gmail.com' \
    --to=jeffv@google.com \
    --cc=jovanak@google.com \
    --cc=omosnace@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@vger.kernel.org \
    --cc=will@kernel.org \
    /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.