linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Susi <psusi@cfl.rr.com>
To: Kyle Moffett <mrmacman_g4@mac.com>
Cc: Michael Tharp <gxti@partiallystapled.com>,
	alan <alan@clueserver.org>, Marc Perkel <mperkel@yahoo.com>,
	LKML Kernel <linux-kernel@vger.kernel.org>,
	Lennart Sorensen <lsorense@csclub.uwaterloo.ca>,
	Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: Thinking outside the box on file systems
Date: Wed, 15 Aug 2007 18:14:44 -0400	[thread overview]
Message-ID: <46C37AD4.5060006@cfl.rr.com> (raw)
In-Reply-To: <87EEB1B3-7FFA-472C-B539-1A7AA2843869@mac.com>

Kyle Moffett wrote:
>> I am well aware of that, I'm simply saying that sucks.  Doing a 
>> recursive chmod or setfacl on a large directory tree is slow as all hell.
> 
> Doing it in the kernel won't make it any faster.

Right... I'm talking about getting rid of it entirely.

> You can't safely preserve POSIX semantics that way.  For example, even 
> without *ANY* ability to read /etc/shadow, I can easily "ln /etc/shadow 
> /tmp/shadow", assuming they are on the same filesystem.  If the 
> /etc/shadow permissions depend on inherited ACLs to enforce access then 
> that one little command just made your shadow file 
> world-readable/writeable.  Oops.

That's why /etc/shadow would have an IRM that would block inheriting any 
permissions.

> Think about it this way:
> Permissions depend on *what* something is, not *where* it is.  Under 

No, they don't.  At least not always.  A lot of times people want 
permissions based on where it is.

> Linux you can leave the digital equivalent of a $10,000 piece of jewelry 
> lying around in /var/www and not have to worry about it being 
> compromised as long as you set your permissions properly (not that I 
> recommend it).  Moving the piece of jewelry around your house does not 
> change what it *is* (and by extension does not change the protection 
> required on it), any more than "ln /etc/shadow /tmp/shadow" (or "mv") 
> changes what *it* is.  If your /house is really extraordinarily secure 
> then you could leave the jewelry lying around as /house/gems.bin with 
> permissions 0777, but if somebody had a back-door to /house (an open fd, 
> a careless typo, etc) then you'd have the same issues.

Yes, but if you move it to your front porch, you have changed the 
protection on it.  If you want to be sure of it being protected, keep it 
locked up in a safe... in other words, use the IRM.

