public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Moore <paul.moore@hp.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	James Carter <jwcart2@tycho.nsa.gov>,
	James Morris <jmorris@namei.org>,
	Eric Paris <eparis@parisplace.org>,
	Karl MacMillan <kmacmillan@mentalrootkit.com>,
	"Christopher J. PeBenito" <cpebenito@tresys.com>,
	Joshua Brindle <method@manicmethod.com>,
	KaiGai Kohei <kaigai@kaigai.gr.jp>
Subject: Re: [bug] very high non-preempt latency in context_struct_compute_av()
Date: Mon, 4 Jun 2007 18:48:20 -0400	[thread overview]
Message-ID: <200706041848.21306.paul.moore@hp.com> (raw)
In-Reply-To: <1180993140.14220.168.camel@moss-spartans.epoch.ncsc.mil>

On Monday 04 June 2007 5:39:00 pm Stephen Smalley wrote:
> On Mon, 2007-06-04 at 17:11 -0400, Paul Moore wrote:
> > I'm not an expert on the SELinux security server guts like the other
> > people on the To/CC line of this thread, but here are my two cents on the
> > issue above.
> >
> > From what I can tell the nasty loop that is taking so long is the actual
> > access vector lookup which determines if the subject has access to the
> > object (i.e. can user/application X access resource Y on the system). 
> > While it may be possible to optimize this code I wonder if a
> > quicker/easier solution would be to refactor the lock.  At present
> > SELinux uses a read/write spinlock to protect the policy stored in the
> > kernel with macros to take and release the lock, POLICY_{RD,WR}LOCK and
> > POLICY_{RD,WR}UNLOCK.  From personal observations as well as a quick
> > check of the code, it appears that most of the time we only want to read
> > lock the policy and not write lock the policy - a spinlock, even a
> > read/write spinlock, seems a bit expensive here.
> >
> > If we were to convert from a read/write spinlock to a RCU locking
> > mechanism would this solve the preemption problem (I'm not a lock expert
> > either)?  If so, can anyone think of any reasons why converting the
> > policy lock to RCU is a bad idea (James, Stephen, the other James)?
>
> rcu_read_lock disables preemption in mainline (see rcupdate.h).
> Conversion to RCU is also complicated by conditional policy support
> (changing of policy boolean states via selinuxfs).  However, there were
> experimental patches to do that a while ago by KaiGai Kohei.

Okay, for some reason I thought someone had found a way to make 
RCU "preemptable" through the real-time work, maybe I'm just confused 
again :)  Regardless, it looks like there are better solutions possible.

Thanks.

-- 
paul moore
linux security @ hp

  reply	other threads:[~2007-06-04 23:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-04 11:27 [bug] very high non-preempt latency in context_struct_compute_av() Ingo Molnar
2007-06-04 13:25 ` James Morris
2007-06-04 14:17   ` Ingo Molnar
2007-06-04 21:11 ` Paul Moore
2007-06-04 21:39   ` Stephen Smalley
2007-06-04 22:48     ` Paul Moore [this message]
2007-06-04 22:54       ` James Morris
2007-06-07 19:34 ` Stephen Smalley
2007-06-07 19:51   ` Ingo Molnar
2007-06-07 20:11     ` James Morris

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=200706041848.21306.paul.moore@hp.com \
    --to=paul.moore@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=cpebenito@tresys.com \
    --cc=eparis@parisplace.org \
    --cc=jmorris@namei.org \
    --cc=jwcart2@tycho.nsa.gov \
    --cc=kaigai@kaigai.gr.jp \
    --cc=kmacmillan@mentalrootkit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=method@manicmethod.com \
    --cc=mingo@elte.hu \
    --cc=sds@tycho.nsa.gov \
    /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