linux/fs/exfat
Yuezhang Mo 28442546f2 exfat: zero out post-EOF page cache on file extension
[ Upstream commit 4e163c39dd ]

xfstests generic/363 was failing due to unzeroed post-EOF page
cache that allowed mmap writes beyond EOF to become visible
after file extension.

For example, in following xfs_io sequence, 0x22 should not be
written to the file but would become visible after the extension:

  xfs_io -f -t -c "pwrite -S 0x11 0 8" \
    -c "mmap 0 4096" \
    -c "mwrite -S 0x22 32 32" \
    -c "munmap" \
    -c "pwrite -S 0x33 512 32" \
    $testfile

This violates the expected behavior where writes beyond EOF via
mmap should not persist after the file is extended. Instead, the
extended region should contain zeros.

Fix this by using truncate_pagecache() to truncate the page cache
after the current EOF when extending the file.

Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-01-08 10:14:11 +01:00
..
balloc.c exfat: validate cluster allocation bits of the allocation bitmap 2025-11-13 15:34:31 -05:00
cache.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
dir.c exfat: add cluster chain loop check for dir 2025-08-20 18:30:47 +02:00
exfat_fs.h exfat: fix soft lockup in exfat_clear_bitmap 2025-03-13 13:02:08 +01:00
exfat_raw.h exfat: add ioctls for accessing attributes 2023-10-31 10:00:51 +09:00
fatent.c exfat: limit log print for IO error 2025-11-13 15:34:31 -05:00
file.c exfat: zero out post-EOF page cache on file extension 2026-01-08 10:14:11 +01:00
inode.c exfat: call bh_read in get_block only when necessary 2025-05-29 11:02:03 +02:00
Kconfig fs: add CONFIG_BUFFER_HEAD 2023-08-02 09:13:09 -06:00
Makefile exfat: add Kconfig and Makefile 2020-03-05 21:00:40 -05:00
misc.c exfat: convert to new timestamp accessors 2023-10-18 13:26:21 +02:00
namei.c exfat: fix improper check of dentry.stream.valid_size 2025-11-24 10:35:48 +01:00
nls.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
super.c exfat: fix remount failure in different process environments 2026-01-08 10:14:11 +01:00