• Jeff Layton's avatar
    VFS: make notify_change pass ATTR_KILL_S*ID to setattr operations · 6de0ec00
    Jeff Layton authored
    When an unprivileged process attempts to modify a file that has the setuid or
    setgid bits set, the VFS will attempt to clear these bits.  The VFS will set
    the ATTR_KILL_SUID or ATTR_KILL_SGID bits in the ia_valid mask, and then call
    notify_change to clear these bits and set the mode accordingly.
    
    With a networked filesystem (NFS and CIFS in particular but likely others),
    the client machine or process may not have credentials that allow for setting
    the mode.  In some situations, this can lead to file corruption, an operation
    failing outright because the setattr fails, or to races that lead to a mode
    change being reverted.
    
    In this situation, we'd like to just leave the handling of this to the server
    and ignore these bits.  The problem is that by the time the setattr op is
    called, the VFS has already reinterpreted the ATTR_KILL_* bits into a mode
    change.  The setattr operation has no way to know its intent.
    
    The following patch fixes this by ...
    6de0ec00
attr.c 4.67 KB