fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Fix a minor POSIX conformance problem
@ 2023-02-02 20:44 Matthew Wilcox (Oracle)
  2023-02-02 20:44 ` [PATCH 1/5] truncate: Zero bytes after 'oldsize' if we're expanding the file Matthew Wilcox (Oracle)
                   ` (7 more replies)
  0 siblings, 8 replies; 20+ messages in thread
From: Matthew Wilcox (Oracle) @ 2023-02-02 20:44 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Matthew Wilcox (Oracle),
	linux-afs, linux-btrfs, linux-ext4, linux-mm, Hugh Dickins,
	linux-kernel, fstests

POSIX requires that on ftruncate() expansion, the new bytes must read
as zeroes.  If someone's mmap()ed the file and stored past EOF, for
most filesystems the bytes in that page will be not-zero.  It's a
pretty minor violation; someone could race you and write to the file
between the ftruncate() call and you reading from it, but it's a bit
of a QOI violation.  

I've tested xfs (passes before & after), ext4 and tmpfs (both fail
before, pass after).  Testing from other FS developers appreciated.
fstest to follow; not sure how to persuade git-send-email to work on
multiple repositories

Matthew Wilcox (Oracle) (5):
  truncate: Zero bytes after 'oldsize' if we're expanding the file
  ext4: Zero bytes after 'oldsize' if we're expanding the file
  tmpfs: Zero bytes after 'oldsize' if we're expanding the file
  afs: Zero bytes after 'oldsize' if we're expanding the file
  btrfs: Zero bytes after 'oldsize' if we're expanding the file

 fs/afs/inode.c   | 2 ++
 fs/btrfs/inode.c | 1 +
 fs/ext4/inode.c  | 1 +
 mm/shmem.c       | 2 ++
 mm/truncate.c    | 7 +++++--
 5 files changed, 11 insertions(+), 2 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2023-02-27 14:50 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-02 20:44 [PATCH 0/5] Fix a minor POSIX conformance problem Matthew Wilcox (Oracle)
2023-02-02 20:44 ` [PATCH 1/5] truncate: Zero bytes after 'oldsize' if we're expanding the file Matthew Wilcox (Oracle)
2023-02-03 13:00   ` Brian Foster
2023-02-03 15:07     ` Matthew Wilcox
2023-02-02 20:44 ` [PATCH 2/5] ext4: " Matthew Wilcox (Oracle)
2023-02-02 20:44 ` [PATCH 3/5] tmpfs: " Matthew Wilcox (Oracle)
2023-02-02 20:44 ` [PATCH 4/5] afs: " Matthew Wilcox (Oracle)
2023-02-02 20:44 ` [PATCH 5/5] btrfs: " Matthew Wilcox (Oracle)
2023-02-02 20:44 ` [PATCH 6/5] generic: test ftruncate zeroes bytes after EOF Matthew Wilcox (Oracle)
2023-02-03 11:57   ` Johannes Thumshirn
2023-02-03 13:13     ` Matthew Wilcox
2023-02-03 16:35   ` Darrick J. Wong
2023-02-02 23:08 ` [PATCH 0/5] Fix a minor POSIX conformance problem Andreas Dilger
2023-02-03 13:21   ` Matthew Wilcox
2023-02-03 16:23     ` David Laight
2023-02-03 16:29       ` Matthew Wilcox
2023-02-27 13:49 ` [PATCH 4/5] afs: Zero bytes after 'oldsize' if we're expanding the file David Howells
2023-02-27 14:09   ` Matthew Wilcox
2023-02-27 14:20   ` David Howells
2023-02-27 14:49   ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).