[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190610014329.GA3266@mit.edu>
Date: Sun, 9 Jun 2019 21:43:29 -0400
From: "Theodore Ts'o" <tytso@....edu>
To: "Darrick J. Wong" <darrick.wong@...cle.com>
Cc: linux-xfs@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-ext4@...r.kernel.org, linux-btrfs@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [PATCH 1/8] mm/fs: don't allow writes to immutable files
On Wed, Apr 17, 2019 at 12:04:33PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@...cle.com>
>
> The chattr manpage has this to say about immutable 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."
>
> Once the flag is set, it is enforced for quite a few file operations,
> such as fallocate, fpunch, fzero, rm, touch, open, etc. However, we
> don't check for immutability when doing a write(), a PROT_WRITE mmap(),
> a truncate(), or a write to a previously established mmap.
>
> If a program has an open write fd to a file that the administrator
> subsequently marks immutable, the program still can change the file
> contents. Weird!
>
> The ability to write to an immutable file does not follow the manpage
> promise that immutable files cannot be modified. Worse yet it's
> inconsistent with the behavior of other syscalls which don't allow
> modifications of immutable files.
>
> Therefore, add the necessary checks to make the write, mmap, and
> truncate behavior consistent with what the manpage says and consistent
> with other syscalls on filesystems which support IMMUTABLE.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@...cle.com>
Thanks, looks good. I'm going to take this patch through the ext4
tree since it doesn't have any dependencies on the rest of the patch
series.
- Ted
Powered by blists - more mailing lists