> Not necessarily.  When I do "vim some-file-in-current-directory", for 
> example, the kernel does *NOT* look up the path of my current 
> directory.  It does (in pseudocode):
> 
> if (starts_with_slash(filename)) {
>     entry = task->cwd;
> } else {
>     entry = task->root;
> }
> while (have_components_left(filename)
>     entry = lookup_next_component(filename);
> return entry;

Right.... and task->cwd would have the effective acl in memory, ready to 
be combined with any acl set on the file.

> That's not even paying attention to functions like "fchdir" or their 
> interactions with "chroot" and namespaces.  I can probably have an open 
> directory handle to a volume in a completely different namespace, a 
> volume which isn't even *MOUNTED* in my current fs namespace.  Using 
> that file-handle I believe I can "fchdir", "openat", etc, in a 
> completely different namespace.  I can do the same thing with a chroot, 
> except there I can even "escape":
>   /* Switch into chroot.  Doesn't drop root privs */
>   chdir("/some/dir/somewhere");
>   chroot(".");
> 
>   /* Malicious code later on */
>   chdir("/");
>   chroot("another_dir");
>   chdir("../../../../../../../../..");
>   chroot(".");
>   /* Now I'm back in the real root filesystem */

I don't see what this has to do with this discussion, and I also can't 
believe that is correct... the chdir( "../../../../.." ) should fail 
because there is no such directory.

> The locking penalty is because the path-lookup is *not* implied.  The 
> above chroot example shows that in detail.  If you have to do the lookup 
> in *reverse* on every open operation then you have to either:
> 
>   (A) Store lots of security context with every open directory (cwd 
> included).  When a directory you have open is moved, you still have full 
> access to everything inside it since your handle's data hasn't changed.

Yes, the effective acl of the open directory is kept in memory, but in 
the directory itself, not the handle to it, thus when the directory is 
moved, it's acl is recomputed for the new location and updated 
immediately.  It is like using fcntl to set a file to non blocking... it 
is the file you set, not the handle to it, so it effects other processes 
that have inherited or duplicated the file.

> See above.  Linux has a very *very* powerful VFS nowadays.  It also has 
> support for shared subtrees across private namespaces, allowing things 
> like polyinstantiation.  For example you can configure a Linux box so 
> every user gets their own empty /tmp directory created and mounted on 
> their namespace's /tmp when they log in, but all the rest of the system 
> mounts are all shared.

I still can't see how these features cause a problem.


  reply	other threads:[~2007-08-15 22:14 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-14 22:45 Thinking outside the box on file systems Marc Perkel
2007-08-14 22:51 ` alan
2007-08-15 13:02   ` Michael Tharp
2007-08-15 13:30     ` Lennart Sorensen
2007-08-15 13:53       ` Kyle Moffett
2007-08-15 15:14         ` Michael Tharp
2007-08-15 16:36           ` Marc Perkel
2007-08-15 17:17             ` Kyle Moffett
2007-08-15 17:30               ` Marc Perkel
2007-08-15 18:22                 ` Craig Ruff
2007-08-15 20:35                   ` Marc Perkel
2007-08-16 11:27                     ` Helge Hafting
2007-08-15 16:02         ` Marc Perkel
2007-08-15 16:57           ` Valdis.Kletnieks
2007-08-15 17:09             ` Marc Perkel
2007-08-15 17:22               ` Kyle Moffett
2007-08-15 17:34                 ` Marc Perkel
2007-08-18 23:27                   ` Alan
2007-08-18 23:26                 ` Alan
2007-08-19  2:03                   ` david
2007-08-19  2:57                     ` Al Viro
2007-09-01 23:20                       ` Oleg Verych
2007-08-15 19:20               ` Lennart Sorensen
2007-08-16 23:12               ` H. Peter Anvin
2007-08-15 16:58           ` Kyle Moffett
2007-08-15 17:19             ` Marc Perkel
2007-08-15 17:37               ` Kyle Moffett
2007-08-15 17:59                 ` Marc Perkel
2007-08-15 19:26                   ` Lennart Sorensen
2007-08-15 20:11                     ` Kyle Moffett
2007-08-15 20:44                       ` Marc Perkel
2007-08-15 21:04                         ` Lennart Sorensen
2007-08-16 11:42               ` Helge Hafting
2007-08-16 12:09                 ` linux-os (Dick Johnson)
2007-08-15 17:34         ` Phillip Susi
2007-08-15 17:53           ` Kyle Moffett
2007-08-15 18:05             ` Marc Perkel
2007-08-15 18:14               ` Kyle Moffett
2007-08-15 20:20                 ` Marc Perkel
2007-08-15 20:43                   ` Phillip Susi
2007-08-15 20:50                     ` Marc Perkel
2007-08-15 21:20                       ` Valdis.Kletnieks
2007-08-15 22:48                         ` Marc Perkel
2007-08-16  3:42                           ` Valdis.Kletnieks
2007-08-15 20:38             ` Phillip Susi
2007-08-15 21:17               ` Kyle Moffett
2007-08-15 22:14                 ` Phillip Susi [this message]
2007-08-16  4:44                   ` Kyle Moffett
2007-08-16 15:09                     ` Phillip Susi
2007-08-16 15:29                       ` Valdis.Kletnieks
2007-08-16 17:28                         ` Phillip Susi
2007-08-16 17:31                           ` Valdis.Kletnieks
2007-08-16 22:03                             ` Phillip Susi
2007-08-16 23:17                       ` Kyle Moffett
2007-08-17  4:24                         ` Marc Perkel
2007-08-17  4:52                           ` Valdis.Kletnieks
2007-08-17 15:19                         ` Phillip Susi
2007-08-17 15:39                           ` Valdis.Kletnieks
2007-08-17 19:01                             ` Phillip Susi
2007-08-18  5:48                               ` Kyle Moffett
2007-08-18 16:45                                 ` Marc Perkel
2007-08-18 18:19                                   ` Al Viro
2007-08-19  4:07                                     ` Marc Perkel
2007-08-20  7:05                                       ` Nix
2007-08-20  7:47                                         ` Brennan Ashton
2007-08-20 11:18                                           ` Marc Perkel
2007-08-20 13:32                                             ` linux-os (Dick Johnson)
2007-08-20 15:25                                             ` Lennart Sorensen
2007-08-20 15:26                                             ` Helge Hafting
2007-08-20 19:52                                               ` Nix
2007-08-20 16:21                                             ` [OT] " Randy Dunlap
2007-08-20 16:20                                               ` Xavier Bestel
2007-08-20 14:29                                       ` Phillip Susi
2007-08-20 15:13                                       ` Lennart Sorensen
2007-08-20 14:24                                 ` Phillip Susi
2007-08-15 22:40                 ` Marc Perkel
2007-08-15 17:54           ` Marc Perkel
2007-08-15 17:02   ` Marc Perkel
2007-08-15 17:30     ` Michael Tharp
2007-08-15 17:51       ` Marc Perkel
2007-08-15 20:02 ` Yakov Lerner
  -- strict thread matches above, loose matches on Subject: below --
2007-08-15  7:49 Tim Tassonis
2007-08-15 18:23 Brian Wheeler
2007-08-20 11:54 Tim Tassonis

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=46C37AD4.5060006@cfl.rr.com \
    --to=psusi@cfl.rr.com \
    --cc=alan@clueserver.org \
    --cc=gxti@partiallystapled.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lsorense@csclub.uwaterloo.ca \
    --cc=mperkel@yahoo.com \
    --cc=mrmacman_g4@mac.com \
    --cc=viro@zeniv.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 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).