Re: 2.6.7-rc2: open() hangs on ReiserFS with SELinux enabled

From: Dmitry Baryshkov
Date: Fri Jun 04 2004 - 07:02:58 EST


Hello,
On Thu, Jun 03, 2004 at 03:46:31PM -0400, Stephen Smalley wrote:
> On Thu, 2004-06-03 at 10:09, Stephen Smalley wrote:
>
> Actually, that last part may be a red herring, since reiserfs_write_lock
> is simply a macro for lock_kernel. The more immediate concern is
> avoiding the inode->i_op->getxattr call from SELinux on the xattr
> directory inode. reiserfs xattr code would need to call a new security
> hook to mark the xattr root directory inode in some manner, so that
> subsequent security_d_instantiate calls on the per-object subdirectories
> could be identified by SELinux, and it could then just set the SID on
> the incore inode to a well-defined value and not call
> inode->i_op->getxattr for those inodes.

Here is a patch, based on discussion with Stephen Smalley, that fixes
the problem for me. As private files don't have xattrs,
reiserfs_getxattr should return early for them, thus not trying to lock anything.
--
With best wishes
Dmitry Baryshkov

diff -pur linux-2.6.7-rc2-orig/fs/reiserfs/xattr.c linux-2.6.7-rc2/fs/reiserfs/xattr.c
--- linux-2.6.7-rc2-orig/fs/reiserfs/xattr.c 2004-06-04 00:22:25.000000000 +0400
+++ linux-2.6.7-rc2/fs/reiserfs/xattr.c 2004-06-04 10:13:00.000000000 +0400
@@ -944,6 +944,16 @@ reiserfs_getxattr (struct dentry *dentry
{
struct reiserfs_xattr_handler *xah = find_xattr_handler_prefix (name);
int err;
+ struct dentry *dpar;
+
+ dpar = dget_parent(dentry);
+ if (is_reiserfs_priv_object (dentry->d_inode) ||
+ (dpar && is_reiserfs_priv_object (dpar->d_inode)))
+ {
+ dput(dpar);
+ return -ENODATA;
+ }
+ dput(dpar);

if (!xah || !reiserfs_xattrs(dentry->d_sb) ||
get_inode_sd_version (dentry->d_inode) == STAT_DATA_V1)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/