1. 02 3月, 2017 1 次提交
  2. 10 1月, 2017 1 次提交
  3. 28 9月, 2016 2 次提交
  4. 22 9月, 2016 1 次提交
  5. 16 9月, 2016 1 次提交
  6. 01 7月, 2016 1 次提交
  7. 25 6月, 2016 1 次提交
  8. 28 5月, 2016 1 次提交
  9. 11 4月, 2016 1 次提交
  10. 31 3月, 2016 2 次提交
    • A
      posix_acl: Unexport acl_by_type and make it static · 04c57f45
      Andreas Gruenbacher 提交于
      acl_by_type(inode, type) returns a pointer to either inode->i_acl or
      inode->i_default_acl depending on type.  This is useful in
      fs/posix_acl.c, but should never have been visible outside that file.
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      04c57f45
    • A
      posix_acl: Inode acl caching fixes · b8a7a3a6
      Andreas Gruenbacher 提交于
      When get_acl() is called for an inode whose ACL is not cached yet, the
      get_acl inode operation is called to fetch the ACL from the filesystem.
      The inode operation is responsible for updating the cached acl with
      set_cached_acl().  This is done without locking at the VFS level, so
      another task can call set_cached_acl() or forget_cached_acl() before the
      get_acl inode operation gets to calling set_cached_acl(), and then
      get_acl's call to set_cached_acl() results in caching an outdate ACL.
      
      Prevent this from happening by setting the cached ACL pointer to a
      task-specific sentinel value before calling the get_acl inode operation.
      Move the responsibility for updating the cached ACL from the get_acl
      inode operations to get_acl().  There, only set the cached ACL if the
      sentinel value hasn't changed.
      
      The sentinel values are chosen to have odd values.  Likewise, the value
      of ACL_NOT_CACHED is odd.  In contrast, ACL object pointers always have
      an even value (ACLs are aligned in memory).  This allows to distinguish
      uncached ACLs values from ACL objects.
      
      In addition, switch from guarding inode->i_acl and inode->i_default_acl
      upates by the inode->i_lock spinlock to using xchg() and cmpxchg().
      
      Filesystems that do not want ACLs returned from their get_acl inode
      operations to be cached must call forget_cached_acl() to prevent the VFS
      from doing so.
      
      (Patch written by Al Viro and Andreas Gruenbacher.)
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      b8a7a3a6
  11. 14 12月, 2015 1 次提交
  12. 07 12月, 2015 2 次提交
  13. 14 11月, 2015 3 次提交
  14. 24 6月, 2015 1 次提交
    • D
      fs/posix_acl.c: make posix_acl_create() safer and cleaner · c0c3a718
      Dan Carpenter 提交于
      If posix_acl_create() returns an error code then "*acl" and "*default_acl"
      can be uninitialized or point to freed memory.  This is a dangerous thing
      to do.  For example, it causes a problem in ocfs2_reflink():
      
      	fs/ocfs2/refcounttree.c:4327 ocfs2_reflink()
      	error: potentially using uninitialized 'default_acl'.
      
      I've re-written this so we set the pointers to NULL at the start.  I've
      added a temporary "clone" variable to hold the value of "*acl" until end.
      Setting them to NULL means means we don't need the "no_acl" label.  We may
      as well remove the "apply_umask" stuff forward and remove that label as
      well.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      c0c3a718
  15. 16 4月, 2015 1 次提交
  16. 23 2月, 2015 1 次提交
    • D
      VFS: (Scripted) Convert S_ISLNK/DIR/REG(dentry->d_inode) to d_is_*(dentry) · e36cb0b8
      David Howells 提交于
      Convert the following where appropriate:
      
       (1) S_ISLNK(dentry->d_inode) to d_is_symlink(dentry).
      
       (2) S_ISREG(dentry->d_inode) to d_is_reg(dentry).
      
       (3) S_ISDIR(dentry->d_inode) to d_is_dir(dentry).  This is actually more
           complicated than it appears as some calls should be converted to
           d_can_lookup() instead.  The difference is whether the directory in
           question is a real dir with a ->lookup op or whether it's a fake dir with
           a ->d_automount op.
      
      In some circumstances, we can subsume checks for dentry->d_inode not being
      NULL into this, provided we the code isn't in a filesystem that expects
      d_inode to be NULL if the dirent really *is* negative (ie. if we're going to
      use d_inode() rather than d_backing_inode() to get the inode pointer).
      
      Note that the dentry type field may be set to something other than
      DCACHE_MISS_TYPE when d_inode is NULL in the case of unionmount, where the VFS
      manages the fall-through from a negative dentry to a lower layer.  In such a
      case, the dentry type of the negative union dentry is set to the same as the
      type of the lower dentry.
      
      However, if you know d_inode is not NULL at the call site, then you can use
      the d_is_xxx() functions even in a filesystem.
      
      There is one further complication: a 0,0 chardev dentry may be labelled
      DCACHE_WHITEOUT_TYPE rather than DCACHE_SPECIAL_TYPE.  Strictly, this was
      intended for special directory entry types that don't have attached inodes.
      
      The following perl+coccinelle script was used:
      
      use strict;
      
      my @callers;
      open($fd, 'git grep -l \'S_IS[A-Z].*->d_inode\' |') ||
          die "Can't grep for S_ISDIR and co. callers";
      @callers = <$fd>;
      close($fd);
      unless (@callers) {
          print "No matches\n";
          exit(0);
      }
      
      my @cocci = (
          '@@',
          'expression E;',
          '@@',
          '',
          '- S_ISLNK(E->d_inode->i_mode)',
          '+ d_is_symlink(E)',
          '',
          '@@',
          'expression E;',
          '@@',
          '',
          '- S_ISDIR(E->d_inode->i_mode)',
          '+ d_is_dir(E)',
          '',
          '@@',
          'expression E;',
          '@@',
          '',
          '- S_ISREG(E->d_inode->i_mode)',
          '+ d_is_reg(E)' );
      
      my $coccifile = "tmp.sp.cocci";
      open($fd, ">$coccifile") || die $coccifile;
      print($fd "$_\n") || die $coccifile foreach (@cocci);
      close($fd);
      
      foreach my $file (@callers) {
          chomp $file;
          print "Processing ", $file, "\n";
          system("spatch", "--sp-file", $coccifile, $file, "--in-place", "--no-show-diff") == 0 ||
      	die "spatch failed";
      }
      
      [AV: overlayfs parts skipped]
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      e36cb0b8
  17. 20 2月, 2015 1 次提交
  18. 07 5月, 2014 1 次提交
    • C
      posix_acl: handle NULL ACL in posix_acl_equiv_mode · 50c6e282
      Christoph Hellwig 提交于
      Various filesystems don't bother checking for a NULL ACL in
      posix_acl_equiv_mode, and thus can dereference a NULL pointer when it
      gets passed one. This usually happens from the NFS server, as the ACL tools
      never pass a NULL ACL, but instead of one representing the mode bits.
      
      Instead of adding boilerplat to all filesystems put this check into one place,
      which will allow us to remove the check from other filesystems as well later
      on.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reported-by: NBen Greear <greearb@candelatech.com>
      Reported-by: Marco Munderloh <munderl@tnt.uni-hannover.de>,
      Cc: Chuck Lever <chuck.lever@oracle.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      50c6e282
  19. 25 2月, 2014 1 次提交
  20. 04 2月, 2014 1 次提交
  21. 26 1月, 2014 6 次提交
  22. 24 1月, 2014 1 次提交
    • A
      userns: relax the posix_acl_valid() checks · 949b9c3d
      Andreas Gruenbacher 提交于
      So far, POSIX ACLs are using a canonical representation that keeps all ACL
      entries in a strict order; the ACL_USER and ACL_GROUP entries for specific
      users and groups are ordered by user and group identifier, respectively.
      The user-space code provides ACL entries in this order; the kernel
      verifies that the ACL entry order is correct in posix_acl_valid().
      
      User namespaces allow to arbitrary map user and group identifiers which
      can cause the ACL_USER and ACL_GROUP entry order to differ between user
      space and the kernel; posix_acl_valid() would then fail.
      
      Work around this by allowing ACL_USER and ACL_GROUP entries to be in any
      order in the kernel.  The effect is only minor: file permission checks
      will pick the first matching ACL_USER entry, and check all matching
      ACL_GROUP entries.
      
      (The libacl user-space library and getfacl / setfacl tools will not create
      ACLs with duplicate user or group idenfifiers; they will handle ACLs with
      entries in an arbitrary order correctly.)
      Signed-off-by: NAndreas Gruenbacher <agruen@linbit.com>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Theodore Tso <tytso@mit.edu>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Andreas Dilger <adilger.kernel@dilger.ca>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      949b9c3d
  23. 22 1月, 2014 1 次提交
  24. 18 9月, 2012 1 次提交
    • E
      userns: Convert vfs posix_acl support to use kuids and kgids · 2f6f0654
      Eric W. Biederman 提交于
      - In setxattr if we are setting a posix acl convert uids and gids from
        the current user namespace into the initial user namespace, before
        the xattrs are passed to the underlying filesystem.
      
        Untranslatable uids and gids are represented as -1 which
        posix_acl_from_xattr will represent as INVALID_UID or INVALID_GID.
        posix_acl_valid will fail if an acl from userspace has any
        INVALID_UID or INVALID_GID values.  In net this guarantees that
        untranslatable posix acls will not be stored by filesystems.
      
      - In getxattr if we are reading a posix acl convert uids and gids from
        the initial user namespace into the current user namespace.
      
        Uids and gids that can not be tranlsated into the current user namespace
        will be represented as -1.
      
      - Replace e_id in struct posix_acl_entry with an anymouns union of
        e_uid and e_gid.  For the short term retain the e_id field
        until all of the users are converted.
      
      - Don't set struct posix_acl.e_id in the cases where the acl type
        does not use e_id.  Greatly reducing the use of ACL_UNDEFINED_ID.
      
      - Rework the ordering checks in posix_acl_valid so that I use kuid_t
        and kgid_t types throughout the code, and so that I don't need
        arithmetic on uid and gid types.
      
      Cc: Theodore Tso <tytso@mit.edu>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andreas Dilger <adilger.kernel@dilger.ca>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      2f6f0654
  25. 29 2月, 2012 1 次提交
  26. 28 10月, 2011 1 次提交
  27. 01 8月, 2011 4 次提交