All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: changing permission()/vfs_permission... to work on dentry
@ 2003-05-29  0:55 viro
  2003-05-29  4:20 ` Shaya Potter
  0 siblings, 1 reply; 11+ messages in thread
From: viro @ 2003-05-29  0:55 UTC (permalink / raw)
  To: linux-fsdevel

On Wed, May 28, 2003 at 08:29:13PM -0400, Shaya Potter wrote:
 
> > Define "real".  There can be a lot of them and none are more real than
> > other - same situation as with dentries, actually (all links have the
> > same status; there is no "primary" one).
> 
> well real depends on what you want.  Take for instance the example I
> gave w/ the context, the context can contain a vfsmount, which you then
> use.

touch  /tmp/zero && mount --bind /dev/zero /tmp/zero

After that we have a vfsmount mounted on /tmp/zero and pointing to
superblock of root filesystem and dentry of dev/zero from it.

Both /tmp/zero and /dev/zero will resolve to the same inode (and same
dentry, for that matter).  vfsmounts are different and both are obviously
visible to your process.

Which one is "real"?  What's more, I can e.g. mount ramfs on /mnt,
then bind it on /tmp/foo and /tmp/bar and umount /mnt.  After that
we have the same tree mounted twice and original vfsmount already
gone.  Which one is real - one for /tmp/foo or one for /tmp/bar?
 
> > You'll need to propagate pointers to vfsmounts and it won't be pretty -
> > e.g. hpfs_unlink() calls permission() and passing vfsmount to ->unlink()
> > is just plain *wrong*.
> 
> one doesn't have to.  permission() figures out calling process
> (current->uid), figures out calling processes context.

See above.

> yes.  The issue we are trying to solve (much like SubDomain
> http://www.immunix.org/subdomain.html) is that you have a single fs, but
> not every application needs access to that entire namespace, but from an
> administrative point of view, its easier to deal w/ a single namespace. 
> For instance, sendmail doesn't need /bin/sh, it be fairly hard to
> administrate a sendmail box that didn't have it though.  If there's no
> /bin/sh in the processes "namespace" (used loosely, as in mode 000 to it

So give it a _REAL_ namespace.  And bind /dev/null over /bin/sh in it.
And revoke the capability to call mount(2) and umount(2).  End of story.

> and even uid 0 processes) the ability to get a root shell is limited.  

And why would I need a /bin/sh binary if I'd already acquired control over
a process that runs with UID 0?

Anyway, judging by the description on immunix.org, it looks fairly useless
these days.  We can trivially do the same without any kernel extensions:

|    * A SubDomain is easier to construct than a chroot environment.
|       Instead of copying everything required for the program to run into
|       the chroot jail, SubDomain only requires that the files be
|       specified in the /etc/subdomain entry.

Yes, and...?  clone() with CLONE_NEWNS, bind whatever you want wherever
you feel like and you are done.

|     * SubDomain can share files with the rest of the system. Files in a
|       chroot jail are effectively isolated from the rest of the system.
|       They should not be hard- or sym-linked to files outside the chroot
|       jail, because they may provide an escape route.  In contrast,
|       SubDomain allows flexible sharing with the rest of the system;
|       each file accessed also specifies the access modes (read, write,
|       and execute) that may be used.

<shrug> aside of the last bit, everything still applies.  Per-mountpoint
read_only is wort doing (and would cover the rest), but it can get tricky.
Basically, you need IS_RDONLY() taking vfsmount and looking both into
superblock and vfsmount flags.  Then the same game with propagating
new argument to all callers.

|     * SubDomain descriptions can be distributed.  To distribute a
|       program along with its SubDomain jail, one need only package the
|       SubDomain specification along with the program.  In contrast,
|       distributing a chroot jail is problematic; the files to be placed
|       in the chroot jail must actually be included in the package, and
|       are not consistent with the files on the system where they are 
|       installed.  In other words, SubDomain distributes a jail by
|       reference, while chroot distributes a jail by value.

Ditto for namespaces.

Comparison with FPOSIX crapabilities also applies, obviously.

----- End forwarded message -----

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-05-29 21:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-29  0:55 changing permission()/vfs_permission... to work on dentry viro
2003-05-29  4:20 ` Shaya Potter
2003-05-29  4:38   ` Chris Wright
2003-05-29  8:27     ` viro
2003-05-29  8:21   ` [long] per-mountpoint readonly viro
2003-05-29  9:02     ` Trond Myklebust
2003-05-29  9:31       ` viro
2003-05-29  9:42     ` Christoph Hellwig
2003-05-29 16:24     ` Bryan Henderson
2003-05-29 19:22       ` viro
2003-05-29 21:30         ` Bryan Henderson

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.