linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastien Buisson <sbuisson.ddn@gmail.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Paul Moore <pmoore@redhat.com>,
	selinux@tycho.nsa.gov, william.c.roberts@intel.com,
	linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	Sebastien Buisson <sbuisson@ddn.com>,
	james.l.morris@oracle.com
Subject: Re: [PATCH] selinux: add selinux_is_enforced() function
Date: Wed, 12 Apr 2017 17:11:43 +0200	[thread overview]
Message-ID: <CAPkE-bWQLfSq0+J0uoMRKAPbSdO0giuGZzfRXA7VXL+xo3fNgg@mail.gmail.com> (raw)
In-Reply-To: <1492007701.3881.10.camel@tycho.nsa.gov>

2017-04-12 16:35 GMT+02:00 Stephen Smalley <sds@tycho.nsa.gov>:
> How are you using this SELinux information in the kernel and/or in
> userspace?  What's the purpose of it?  What are you comparing it
> against?  Why do you care if it changes?

Enforcement status and policy version are compared to their previously
stored value. If they differ, then it means we need to call a userland
helper from Lustre client kernelspace to read the currently loaded
policy (reading it will let us know if the Lustre client node is
conforming to the Lustre-wide security policy).
As calling the userland helper is costly, we do it only when it is
necessary by retrieving some SELinux key information directly from
kernelspace.

> Note btw that the notion of a policy name/type and the policy file path
> is purely a userspace construct and shouldn't be embedded in your
> kernel code.  Android for example doesn't follow that convention at
> all; their SELinux policy file is simply /sepolicy.  On modern kernels,
> you can always read the currently loaded policy from the kernel itself
> via /sys/fs/selinux/policy (formerly just /selinux/policy).

As I understand it, a userspace program can directly read the policy
info exposed by the kernel by reading this file. But how about reading
it from kernelspace?

  reply	other threads:[~2017-04-12 15:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-12  9:06 [PATCH] selinux: add selinux_is_enforced() function Sebastien Buisson
2017-04-12 11:55 ` Paul Moore
2017-04-12 13:30   ` Sebastien Buisson
2017-04-12 13:58     ` Stephen Smalley
2017-04-12 15:19       ` Sebastien Buisson
2017-04-12 16:33         ` Stephen Smalley
2017-04-13  0:12           ` Casey Schaufler
2017-04-12 13:30   ` Sebastien Buisson
2017-04-12 14:35     ` Stephen Smalley
2017-04-12 15:11       ` Sebastien Buisson [this message]
2017-04-12 16:24         ` Stephen Smalley
2017-04-12 17:07           ` Sebastien Buisson
2017-04-12 17:24             ` Stephen Smalley
2017-04-12 12:13 ` 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=CAPkE-bWQLfSq0+J0uoMRKAPbSdO0giuGZzfRXA7VXL+xo3fNgg@mail.gmail.com \
    --to=sbuisson.ddn@gmail.com \
    --cc=james.l.morris@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=pmoore@redhat.com \
    --cc=sbuisson@ddn.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    --cc=william.c.roberts@intel.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;
as well as URLs for NNTP newsgroup(s).