From: Shaya Potter Subject: changing permission()/vfs_permission... to work on dentry Date: 28 May 2003 16:43:08 -0400 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <1054154587.9356.15.camel@zaphod> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: Received: from opus.cs.columbia.edu ([128.59.20.100]:8068 "EHLO opus.cs.columbia.edu") by vger.kernel.org with ESMTP id S264752AbTE1UaV (ORCPT ); Wed, 28 May 2003 16:30:21 -0400 Received: from dyn-wireless-246-196.dyn.columbia.edu (dyn-wireless-246-196.dyn.columbia.edu [160.39.246.196]) (authenticated bits=0) by opus.cs.columbia.edu (8.12.9/8.12.9) with ESMTP id h4SKhbug023995 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT) for ; Wed, 28 May 2003 16:43:38 -0400 (EDT) To: linux-fsdevel@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org I've gone through the entire fs/* vfs layer picking out every use of permission to see if it can easily use the dentry instead, and it can (list below showing that the dentry is readily available in every vfs case) The idea for converting it over would be to at first add 2 temporary functions, entry_permission() and dentry_vfs_permission(), so that one can proceed incrementally, and then to do a total change over by getting rid of the old permission() and vfs_permission() and renaming the temporary functions to the regular. I'm making an assumption (perhaps dangerous) that the fs permission() functions directly mirrors vfs_permission() (based only on experience w/ nfs filesystem) and therefore since fs permission() function is only called from permission() (as vfs_permission() can also be) and therefore would all be easy to switch over. anyways, just want to make sure that I'm not missing anything. thanks, shaya ------------------------- exec.c ------ sys_use_lib() error = permission(nd.dentry->d_inode, MAY_READ | MAY_EXEC); open_exec() inode = nd.dentry->d_inode; int err = permission(inode, MAY_EXEC); flush_old_exec() permission(bprm->file->f_dentry->d_inode,MAY_READ) prepare_binprm() doesn't work off of permission directly - why? namei.c ------- vfs_permission() change option to take a dentry and get inode from that, instead of taking inode directly. permission() same as vfs_permission() path_walk() inode = nd->dentry->d_inode; err = permission(inode, MAY_EXEC); lookup_hash(struct dentry * base) inode = base->d_inode; err = permission(inode, MAY_EXEC); static inline int may_delete(struct inode *dir,struct dentry *victim, int isdir) error = permission(dir,MAY_WRITE | MAY_EXEC); since if (!victim->d_inode || victim->d_parent->d_inode != dir) return -ENOENT; shouldn't be an issue. static inline int may_create(struct inode *dir, struct dentry *child) return permission(dir,MAY_WRITE | MAY_EXEC); seems to be the same as above open_namei() inode = dentry->d_inode; error = permission(inode,acc_mode); vfs_rename_dir() error = permission(old_dentry->d_inode, MAY_WRITE); namespace.c ----------- mount_is_safe() if (permission(nd->dentry->d_inode, MAY_WRITE)) open.c ------ do_sys_truncate() inode = nd.dentry->d_inode; error = permission(inode,MAY_WRITE); sys_utime() inode = nd.dentry->d_inode; error = permission(inode,MAY_WRITE) sys_utimes() inode = nd.dentry->d_inode; error = permission(inode,MAY_WRITE) sys_access() res = permission(nd.dentry->d_inode, mode); sys_chdir() error = permission(nd.dentry->d_inode,MAY_EXEC); sys_fchdir() inode = dentry->d_inode; error = permission(inode, MAY_EXEC); sys_chroot() error = permission(nd.dentry->d_inode,MAY_EXEC);