Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Richacl #109

Closed
wants to merge 27 commits into from
Closed

Richacl #109

wants to merge 27 commits into from

Commits on Oct 23, 2011

  1. vfs: Indicate that the permission functions take all the MAY_* flags

    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    d5d1fb4 View commit details
    Browse the repository at this point in the history
  2. vfs: Add hex format for MAY_* flag values

    We are going to add more flags and having them in hex format
    make it simpler
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    0f69c40 View commit details
    Browse the repository at this point in the history
  3. vfs: Pass all mask flags down to iop->check_acl

    Some file permission models differentiate between writing to a file
    (MAY_WRITE) and appending to it (MAY_WRITE | MAY_APPEND).  Pass all the
    mask flags down to iop->check_acl so that filesystems can distinguish
    between writing and appending.
    
    All users of iop->check_acl pass the mask value back into
    posix_acl_permission(); strip off the additional mask flags there.
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    bf56180 View commit details
    Browse the repository at this point in the history
  4. vfs: Add a comment to inode_permission()

    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    518cbba View commit details
    Browse the repository at this point in the history
  5. vfs: Add generic IS_ACL() test for acl support

    When IS_POSIXACL() is true, the vfs does not apply the umask.  Other acl
    models will need the same exception, so introduce a separate IS_ACL()
    test.
    
    The IS_POSIX_ACL() test is still needed so that nfsd can determine when
    the underlying file system supports POSIX ACLs (as opposed to some other
    kind).
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    89e1033 View commit details
    Browse the repository at this point in the history
  6. vfs: Add IS_RICHACL() test for richacl support

    Introduce a new MS_RICHACL super-block flag and a new IS_RICHACL() test
    which file systems like nfs can use.  IS_ACL() is true if IS_POSIXACL()
    or IS_RICHACL() is true.
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    45481f1 View commit details
    Browse the repository at this point in the history
  7. vfs: Optimize out IS_RICHACL() if CONFIG_FS_RICHACL is not defined

    if CONFIG_FS_RICHACL is not defined optimize out
    the ACL check function.
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    c684918 View commit details
    Browse the repository at this point in the history
  8. vfs: Add new file and directory create permission flags

    Some permission models distinguish between the permission to create a
    non-directory and a directory.  Pass this information down to
    inode_permission() as mask flags
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    004723e View commit details
    Browse the repository at this point in the history
  9. vfs: Add delete child and delete self permission flags

    Normally, deleting a file requires write access to the parent directory.
    Some permission models use a different permission on the parent
    directory to indicate delete access.  In addition, a process can have
    per-file delete access even without delete access on the parent
    directory.
    
    Introduce two new inode_permission() mask flags and use them in
    may_delete()
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    1654a09 View commit details
    Browse the repository at this point in the history
  10. vfs: Make the inode passed to inode_change_ok non-const

    We will need to call iop->permission and iop->get_acl from
    inode_change_ok() for additional permission checks, and both take a
    non-const inode.
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    3437a82 View commit details
    Browse the repository at this point in the history
  11. vfs: Add permission flags for setting file attributes

    Some permission models can allow processes to take ownership of a file,
    change the file permissions, and set the file timestamps.  Introduce new
    permission mask flags and check for those permissions in
    inode_change_ok().
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    e963a4c View commit details
    Browse the repository at this point in the history
  12. vfs: Make acl_permission_check() work for richacls

    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    26dc449 View commit details
    Browse the repository at this point in the history
  13. richacl: In-memory representation and helper functions

    A richacl consists of an NFSv4 acl and an owner, group, and other mask.
    These three masks correspond to the owner, group, and other file
    permission bits, but they contain NFSv4 permissions instead of POSIX
    permissions.
    
    Each entry in the NFSv4 acl applies to the file owner (OWNER@), the
    owning group (GROUP@), literally everyone (EVERYONE@), or to a specific
    uid or gid.
    
    As in the standard POSIX file permission model, each process is the
    owner, group, or other file class.  A richacl grants a requested access
    only if the NFSv4 acl in the richacl grants the access (according to the
    NFSv4 permission check algorithm), and the file mask that applies to the
    process includes the requested permissions.
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    e210ab8 View commit details
    Browse the repository at this point in the history
  14. richacl: Permission mapping functions

    We need to map from POSIX permissions to NFSv4 permissions when a
    chmod() is done, from NFSv4 permissions to POSIX permissions when an acl
    is set (which implicitly sets the file permission bits), and from the
    MAY_READ/MAY_WRITE/MAY_EXEC/MAY_APPEND flags to NFSv4 permissions when
    doing an access check in a richacl.
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    36ee026 View commit details
    Browse the repository at this point in the history
  15. richacl: Compute maximum file masks from an acl

    Compute upper bound owner, group, and other file masks with as few
    permissions as possible without denying any permissions that the NFSv4
    acl in a richacl grants.
    
    This algorithm is used when a file inherits an acl at create time and
    when an acl is set via a mechanism that does not specify file modes
    (such as via nfsd).  When user-space sets an acl, the file masks are
    passed in as part of the xattr.
    
    When setting a richacl, the file masks determine what the file
    permission bits will be set to; see richacl_masks_to_mode().
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    dc240c0 View commit details
    Browse the repository at this point in the history
  16. richacl: Update the file masks in chmod()

    Doing a chmod() sets the file mode, which includes the file permission
    bits.  When a file has a richacl, the permissions that the richacl
    grants need to be limited to what the new file permission bits allow.
    
    This is done by setting the file masks in the richacl to what the file
    permission bits map to.  The richacl access check algorithm takes the
    file masks into account, which ensures that the richacl cannot grant too
    many permissions.
    
    It is possible to explicitly add permissions to the file masks which go
    beyond what the file permission bits can grant (like the ACE4_WRITE_ACL
    permission).  The POSIX.1 standard calls this an alternate file access
    control mechanism.  A subsequent chmod() would ensure that those
    permissions are disabled again.
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    6be646b View commit details
    Browse the repository at this point in the history
  17. richacl: Permission check algorithm

    As in the standard POSIX file permission model, each process is the
    owner, group, or other file class.  A process is
    
      - in the owner file class if it owns the file,
      - in the group file class if it is in the file's owning group or it
        matches any of the user or group entries, and
      - in the other file class otherwise.
    
    Each file class is associated with a file mask.
    
    A richacl grants a requested access if the NFSv4 acl in the richacl
    grants the requested permissions (according to the NFSv4 permission
    check algorithm) and the file mask that applies to the process includes
    the requested permissions.
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    61bf134 View commit details
    Browse the repository at this point in the history
  18. richacl: Create-time inheritance

    When a new file is created, it can inherit an acl from its parent
    directory; this is similar to how default acls work in POSIX (draft)
    ACLs.
    
    As with POSIX ACLs, if a file inherits an acl from its parent directory,
    the intersection between the create mode and the permissions granted by
    the inherited acl determines the file masks and file permission bits,
    and the umask is ignored.
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    9d9bef3 View commit details
    Browse the repository at this point in the history
  19. richacl: Check if an acl is equivalent to a file mode

    This function is used to avoid storing richacls on disk if the acl can
    be computed from the file permission bits.
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    8013f16 View commit details
    Browse the repository at this point in the history
  20. richacl: Automatic Inheritance

    Automatic Inheritance (AI) allows changes to the acl of a directory to
    recursively propagate down to files and directories in the directory.
    
    To implement this, the kernel keeps track of which permissions have been
    inherited, and makes sure that permission propagation is turned off when
    the file permission bits of a file are changed (upon create or chmod).
    
    The actual permission propagation is implemented in user space.
    
    AI works as follows:
    
     - When the ACL4_AUTO_INHERIT flag in the acl of a file is cleared, the
       file is not affected by AI.
    
     - When the ACL4_AUTO_INHERIT flag in the acl of a directory is set and
       a file or subdirectory is created in that directory, files created in
       the directory will have the ACL4_AUTO_INHERIT flag set, and all
       inherited aces will have the ACE4_INHERITED_ACE flag set.  This
       allows user space to distinguish between aces which have been
       inherited, and aces which have been explicitly added.
    
     - When the ACL4_PROTECTED acl flag in the acl of a file is set, AI will
       not modify the acl of the file.  This does not affect propagation of
       permissions from the file to its children (if the file is a
       directory).
    
    Linux does not have a way of creating files without setting the file
    permission bits, so all files created inside a directory with
    ACL4_AUTO_INHERIT set will also have the ACL4_PROTECTED flag set.  This
    effectively disables AI.
    
    Protocols which support creating files without specifying permissions
    can explicitly clear the ACL4_PROTECTED flag after creating a file (and
    reset the file masks to "undo" applying the create mode; see
    richacl_compute_max_masks()).  This is a workaround; a per-create or
    per-process flag indicating to ignore the create mode when AI is in
    effect would fix this problem.
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    5882a81 View commit details
    Browse the repository at this point in the history
  21. richacl: xattr mapping functions

    Map between "system.richacl" xattrs and the in-kernel representation.
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    862d861 View commit details
    Browse the repository at this point in the history
  22. vfs: Cache richacl in struct inode

    Cache richacls in struct inode so that this doesn't have to be done
    individually in each filesystem.
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Andreas Gruenbacher authored and kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    69d9df5 View commit details
    Browse the repository at this point in the history
  23. vfs: Add richacl permission check

    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    e86e410 View commit details
    Browse the repository at this point in the history
  24. ext4: Use IS_POSIXACL() to check for POSIX ACL support

    Use IS_POSIXACL() instead of a file system specific mount flag since we
    have IS_POSIXACL() in the vfs already, anyway.
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    434e398 View commit details
    Browse the repository at this point in the history
  25. ext4: Implement rich acl for ext4

    Support the richacl permission model in ext4.  The richacls are stored
    in "system.richacl" xattrs.This need to be enabled by tune2fs or during
    mkfs.ext4
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    Signed-off-by: Andreas Gruenbacher <[email protected]>
    kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    69b47fd View commit details
    Browse the repository at this point in the history
  26. ext4: Add Ext4 compat richacl feature flag

    This feature flag can be used to enable richacl on
    the file system. Once enabled the "acl" mount option
    will enable richacl instead of posix acl
    
    Acked-by: J. Bruce Fields <[email protected]>
    Acked-by: David Howells <[email protected]>
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    kvaneesh committed Oct 23, 2011
    Configuration menu
    Copy the full SHA
    e17ad31 View commit details
    Browse the repository at this point in the history

Commits on Feb 12, 2012

  1. ext4: Add temporary richacl mount option for ext4

    This helps in easy testing of the patchset. The mount
    option will be later removed in favour of a feature flag.
    
    ***Should be folded before merging***
    
    Signed-off-by: Aneesh Kumar K.V <[email protected]>
    kvaneesh committed Feb 12, 2012
    Configuration menu
    Copy the full SHA
    13fc237 View commit details
    Browse the repository at this point in the history