public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Casey Schaufler <casey@schaufler-ca.com>
Cc: "David P. Quigley" <dpquigl@tycho.nsa.gov>,
	jmorris@namei.org, Stephen Smalley <sds@tycho.nsa.gov>,
	gregkh@suse.de, linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov
Subject: Re: [PATCH] Security/sysfs: Enable security xattrs to be set on sysfs files, directories, and symlinks.
Date: Fri, 14 Aug 2009 23:01:29 -0700	[thread overview]
Message-ID: <m1my61sjie.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <4A864008.50907@schaufler-ca.com> (Casey Schaufler's message of "Fri\, 14 Aug 2009 21\:56\:40 -0700")

Casey Schaufler <casey@schaufler-ca.com> writes:

> Eric W. Biederman wrote:
>> Casey Schaufler <casey@schaufler-ca.com> writes:
>>
>>   
>>> Actually, I see that as a justification for the special purpose
>>> scheme rather than a real issue. The real attribute data is going
>>> to take up the same amount of space regardless of how it gets
>>> managed. And Stephen is correct in thinking that is most cases
>>> where there are xattrs there will be only one. I don't see that
>>> a mechanism more elaborate than a list is going to gain much in
>>> real life. On the other hand, if you wanted to take the ball and
>>> run with it, I have a window manager to deal with.
>>>     
>>
>> If you look at things from the point of view of a single inode I would
>> have to agree that the storage costs are roughly the same however they
>> get managed.
>>
>> My understanding is that in most inodes all get a label from
>> a very small set of possible labels.
>>   
>
> Actually, my point is that most files that get xattrs get one xattr.
> The set of labels will be small for a Smack system or a real world
> MLS system. This is not true for SELinux, where the number of labels
> in flight at any given time can be .... large.

In the case of sysfs I don't think that is true enough to defeat the
optimization I am suggesting.  Right now selinux gets away with a
single label on sysfs (magically applied), and it is desired to have
one label per virtual machine.  The feature request that started this.

>> If that is true.  It makes sense to store the set of used labels
>> separately from the inodes.  Then on the inode just store a pointer
>> to the label.
>>   
>
> You have been reading the Smack code, haven't you?

No in this case.  Just trying to keep the sysfs data structures small
without giving up generality.  If I can pick some small static limits
and some simple optimizations for now that keep the size small.  The
entire reason we have sysfs_dirent is because people with lots of
hardware had enough problems with sysfs that they did the work.  So
someone cares (or at least cared) about the memory footprint.

Things like static limits are easy to work with.  If they are too
small we can always raise them later.

After seeing how much of a challenge the magic sysctl selinux handling
is I really would like to keep from having additional special cases
for kernel virtual filesystems.

>> Saying this in lisp parlance we should be able to use atoms instead of
>> strings.
>>   
>
> Sorry, but you're not old enough to be slinging lisp at me. (smiley)
> But yes, that is an apt comparison.
>
>> At which point we have (I believe) an implementation that is as practically
>> as efficient as what was originally proposed but as general and as maintainable
>> as your version.
>>
>> What I don't know is if the set of labels applied to a filesystem is actually
>> small, despite having a large number of labels applied.
>>   
>
> The question is whether you're more concerned with the xattr behavior
> or the LSM behavior. This is where the difference shows itself. If you
> look at the LSM, there is one value. If you look at xattrs, there may
> be many.

The xattr view is the general interface and what I would prefer to support.

> I personally think that the Right Thing(tm) is the xattr view. My
> experience is the LSM view. I hope that we don't shut off the Right
> Thing in preference to the issue of the day. I have been on both sides
> on this one.

Sure. That has been what was agreed to as a common abstraction to
filesystems.  Sysfs probably has special magic in SELinux for a
default label on all files but nothing else.  I don't see this
changing that.

If it is a valid optimization to inter atoms as the labels and just
hold a couple.  I think the implementation is roughly comparable in
size/complexity with what you have now, and likely to be a nicer in
the common case for the people who want to do play with labels and
sysfs.

If nothing else the footprint looks nicer.  Even if we use just as
much memory ;)

