linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Sebastien Buisson <sbuisson.ddn@gmail.com>
Cc: linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, selinux@tycho.nsa.gov,
	serge@hallyn.com, james.l.morris@oracle.com,
	Eric Paris <eparis@parisplace.org>,
	Paul Moore <paul@paul-moore.com>,
	Daniel Jurgens <danielj@mellanox.com>,
	Sebastien Buisson <sbuisson@ddn.com>
Subject: Re: [PATCH 2/3] selinux: add checksum to policydb
Date: Fri, 28 Apr 2017 12:38:07 -0400	[thread overview]
Message-ID: <1493397487.6177.10.camel@tycho.nsa.gov> (raw)
In-Reply-To: <CAPkE-bWd0ArebM+8Vm5ZCQd90avZQ5sPSAR_2P5Y1brK5wKwJQ@mail.gmail.com>

On Fri, 2017-04-28 at 18:08 +0200, Sebastien Buisson wrote:
> 2017-04-28 17:50 GMT+02:00 Stephen Smalley <sds@tycho.nsa.gov>:
> > You seem to be conflating kernel policy with userspace policy.
> > security_load_policy() is provided with the kernel policy image,
> > which
> > is the result of linking the kernel-relevant portions of all policy
> > modules together. A hash of that image will change if you insert a
> > policy module that affects the kernel policy in any way.  But a
> > change
> > that only affects userspace policy isn't ever going to be reflected
> > in
> > the kernel.  It doesn't matter where or when you compute your
> > checksum
> > within the kernel; it isn't ever going to reflect those userspace
> > policy changes.
> 
> Here is the content of the module is used for my tests:
> 
> #============= user_t ==============
> allow user_t mnt_t:dir { write add_name };
> allow user_t mnt_t:file { write create };
> 
> After loading the .pp corresponding to it, I can see that with the
> method of computing the checksum on the (data, len) pair on entry to
> security_load_policy(), the checksum does not change. However, when
> using the (data, len) pair got from
> security_read_policy(), the checksum changes. And when I remove the
> module, the checksum is back to its previous value.
> So this is what makes me think there is a difference. Am I missing
> something?

Policy is loaded via security_load_policy(), so the policy image has to
go through it in the first place to be loaded (ignoring kernel exploits
or direct /dev/mem access).  You couldn't have loaded the modified
policy with your new rules without the modified policy getting
processed by security_load_policy().  So I'm assuming there is a bug in
your code or your testing.

  reply	other threads:[~2017-04-28 16:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-26 15:02 [PATCH 1/3] selinux: Implement LSM notification system Sebastien Buisson
2017-04-26 15:02 ` [PATCH 2/3] selinux: add checksum to policydb Sebastien Buisson
2017-04-26 18:30   ` Stephen Smalley
2017-04-27  8:41     ` Sebastien Buisson
2017-04-27 15:18       ` Stephen Smalley
2017-04-27 17:12         ` Sebastien Buisson
2017-04-27 18:47           ` Stephen Smalley
2017-04-28 15:16             ` Sebastien Buisson
2017-04-28 15:50               ` Stephen Smalley
2017-04-28 16:08                 ` Sebastien Buisson
2017-04-28 16:38                   ` Stephen Smalley [this message]
2017-04-26 15:02 ` [PATCH 3/3] selinux: expose policy SHA256 checksum via selinuxfs Sebastien Buisson
2017-04-26 18:31   ` Stephen Smalley
2017-04-27  1:08     ` James Morris
2017-04-26 15:38 ` [PATCH 1/3] selinux: Implement LSM notification system Casey Schaufler
2017-04-26 15:48   ` Daniel Jurgens
2017-04-26 15:57     ` Sebastien Buisson
2017-04-26 16:11     ` Casey Schaufler
2017-04-26 17:36   ` Stephen Smalley
2017-04-26 17:47     ` Casey Schaufler

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=1493397487.6177.10.camel@tycho.nsa.gov \
    --to=sds@tycho.nsa.gov \
    --cc=danielj@mellanox.com \
    --cc=eparis@parisplace.org \
    --cc=james.l.morris@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=sbuisson.ddn@gmail.com \
    --cc=sbuisson@ddn.com \
    --cc=selinux@tycho.nsa.gov \
    --cc=serge@hallyn.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).