Fix ea-in-inode default ACL creation

From: Andreas Gruenbacher (agruen_at_suse.de)
Date: 01/20/05

  • Next message: John Richard Moser: "Re: thoughts on kernel security issues"
    To: Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>
    Date:	Thu, 20 Jan 2005 19:22:25 +0100
    
    

    Hello,

    here is another nastiness.

    When a new inode is created, ext3_new_inode sets the EXT3_STATE_NEW
    flag, which tells ext3_do_update_inode to zero out the inode before
    filling in the inode's data. When a file is created in a directory with
    a default acl, the new inode inherits the directory's default acl; this
    generates attributes. The attributes are created before
    ext3_do_update_inode is called to write out the inode. In case of
    in-inode attributes, the new inode's attributes are written, and then
    zeroed out again by ext3_do_update_inode. Bad thing.

    Fix this by recognizing the EXT3_STATE_NEW case in
    ext3_xattr_set_handle, and zeroing out the inode there already when
    necessary.

    Signed-off-by: Andreas Gruenbacher <agruen@suse.de>

    Index: linux-2.6.11-latest/fs/ext3/xattr.c
    ===================================================================
    --- linux-2.6.11-latest.orig/fs/ext3/xattr.c
    +++ linux-2.6.11-latest/fs/ext3/xattr.c
    @@ -954,6 +954,13 @@ ext3_xattr_set_handle(handle_t *handle,
             error = ext3_get_inode_loc(inode, &is.iloc);
             if (error)
                     goto cleanup;
    +
    + if (EXT3_I(inode)->i_state & EXT3_STATE_NEW) {
    + struct ext3_inode *raw_inode = ext3_raw_inode(&is.iloc);
    + memset(raw_inode, 0, EXT3_SB(inode->i_sb)->s_inode_size);
    + EXT3_I(inode)->i_state &= ~EXT3_STATE_NEW;
    + }
    +
             error = ext3_xattr_ibody_find(inode, &i, &is);
             if (error)
                     goto cleanup;

    -- 
    Andreas Gruenbacher <agruen@suse.de>
    SUSE Labs, SUSE LINUX GMBH
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: John Richard Moser: "Re: thoughts on kernel security issues"

    Relevant Pages

    • Re: UFS low-level details
      ... >> probably both imply some sort of shadow inodes referenced by the main ... >> inode of the file. ... Yes, that would presumably be the in-memory pointer for the ACL, as I ... suppose ic_shadow would be the on-disk number of the shadow ...
      (comp.unix.solaris)
    • Re: what is our answer to ZFS?
      ... is a "generation" counter for a particular inode. ... member in, the file generation number, is needed to uniquely ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: oops with dual xeon 2.8ghz 4gb ram +smp, software raid, lvm, and xfs
      ... The problem is that in the current XFS code the inode ... generation counter starts at 0, but higher level code uses that as ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [patch] stop inotify from sending random DELETE_SELF event under load
      ... See example upthread - we have two links to the same inode; ... This is obviously broken - even if we reinstate the watch (after figuring out ... for the lost events). ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [PATCH] Allow /dev/{,k}mem to be disabled to prevent kernel from being modified easily
      ... By default, nothing is changed, but I'd turn this feature on on servers ... static int memory_open(struct inode * inode, ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ ...
      (Linux-Kernel)