All of lore.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@susa.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 15:02:25 -0700	[thread overview]
Message-ID: <m1my62xde6.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <4A84EF1D.8060408@schaufler-ca.com> (Casey Schaufler's message of "Thu\, 13 Aug 2009 21\:59\:09 -0700")


>From a long term maintenance perspective I have to say I like Casey's
version that doesn't require any magic security module compression
hooks to implement this.

>From an implementation point of view Stephen's comments seem accurate.

Is there any debate that Casey's version will get the job done?

If not the only real question is how do we store xattrs efficiently for
in memory filesystems.  

Let me propose a different xattr compression scheme instead of making
the security module responsible for compression.

How about we have:
struct sysfs_xattr *sysfs_store_xattr(const char *name, const void *value, size_t size);
void sysfs_release_xattr(struct sysfs_xattr *xattr);

Where sysfs_xattr looks something like:
struct sysfs_xattr {
       struct hlist_node list;
       atomic_t count;
       const char *name;
       const void *value;
       size_t size;
}

And then at the end of of what is today s_iattr we have something like:
struct sysfs_xattr *xattrs[2];


The key point here is that sysfs_store_xattr will look to see in a
hash table to see if another inode/dentry has already stored the
specified xattr and if so increment the count of sysfs_xattr count
and return it.

My design assumption is that the set of xattrs that people want to
apply to filesystems is small.

By optimizing for a small number of distinct xattrs we keep the
storage size small (even for those filesystems who want to label
everything), and we keep the generality by not making storage of
xattrs a security module responsibility.

Does that sound like it will work?

Eric

WARNING: multiple messages have this Message-ID (diff)
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@susa.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 15:02:25 -0700	[thread overview]
Message-ID: <m1my62xde6.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <4A84EF1D.8060408@schaufler-ca.com> (Casey Schaufler's message of "Thu\, 13 Aug 2009 21\:59\:09 -0700")


>From a long term maintenance perspective I have to say I like Casey's
version that doesn't require any magic security module compression
hooks to implement this.

>From an implementation point of view Stephen's comments seem accurate.

Is there any debate that Casey's version will get the job done?

If not the only real question is how do we store xattrs efficiently for
in memory filesystems.  

Let me propose a different xattr compression scheme instead of making
the security module responsible for compression.

How about we have:
struct sysfs_xattr *sysfs_store_xattr(const char *name, const void *value, size_t size);
void sysfs_release_xattr(struct sysfs_xattr *xattr);

Where sysfs_xattr looks something like:
struct sysfs_xattr {
       struct hlist_node list;
       atomic_t count;
       const char *name;
       const void *value;
       size_t size;
}

And then at the end of of what is today s_iattr we have something like:
struct sysfs_xattr *xattrs[2];


The key point here is that sysfs_store_xattr will look to see in a
hash table to see if another inode/dentry has already stored the
specified xattr and if so increment the count of sysfs_xattr count
and return it.

My design assumption is that the set of xattrs that people want to
apply to filesystems is small.

By optimizing for a small number of distinct xattrs we keep the
storage size small (even for those filesystems who want to label
everything), and we keep the generality by not making storage of
xattrs a security module responsibility.

Does that sound like it will work?

Eric

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

  parent reply	other threads:[~2009-08-14 22:02 UTC|newest]

Thread overview: 102+ 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 13:48 ` David P. Quigley
2009-07-15 14:28 ` David P. Quigley
2009-07-15 14:28   ` David P. Quigley
2009-07-15 14:31 ` David P. Quigley
2009-07-15 14:31   ` David P. Quigley
2009-07-21 16:29 ` David P. Quigley
2009-07-21 16:29   ` David P. Quigley
2009-07-21 16:49   ` Greg KH
2009-07-21 16:49     ` Greg KH
2009-07-21 16:34 ` David P. Quigley
2009-07-21 16:34   ` David P. Quigley
2009-07-21 17:01   ` David P. Quigley
2009-07-21 17:01     ` David P. Quigley
2009-07-24  8:13     ` James Morris
2009-07-24  8:13       ` James Morris
2009-07-24 14:34       ` David P. Quigley
2009-07-24 14:34         ` David P. Quigley
2009-07-24 14:54         ` Casey Schaufler
2009-07-24 14:54           ` Casey Schaufler
2009-08-14  4:59 ` Casey Schaufler
2009-08-14  4:59   ` Casey Schaufler
2009-08-14 12:20   ` Stephen Smalley
2009-08-14 12:20     ` Stephen Smalley
2009-08-14 12:40     ` Stephen Smalley
2009-08-14 12:40       ` Stephen Smalley
2009-08-15  1:33       ` Casey Schaufler
2009-08-15  1:33         ` Casey Schaufler
2009-08-17 12:01         ` Stephen Smalley
2009-08-17 12:01           ` Stephen Smalley
2009-08-15  1:19     ` Casey Schaufler
2009-08-15  1:19       ` Casey Schaufler
2009-08-17 11:53       ` Stephen Smalley
2009-08-17 11:53         ` Stephen Smalley
2009-08-14 22:02   ` Eric W. Biederman [this message]
2009-08-14 22:02     ` Eric W. Biederman
2009-08-15  1:42     ` Casey Schaufler
2009-08-15  1:42       ` Casey Schaufler
2009-08-15  2:15       ` Eric W. Biederman
2009-08-15  2:15         ` Eric W. Biederman
2009-08-15  4:56         ` Casey Schaufler
2009-08-15  4:56           ` Casey Schaufler
2009-08-15  6:01           ` Eric W. Biederman
2009-08-15  6:01             ` Eric W. Biederman
2009-08-16 17:25             ` Casey Schaufler
2009-08-16 17:25               ` Casey Schaufler
2009-08-18  3:55             ` [PATCH] Security/sysfs: v2 - " Casey Schaufler
2009-08-18  3:55               ` Casey Schaufler
2009-08-18 12:14               ` Stephen Smalley
2009-08-18 12:14                 ` Stephen Smalley
2009-08-18 14:12                 ` Casey Schaufler
2009-08-18 14:12                   ` Casey Schaufler
2009-08-18 14:23                   ` Stephen Smalley
2009-08-18 14:23                     ` Stephen Smalley
2009-08-19  4:37                     ` Casey Schaufler
2009-08-19  4:37                       ` Casey Schaufler
2009-08-19 11:58                       ` Stephen Smalley
2009-08-19 11:58                         ` Stephen Smalley
2009-08-19 17:47                         ` Casey Schaufler
2009-08-19 17:47                           ` Casey Schaufler
2009-08-19 23:59                         ` Casey Schaufler
2009-08-19 23:59                           ` Casey Schaufler
2009-08-20  2:41                           ` Eric W. Biederman
2009-08-20  2:41                             ` Eric W. Biederman
2009-08-20 11:53                             ` Stephen Smalley
2009-08-20 11:53                               ` Stephen Smalley
2009-08-20 13:18 ` [PATCH] Security/sysfs: " David P. Quigley
2009-08-20 13:18   ` David P. Quigley
2009-08-21  3:38   ` Casey Schaufler
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=m1my62xde6.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=casey@schaufler-ca.com \
    --cc=dpquigl@tycho.nsa.gov \
    --cc=gregkh@susa.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 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.