Eric


  reply	other threads:[~2009-08-15  6:01 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-15 13:48 [PATCH] Security/sysfs: Enable security xattrs to be set on sysfs files, directories, and symlinks David P. Quigley
2009-07-15 14:28 ` David P. Quigley
2009-07-15 14:31 ` David P. Quigley
2009-07-21 16:29 ` David P. Quigley
2009-07-21 16:49   ` Greg KH
2009-07-21 16:34 ` David P. Quigley
2009-07-21 17:01   ` David P. Quigley
2009-07-24  8:13     ` James Morris
2009-07-24 14:34       ` David P. Quigley
2009-07-24 14:54         ` Casey Schaufler
2009-08-14  4:59 ` Casey Schaufler
2009-08-14 12:20   ` Stephen Smalley
2009-08-14 12:40     ` Stephen Smalley
2009-08-15  1:33       ` Casey Schaufler
2009-08-17 12:01         ` Stephen Smalley
2009-08-15  1:19     ` Casey Schaufler
2009-08-17 11:53       ` Stephen Smalley
2009-08-14 22:02   ` Eric W. Biederman
2009-08-15  1:42     ` Casey Schaufler
2009-08-15  2:15       ` Eric W. Biederman
2009-08-15  4:56         ` Casey Schaufler
2009-08-15  6:01           ` Eric W. Biederman [this message]
2009-08-16 17:25             ` Casey Schaufler
2009-08-18  3:55             ` [PATCH] Security/sysfs: v2 - " Casey Schaufler
2009-08-18 12:14               ` Stephen Smalley
2009-08-18 14:12                 ` Casey Schaufler
2009-08-18 14:23                   ` Stephen Smalley
2009-08-19  4:37                     ` Casey Schaufler
2009-08-19 11:58                       ` Stephen Smalley
2009-08-19 17:47                         ` Casey Schaufler
2009-08-19 23:59                         ` Casey Schaufler
2009-08-20  2:41                           ` Eric W. Biederman
2009-08-20 11:53                             ` Stephen Smalley
2009-08-20 13:18 ` [PATCH] Security/sysfs: " David P. Quigley
2009-08-21  3:38   ` Casey Schaufler
  -- strict thread matches above, loose matches on Subject: below --
2009-09-03 18:25 David P. Quigley
2009-07-08 17:28 David P. Quigley
2009-07-09  1:44 ` Casey Schaufler
2009-07-09 14:05   ` David P. Quigley
2009-07-09 14:49     ` Casey Schaufler
2009-07-09 14:56       ` David P. Quigley
2009-07-09 15:16       ` David P. Quigley
2009-07-09 15:16     ` Greg KH
2009-07-09 14:11   ` David P. Quigley
2009-07-09 17:26   ` David P. Quigley
2009-07-09 17:50     ` Greg KH
2009-07-09 19:32       ` David P. Quigley
2009-07-09 20:13         ` Greg KH
2009-07-10  3:25         ` Casey Schaufler
2009-07-13 15:07           ` David P. Quigley
2009-07-09 15:18 ` Greg KH
2009-07-09 17:13   ` David P. Quigley
2009-07-09 17:52     ` Greg KH
2009-07-09 19:28       ` David P. Quigley
2009-07-09 20:12         ` Greg KH
2009-07-09 20:19           ` David P. Quigley
2009-07-09 20:41             ` Greg KH
2009-07-14 16:37               ` David P. Quigley
2009-07-14 17:50                 ` Greg KH
2009-07-14 20:16                   ` David P. Quigley
2009-07-14 20:35                     ` Greg KH
2009-07-14 20:35                       ` David P. Quigley
     [not found] ` <m1r5wmnee0.fsf@fess.ebiederm.org>
     [not found]   ` <1247498399.4398.259.camel@localhost>
2009-07-13 16:50     ` Eric W. Biederman
2009-07-13 19:18       ` David P. Quigley
2009-07-14  0:29         ` Eric W. Biederman
2009-07-14 13:55           ` David P. Quigley
2009-07-14  3:06         ` 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=m1my61sjie.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=casey@schaufler-ca.com \
    --cc=dpquigl@tycho.nsa.gov \
    --cc=gregkh@suse.de \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=sds@tycho.nsa.gov \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox