summaryrefslogtreecommitdiff
tag nameimmutable-files_2019-04-15 (a305c5f095232736eb4fee9dcd5d9d3c5538c718)
tag date2019-04-15 17:03:38 -0700
tagged byDarrick J. Wong <darrick.wong@oracle.com>
tagged objectcommit d930a6b467...
vfs: make immutable files actually immutable
The chattr(1) manpage has this to say about the immutable bit that system administrators can set on files: "A file with the 'i' attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file, most of the file's metadata can not be modified, and the file can not be opened in write mode." Given the clause about how the file 'cannot be modified', it is surprising that programs holding writable file descriptors can continue to write to and truncate files after the immutable flag has been set, but they cannot call other things such as utimes, fallocate, unlink, link, setxattr, or reflink. Since the immutable flag is only settable by administrators, resolve this inconsistent behavior in favor of the documented behavior -- once the flag is set, the file cannot be modified, period.