Re: Names vs. Inodes

From: Valdis.Kletnieksat_private
Date: Thu Jul 19 2001 - 15:54:52 PDT

  • Next message: Alexander Reelsen: "Re: [PATCH] capability_plug.c [was Re: Problems with 2.4.6-lsm on SMP]"

    On Thu, 19 Jul 2001 13:53:23 PDT, Chris Wright said:
    > hmm.  i tried this and open fails...ENOENT.
    
    OK. After actually having examined fs/namei.c, the actual creat() gets stopped
    by an IS_DEADDIR() check in may_create(), the S_DEAD flag having been
    set in vfs_rmdir().
    
    However, ENOENT is *not* the only possible failure mode here.  Fortunately
    for the LSM side of things, the other ways the test program can fail
    do so in a manner that leaves a pathname available.
    
    Interestingly enough, AIX 4.3.3 complains on the rmdir() with an EBUSY,
    and Solaris 8 and IRIX 6.5 complain on the rmdir() with an EINVAL.  The
    Linux 2.4.5 kernel lets it happen - but this appears to be file system
    specific, as the fun starts down in dir->i_op->rmdir(dir, dentry) as
    called by vfs_rmdir().  ext2 and reiserfs both let the rmdir() work.
    On a filesystem that fails the rmdir(), the creat() call will then succeed.
    
    Comments in fs/namei.c:
    
    /*
     * We try to drop the dentry early: we should have
     * a usage count of 2 if we're the only user of this
     * dentry, and if that is true (possibly after pruning
     * the dcache), then we drop the dentry now.
     *
     * A low-level filesystem can, if it choses, legally
     * do a
     *
     *      if (!d_unhashed(dentry))
     *              return -EBUSY;
     *
     * if it cannot handle the case of removing a directory
     * that is still in use by something else..
     */
    static void d_unhash(struct dentry *dentry)
    {
    
    There are some comments for vfs_rename_dir() that indicate that
    there's other places where opened-but-unlinked directories are
    problematic:
    
     *      d) some filesystems don't support opened-but-unlinked directories,
     *         either because of layout or because they are not ready to deal with
     *         all cases correctly. The latter will be fixed (taking this sort of
     *         stuff into VFS), but the former is not going away. Solution: the same
     *         trick as in rmdir().
    
    Just be glad we don't have any filesystems that support VMS-style versioning
    or IBM-style GDG's ;)
    -- 
    				Valdis Kletnieks
    				Operating Systems Analyst
    				Virginia Tech
    
    
    
    

    _______________________________________________ linux-security-module mailing list linux-security-moduleat_private http://mail.wirex.com/mailman/listinfo/linux-security-module



    This archive was generated by hypermail 2b30 : Thu Jul 19 2001 - 15:55:40 PDT