All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Jones <tonyj@suse.de>
To: "Serge E. Hallyn" <serue@us.ibm.com>
Cc: Al Viro <viro@ftp.linux.org.uk>,
	linux-kernel@vger.kernel.org, chrisw@sous-sol.org,
	linux-security-module@vger.kernel.org
Subject: Re: [RFC][PATCH 4/11] security: AppArmor - Core access controls
Date: Thu, 20 Apr 2006 14:39:55 -0700	[thread overview]
Message-ID: <20060420213955.GA5458@suse.de> (raw)
In-Reply-To: <20060420114010.GB18604@sergelap.austin.ibm.com>

On Thu, Apr 20, 2006 at 06:40:10AM -0500, Serge E. Hallyn wrote:
> Quoting Al Viro (viro@ftp.linux.org.uk):
> > 
> > > +static int _aa_perm_dentry(struct aaprofile *active, struct dentry *dentry,
> > > +			   int mask, const char **pname)
> > > +{
> > > +	char *name = NULL, *failed_name = NULL;
> > > +	struct aa_path_data data;
> > > +	int error = 0, failed_error = 0, path_error,
> > > +	    complain = PROFILE_COMPLAIN(active);
> > > +
> > > +	/* search all paths to dentry */
> > > +
> > > +	aa_path_begin(dentry, &data);
> > > +	do {
> > > +		name = aa_path_getname(&data);
> > > +		if (name) {
> > > +			/* error here is 0 (success) or +ve (mask of perms) */
> > > +			error = aa_file_perm(active, name, mask);
> > > +
> > > +			/* access via any path is enough */
> > > +			if (complain || error == 0)
> > > +				break; /* Caller must free name */
> > > +
> > > +			/* Already have an path that failed? */
> > > +			if (failed_name) {
> > > +				aa_put_name(name);
> > > +			} else {
> > > +				failed_name = name;
> > > +				failed_error = error;
> > > +			}
> > > +		}
> > > +	} while (name);
> > 
> > Is that a joke?  Are you really proposing to do _that_ on anything resembling
> > a hot path?

Unfortunately Al, no it's not a joke. We've been asked to publish performance 
numbers by Serge as part of another thread. We plan to do so shortly. Of 
course results are likely going to be related to the complexity of the 
namespace the benchmark operates within. Suggestions of benchmarks that
significantly exercise namespaces are more than welcome.

We are no fan of this code either but the fact is that vfsmounts are passed
inconsistently to the LSM.  Of course this isn't an issue of LSM just not
taking available data, rather of the information not being available in the
VFS at the point the hook is invoked.   Going out on a limb here, to fully 
support read-only bind mounts would seem to require similar changes - but 
with a more limited scope - cases like security_inode_create and 
security_inode_link likely still wouldn't have the necessary information to 
fully eliminate the above fuglyness. Perhaps one hook cannot be made to provide
both useful inode and name information.

> > BTW, the problems here really have nothing to do with namespaces or
> > lazy umount, seeing that it's whitelisting.  Moderate amount of bindings
> > will kill you here.  So much that I suspect that one-time overhead of
> > creating a namespace and umounting / remounting noexec / etc. on
> > execve() will be cheaper than all this crap.
> 
> I guess this would require per-vfsmount flags (i.e. mount --bind -o ro)
> to be implemented, but IIUC the suggestion is
> 
> given a policy
> 
> /bin/stty {
> 	/bin/stty r
> }
> 
> during execve AA would unshare(CLONE_NEWNS), remount / readonly and
> noexec,  and mount /bin/stty into place with exec privs.  I guess
> getting /bin/stty into place shouldn't be much of a challenge (i.e.
> just do the operations in the order
> 	mkdir /.tmp123
> 	mount --bind -o ro,noexec / /.tmp123
> 	mount --bind /bin/stty /.tmp123/bin/stty
> 	mount --bind /.tmp123 /
> )
> but implementing the 'ux' exec permission which apparmor currently has
> (i.e. giving the ability for stty to then execute /bin/login without
> restrictions) could be more challenging.
> 
> This also might beg for sys_unshare() (and corresponding code in clone)
> to have it's own security_vfs_unshare() hook, rather than being globbed
> in with CAP_SYS_ADMIN.

