All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Paul Moore <paul@paul-moore.com>
Cc: Jaejyn Shin <flagon22bass@gmail.com>, selinux <selinux@tycho.nsa.gov>
Subject: Re: Fwd: Booting time is increased after applying kernel 3.10
Date: Thu, 26 Jun 2014 09:57:57 -0400	[thread overview]
Message-ID: <53AC26E5.2040006@tycho.nsa.gov> (raw)
In-Reply-To: <CAB9W1A2VnkCh3ru7ZKST0e55DnpMxPEbzDdczwDY7o0tsZdjnw@mail.gmail.com>

On 06/25/2014 03:49 PM, Stephen Smalley wrote:
> I suspect it won't matter in practice, but the reason for it is that
> permissions or other state may have been cached during bootup prior to
> initial policy load that may no longer be valid.

So, as far as the netif/node/port caches are concerned, the potential
concern is that if we perform any netif/node/port SID lookups prior to
initial policy load, then the kernel security server will always return
the netif/node/port initial SIDs, and those SIDs will be cached for any
such interfaces, IP addresses, or port numbers looked up prior to the
policy load and continue to be used after the policy load even if the
policy defines a different context for that interface, address, or port.
 This should only be an issue if some action is performed that would
trigger a netif/node/port lookup prior to initial policy load (e.g.
network interface configuration, binding to a network port, sending or
receiving a packet), and if the policy defines a netif, node, or port
context other than the one associated with the initial netif, node, or
port SIDs for any such interface, address, or port.

So in Android at least it is a non-issue (policy is loaded by init from
the initramfs before any network interface configuration).  I'm a bit
unclear on what happens in Fedora these days from the initramfs, and how
it might deal with e.g. a nfsroot or something similar where network
interfaces may be configured and network traffic may already be
occurring before policy can be loaded from the real root filesystem.

As far as the AVC state is concerned, security_compute_av() will return
all-permissions-allowed until policy is first loaded, so the AVC may
contain cached permissions for the kernel SID for any requested
permissions prior to initial policy load, which is why we flush its
contents.  However, this should only matter for the kernel SID.

We will also perform an avc_ss_reset() on the setenforce 1 by init if
the system is enforcing to flush any permissions added to the AVC while
permissive.  So even if we were to drop the avc_ss_reset() from the
initial policy load, we would still get it on enforcing systems as a
side effect of the setenforce 1.  However, that could yield different
avc denials on a permissive vs enforcing system.

So I am not sure we can safely remove the avc_ss_reset() from initial
policy load in the mainline kernel, as we are not guaranteed that there
is no network interface configuration prior to initial policy load and
we are not guaranteed that there will be a setenforce 1.  It would
perhaps be better there to instead just avoid calling synchronize_net
altogether if possible or only call it once for the entire avc_ss_reset,
not on each of the netif/node/port callbacks.

  parent reply	other threads:[~2014-06-26 13:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAEFn6A4mzF208e1s_OHEzJ-1Kq-DUGgzVNbQXrW6NbB0e8DSpQ@mail.gmail.com>
2014-06-25 19:14 ` Fwd: Booting time is increased after applying kernel 3.10 Stephen Smalley
2014-06-25 19:29   ` Paul Moore
2014-06-25 19:49     ` Stephen Smalley
2014-06-25 23:19       ` Jaejyn Shin
2014-06-26 13:57       ` Stephen Smalley [this message]
2014-06-26 14:17         ` Paul Moore
2014-06-27 12:15           ` Stephen Smalley
2014-06-27 12:52             ` Stephen Smalley
2014-06-27 13:11               ` Paul Moore
2015-04-01 18:58 Ravi Kumar
2015-04-01 19:20 ` Stephen Smalley
2015-04-01 19:24   ` Stephen Smalley

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=53AC26E5.2040006@tycho.nsa.gov \
    --to=sds@tycho.nsa.gov \
    --cc=flagon22bass@gmail.com \
    --cc=paul@paul-moore.com \
    --cc=selinux@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 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.