linux/fs/exfat
Yuezhang Mo 967ac825b4 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-02 12:57:01 +01:00
..
balloc.c exfat: fix divide-by-zero in exfat_allocate_bitmap 2025-12-18 14:03:31 +01:00
cache.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
dir.c exfat: Add support for FS_IOC_{GET,SET}FSLABEL 2025-09-30 13:49:31 +09:00
exfat_fs.h exfat: fix out-of-bounds in exfat_nls_to_ucs2() 2025-10-15 17:53:20 +09:00
exfat_raw.h exfat: Add support for FS_IOC_{GET,SET}FSLABEL 2025-09-30 13:49:31 +09:00
fatent.c exfat: limit log print for IO error 2025-09-30 13:34:42 +09:00
file.c exfat: zero out post-EOF page cache on file extension 2026-01-02 12:57:01 +01:00
inode.c exfat: drop redundant conversion to bool 2025-09-30 13:34:43 +09: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 refcount leak in exfat_find 2025-12-18 14:03:31 +01:00
nls.c exfat: fix out-of-bounds in exfat_nls_to_ucs2() 2025-10-15 17:53:20 +09:00
super.c exfat: fix remount failure in different process environments 2026-01-02 12:57:01 +01:00