From: peter enderborg <peter.enderborg@sony.com>
To: Ondrej Mosnacek <omosnace@redhat.com>, <selinux@vger.kernel.org>,
Paul Moore <paul@paul-moore.com>
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>,
Lakshmi Ramasubramanian <nramas@linux.microsoft.com>,
<rcu@vger.kernel.org>, "Paul E . McKenney" <paulmck@kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH 3/3] selinux: track policy lifetime with refcount
Date: Tue, 25 Aug 2020 20:51:14 +0200 [thread overview]
Message-ID: <748e4541-7608-ae51-bdd1-1356deedb105@sony.com> (raw)
In-Reply-To: <20200825152045.1719298-4-omosnace@redhat.com>
On 8/25/20 5:20 PM, Ondrej Mosnacek wrote:
> Instead of holding the RCU read lock the whole time while accessing the
> policy, add a simple refcount mechanism to track its lifetime. After
> this, the RCU read lock is held only for a brief time when fetching the
> policy pointer and incrementing the refcount. The policy struct is then
> guaranteed to stay alive until the refcount is decremented.
>
> Freeing of the policy remains the responsibility of the task that does
> the policy reload. In case the refcount drops to zero in a different
> task, the policy load task is notified via a completion.
>
> The advantage of this change is that the operations that access the
> policy can now do sleeping allocations, since they don't need to hold
> the RCU read lock anymore. This patch so far only leverages this in
> security_read_policy() for the vmalloc_user() allocation (although this
> function is always called under fsi->mutex and could just access the
> policy pointer directly). The conversion of affected GFP_ATOMIC
> allocations to GFP_KERNEL is left for a later patch, since auditing
> which code paths may still need GFP_ATOMIC is not very easy.
>
> Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
>
Very clever. But is it the right prioritization? We get a lot more
cpu synchronization need with two RCU in-out and refcounts inc/dec
instead of only one RCU in-out. What is the problem with the atomic
allocations? And this if for each syscall, all caches are on the inside?
parent reply other threads:[~2020-08-25 18:51 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20200825152045.1719298-4-omosnace@redhat.com>]
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=748e4541-7608-ae51-bdd1-1356deedb105@sony.com \
--to=peter.enderborg@sony.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nramas@linux.microsoft.com \
--cc=omosnace@redhat.com \
--cc=paul@paul-moore.com \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=selinux@vger.kernel.org \
--cc=stephen.smalley.work@gmail.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
all inboxes | Powered by JetHome®