Are we referring here to the idea of giving each confined task it's own
namespace upon exec?  An interesting idea for sure.  The exec portion you
mention above is pretty trivial.  How to handle directories, scratch space
(the ability of a confined task to write selected temp files) is less clear.
Also one of the most powerful aspects of AppArmor (at least if the users are
to be believed :-) is the ability for policy to contain path name expansion
(globbing). For instance, it is very useful to grant one web application 
access to /var/www/**.html and another access to /var/www/**.pl.

But I think passing vfsmounts fully into LSM and closing the cases where a
nameidata can be NULL is an alternative plan B.  Something we are willing to
put effort into helping achieve.

I believe what users want is a system which offers good practical security
together with ease of expressiveness in policy (so that it may be actually
maintained by other than distribution vendors). We strongly believe that 
AppArmor provides this and think it is important to persue changes to LSM 
(and the VFS) as necessary.  However there is clearly an undeniable elegance 
to the per-confined-task namespace idea. I have my concerns about whether it 
can achieve close to the same expressiveness as current AppArmor policy (one 
of AppArmor's clear advantages over SELinux) but it is clearly important that 
the namespace idea is explored. Just not to the exclusion of also exploring 
rework of the LSM/VFS.

Tony

  reply	other threads:[~2006-04-20 21:44 UTC|newest]

Thread overview: 174+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-19 17:49 [RFC][PATCH 0/11] security: AppArmor - Overview Tony Jones
2006-04-19 17:49 ` [RFC][PATCH 1/11] security: AppArmor - Integrate into kbuild Tony Jones
2006-04-19 17:57   ` Arjan van de Ven
2006-04-19 18:10     ` Tony Jones
2006-04-19 18:35   ` Valdis.Kletnieks
2006-04-19 19:55   ` Adrian Bunk
2006-04-19 20:52     ` Tony Jones
2006-04-19 17:49 ` [RFC][PATCH 2/11] security: AppArmor - Core headers Tony Jones
2006-04-19 18:01   ` Arjan van de Ven
2006-04-20 17:43     ` Tony Jones
2006-04-19 17:49 ` [RFC][PATCH 3/11] security: AppArmor - LSM interface Tony Jones
2006-04-19 18:05   ` Arjan van de Ven
2006-04-19 17:49 ` [RFC][PATCH 4/11] security: AppArmor - Core access controls Tony Jones
2006-04-19 18:10   ` Arjan van de Ven
2006-04-19 18:57     ` Crispin Cowan
2006-04-19 23:05       ` Rik van Riel
2006-04-19 23:18         ` Seth Arnold
2006-04-19 23:21           ` Rik van Riel
2006-04-19 23:50             ` Crispin Cowan
2006-04-20 12:33       ` Stephen Smalley
2006-04-20 16:27         ` Lars Marowsky-Bree
2006-04-20 17:39     ` Tony Jones
2006-04-19 19:32   ` Jan Engelhardt
2006-04-19 19:50   ` Stephen Smalley
2006-04-20  9:40   ` Al Viro
2006-04-20 11:40     ` Serge E. Hallyn
2006-04-20 21:39       ` Tony Jones [this message]
2006-04-19 17:49 ` [RFC][PATCH 5/11] security: AppArmor - Filesystem Tony Jones
2006-04-21 21:13   ` Amy Griffis
2006-04-19 17:49 ` [RFC][PATCH 6/11] security: AppArmor - Userspace interface Tony Jones
2006-04-20 21:39   ` Pavel Machek
2006-04-21 18:01     ` Tony Jones
2006-04-21 18:41       ` Pavel Machek
2006-04-19 17:50 ` [RFC][PATCH 7/11] security: AppArmor - Misc (capabilities, data structures) Tony Jones
2006-04-19 18:16   ` Stephen Hemminger
2006-04-19 17:50 ` [RFC][PATCH 8/11] security: AppArmor - Pathname matching submodule Tony Jones
2006-04-19 17:50 ` [RFC][PATCH 9/11] security: AppArmor - Audit changes Tony Jones
2006-04-21 21:21   ` Amy Griffis
2006-04-22  0:13     ` Steve Grubb
2006-04-22  0:13       ` Steve Grubb
2006-04-22  0:19       ` Tony Jones
2006-04-19 17:50 ` [RFC][PATCH 10/11] security: AppArmor - Add flags to d_path Tony Jones
2006-04-19 22:12   ` Christoph Hellwig
2006-04-20  5:36     ` Tony Jones
2006-04-20  8:26       ` Arjan van de Ven
2006-04-20 16:43         ` Tony Jones
2006-04-20 17:04           ` Christoph Hellwig
2006-04-20 17:50             ` Tony Jones
2006-04-21 12:16               ` Stephen Smalley
2006-04-24 13:05       ` Alan Cox
2006-04-19 17:50 ` [RFC][PATCH 11/11] security: AppArmor - Export namespace semaphore Tony Jones
2006-04-19 22:10   ` Christoph Hellwig
2006-04-20 12:39   ` Stephen Smalley
2006-04-20 12:46     ` Serge E. Hallyn
2006-04-20 12:05       ` Stephen Smalley
2006-04-20 13:21         ` Serge E. Hallyn
2006-04-20 12:48           ` Stephen Smalley
2006-04-20 12:58             ` Stephen Smalley
2006-04-20 22:11             ` Linda A. Walsh
2006-04-20 23:05               ` Christoph Hellwig
2006-04-21  1:29                 ` Linda A. Walsh
2006-04-21  2:09                   ` Chris Wright
2006-04-21  5:10                     ` Linda Walsh
2006-04-23 12:11                       ` Arjan van de Ven
2006-04-21 14:02               ` Stephen Smalley
2006-04-20 19:45           ` Tony Jones
2006-04-20 20:16             ` Serge E. Hallyn
2006-04-20 20:22             ` James Morris
2006-04-20 21:50     ` Linda Walsh
2006-04-20 21:56       ` Al Viro
2006-04-20 23:54         ` James Morris
2006-04-21 13:59       ` Stephen Smalley
2006-04-19 18:14 ` [RFC][PATCH 0/11] security: AppArmor - Overview Arjan van de Ven
2006-04-19 22:32   ` Andi Kleen
2006-04-19 23:00     ` grundig
2006-04-19 23:38       ` Andi Kleen
2006-04-20  1:32         ` Crispin Cowan
2006-04-20 13:00           ` grundig
2006-04-20 13:09             ` Serge E. Hallyn
2006-04-20 13:15               ` Al Viro
2006-04-21  0:11               ` Tony Jones
2006-04-24 13:01             ` Alan Cox
2006-04-20  8:42     ` Arjan van de Ven
2006-04-20 19:26       ` Crispin Cowan
2006-04-20 19:27       ` Chris Wright
2006-04-21 12:18         ` Stephen Smalley
2006-04-21 17:30           ` Chris Wright
2006-04-21 18:07             ` Stephen Smalley
2006-04-21 20:06               ` Valdis.Kletnieks
2006-04-21 20:35                 ` Stephen Smalley
2006-04-21 20:44                   ` Stephen Smalley
2006-04-21 21:38                   ` Dave Neuer
2006-04-22 10:01                     ` Thomas Bleher
2006-04-24  4:18               ` Neil Brown
2006-04-24  7:03                 ` Theodore Ts'o
2006-04-24 13:04                   ` Pavel Machek
2006-04-24 13:43                     ` Joshua Brindle
2006-04-24 21:07                   ` Stephen Smalley
2006-04-24 23:52                     ` Theodore Ts'o
2006-04-25  6:22                       ` Arjan van de Ven
2006-04-25 16:45                       ` Stephen Smalley
2006-04-25 16:52                         ` Arjan van de Ven
2006-04-25 17:43                           ` Seth Arnold
2006-04-25 18:34                         ` Valdis.Kletnieks
2006-04-25 18:48                           ` Stephen Smalley
2006-04-25 18:56                             ` Valdis.Kletnieks
2006-04-25  4:25                     ` Casey Schaufler
2006-04-25  7:50                       ` James Morris
2006-04-25 12:46                         ` Theodore Ts'o
2006-04-25 15:06                           ` Stephen Smalley
2006-04-25 16:00                         ` Casey Schaufler
2006-04-25 16:21                           ` Randy.Dunlap
2006-04-26  3:42                             ` Casey Schaufler
2006-04-26 12:15                               ` Stephen Smalley
2006-04-27  0:21                                 ` Casey Schaufler
2006-04-27 14:47                                   ` Karl MacMillan
2006-04-25 17:29                           ` Stephen Smalley
2006-04-26  3:56                             ` Casey Schaufler
2006-04-26 11:32                               ` Stephen Smalley
2006-04-25 16:47                       ` Stephen Smalley
2006-04-24  7:14                 ` Arjan van de Ven
2006-04-24  8:11                   ` Lars Marowsky-Bree
2006-04-25 19:27                   ` Seth Arnold
2006-04-24 13:11                 ` Joshua Brindle
2006-04-24 13:26                   ` Andi Kleen
2006-04-24 13:39                     ` Joshua Brindle
2006-04-24 15:16                       ` Joshua Brindle
2006-04-24 15:50                         ` Tony Jones
2006-04-24 17:03                           ` Joshua Brindle
2006-04-25 17:12                         ` Valdis.Kletnieks
2006-04-25 17:34                           ` Tony Jones
2006-04-24 13:52                     ` Alan Cox
2006-04-24 14:09                       ` Andi Kleen
2006-04-24 20:45                 ` Stephen Smalley
2006-04-25  8:10                   ` Neil Brown
2006-04-25  8:28                     ` Al Viro
2006-04-25 12:42                     ` James Carter
2006-04-25 12:43                       ` Andi Kleen
2006-04-25 14:50                         ` James Carter
2006-04-25 15:01                         ` Stephen Smalley
2006-04-25 18:11                           ` Tony Jones
2006-04-25 21:25                             ` Stephen Smalley
2006-04-25 17:07                     ` Stephen Smalley
2006-04-26 22:15                       ` Some Concrete AppArmor Questions - was " Neil Brown
2006-04-26 23:06                         ` Ken Brush
2006-04-27  4:15                           ` Andi Kleen
2006-04-27  6:52                             ` Arjan van de Ven
2006-04-27  7:40                               ` Chris Wright
2006-04-27 10:17                             ` Chris Wright
2006-04-27 14:42                               ` Karl MacMillan
2006-04-27 23:44                                 ` Chris Wright
2006-04-28 13:02                                   ` Stephen Smalley
2006-04-28 15:49                                     ` Casey Schaufler
2006-04-28 16:04                                       ` Stephen Hemminger
2006-04-28 21:49                                         ` James Morris
2006-04-28 16:56                                       ` Karl MacMillan
2006-04-27 16:03                               ` Stephen Smalley
2006-04-27 22:38                                 ` Chris Wright
2006-04-28 13:00                                   ` Stephen Smalley
2006-04-27 17:43                           ` Stephen Smalley
2006-04-27 17:58                             ` Ken Brush
2006-04-28 11:28                               ` Stephen Smalley
2006-04-28 11:47                                 ` Andi Kleen
2006-04-28 12:28                                   ` Stephen Smalley
2006-04-27 11:02                         ` Christoph Hellwig
2006-04-27 11:05                           ` Andi Kleen
2006-04-20 11:29     ` Serge E. Hallyn
2006-04-20 13:24     ` Christoph Hellwig
2006-04-20 22:32     ` Linda A. Walsh
2006-04-20 12:17 ` Stephen Smalley
2006-04-20 15:38   ` Joshua Brindle
2006-04-20 19:57   ` Crispin Cowan
2006-04-21 13:34     ` Stephen Smalley
2006-04-22 12:27 ` Pavel Machek

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=20060420213955.GA5458@suse.de \
    --to=tonyj@suse.de \
    --cc=chrisw@sous-sol.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=serue@us.ibm.com \
    --cc=viro@ftp.linux.org.uk \
    /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.