summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/filesystems/fuse/write_extend_eof_test.c
AgeCommit message (Collapse)Author
2026-08-24selftests/fuse: test post-EOF page zeroing when a file is extendedJimmy Zuber
Add a regression test for the bug where extending a file left the tail of the old partial EOF page exposing stale mmap-dirtied data instead of zeros. The test is a self-contained raw /dev/fuse server (no libfuse dependency) that runs without writeback_cache and returns FOPEN_KEEP_CACHE, the configuration in which the bug is visible. Its backing data is always zero in the hole, so any non-zero byte a read sees is stale page-cache data. All offsets are relative to the runtime page size. Four cases: - write_extend: pollute the post-EOF tail, extend past it by writing into a later page, and verify the tail reads back as zero; - ftruncate_extend: same, but extend via ftruncate(); - fallocate_extend: same, but extend via fallocate() at the old EOF; - extend_into_eof_page_preserves_data: an extending write landing inside the old EOF page must not be clobbered by the zeroing. Each case fails without the fix and passes with it. Signed-off-by: Jimmy Zuber <jamz@amazon.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>