• Shyam Prasad N's avatar
    cifs: Fix unix perm bits to cifsacl conversion for "other" bits. · 0f22053e
    Shyam Prasad N authored
    With the "cifsacl" mount option, the mode bits set on the file/dir
    is converted to corresponding ACEs in DACL. However, only the
    ALLOWED ACEs were being set for "owner" and "group" SIDs. Since
    owner is a subset of group, and group is a subset of
    everyone/world SID, in order to properly emulate unix perm groups,
    we need to add DENIED ACEs. If we don't do that, "owner" and "group"
    SIDs could get more access rights than they should. Which is what
    was happening. This fixes it.
    
    We try to keep the "preferred" order of ACEs, i.e. DENYs followed
    by ALLOWs. However, for a small subset of cases we cannot
    maintain the preferred order. In that case, we'll end up with the
    DENY ACE for group after the ALLOW for the owner.
    
    If owner SID == group SID, use the more restrictive
    among the two perm bits and convert them to ACEs.
    
    Also, for reverse mapping, i.e. to convert ACL to unix perm bits,
    for the "others" bits, we needed to add the masked bits of the
    owner and group masks to others mask.
    
    Updated version of patch fixes a problem noted by the kernel
    test robot.
    Reported-by: default avatarkernel test robot <lkp@intel.com>
    Signed-off-by: default avatarShyam Prasad N <sprasad@microsoft.com>
    Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
    0f22053e
cifsacl.c 39 KB