From: Shaya Potter Subject: Re: changing permission()/vfs_permission... to work on dentry Date: 28 May 2003 20:33:27 -0400 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <1054168407.9962.45.camel@zaphod> References: <1054154587.9356.15.camel@zaphod> <20030528214822.GF14138@parcelfarce.linux.theplanet.co.uk> <1054161272.9349.50.camel@zaphod> <20030528225308.GG14138@parcelfarce.linux.theplanet.co.uk> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org Return-path: Received: from opus.cs.columbia.edu ([128.59.20.100]:57576 "EHLO opus.cs.columbia.edu") by vger.kernel.org with ESMTP id S261759AbTE2AVN (ORCPT ); Wed, 28 May 2003 20:21:13 -0400 To: viro@parcelfarce.linux.theplanet.co.uk In-Reply-To: <20030528225308.GG14138@parcelfarce.linux.theplanet.co.uk> List-Id: linux-fsdevel.vger.kernel.org On Wed, 2003-05-28 at 18:53, viro@parcelfarce.linux.theplanet.co.uk wrote: > On Wed, May 28, 2003 at 06:34:32PM -0400, Shaya Potter wrote: > > > well, floppy's aren't so much what I'm interested in, but that's a good > > point. either the vfs would have to be changed or the permission/inode > > interface would have to stay around. floppy_open (I believe) is just > > called from the filp, which has access to the dentry, so it could be > > passed in, but I'm not sure if restructering all that would be > > worthwhile. > > No, it doesn't. As the matter of fact it's always NULL. What's more, > you do not have _any_ pathname in a bunch of cases (open_by_devnum()). ok, this is a learning experience. > > > The real question is what the hell would you _do_ with dentry? > > > > > > 1) It's worthless without vfsmount - alone it does *NOT* determine the > > > pathname. > > > > the kernel can always know the real vfsmount. > > 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. > > 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. > > > if you care about within a specific context, can use that too. > > > > > 2) assuming that you've somehow got both vfsmount and dentry (and thus > > > enough information to find the pathnam), what will you do with it? > > > Anything that requires ->i_sem on ancestors is not an option - quite > > > often they will be already locked. Moreover, there is no warranty that > > > pathname won't change right under you - starting with the parent of > > > your dentry. > > > > need to think more about the issues you just brought up, the path > > changing is what I'm mostly concerned about. > > > > > > > > IOW, what's the real goal? > > > > Well, I want to be able to create a SubDomain like system that allows > > one to run a process within a context that lets you specify an extra > > layer of permissions on top of the underlying fs. > > > > so my permission() would be something like > > > > if ( (context = find_context(current->pid)) != NULL ) > > { > > d_path(some denty, some vfsmount, scratch, size); to get full path > > and_mode = get_mode(context, full_path); > > > > real mode = inode mode & and_mode; > > Erm. Based on a _pathname_? I.e. just on a string? 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 and even uid 0 processes) the ability to get a root shell is limited. The problem is, one would have a problem storing all this attribute data for every file in a system as there can be many contexts. If one can store the rules instead and use "string compares" (well, not really string compares as that could be too slow) one can partition off the applications. So why not chroot? well, it doesn't work so well for uid 0 apps, as they can chroot themselves again. and even if that wasn't an issue, one isn't operating under a single namespace anymore so it makes administration harder.