* [PATCH 0/2] fs/ntfs3: fix silent corruption reading compressed files
@ 2026-10-21 4:58 Senjin
0 siblings, 0 replies; only message in thread
From: Senjin @ 2026-10-21 4:58 UTC (permalink / raw)
To: Konstantin Komarov; +Cc: Senjin, ntfs3, linux-fsdevel
Reading WOF (LZX/XPRESS) compressed files on ntfs3 can silently return
wrong data: zeroes or garbage, no error from read(), nothing in dmesg.
The bad pages stay in the page cache until it is dropped.
It needs two bugs together:
1. ntfs_read_write_run() maps page 0 of the block device folio it gets
from read_mapping_folio(), which is wrong for large folios. Those
appear when userspace has read the block device (e.g. ntfs-3g tools),
so the compressed input comes from the wrong 4 KiB page and the
decompressor fails. The same helper is used for compressed writes.
2. ni_read_frame() marks the frame's pages uptodate even when it fails,
so the failure is turned into silently wrong data.
Found while copying a Windows drive whose files had been compacted with
"compact /exe:lzx". The data on disk is intact: decoding the
WofCompressedData streams independently with wimlib gives the right
contents, matching uncompressed copies of the same files.
Tested on 7.3 against 16,716 WOF-compressed files (LZX, 32K frames):
the reproducer in patch 1 fails for 1,051 files without the series and
for none with it. With only patch 2, the reproducer gets an error from
read() instead of wrong data.
The bug was introduced in 6.19, hence the stable tags. Both patches
apply to current master.
Senjin (2):
fs/ntfs3: map the right page of large folios in ntfs_read_write_run()
fs/ntfs3: don't mark pages uptodate when ni_read_frame() fails
fs/ntfs3/frecord.c | 12 ++++++++----
fs/ntfs3/fsntfs.c | 11 ++++++++---
2 files changed, 16 insertions(+), 7 deletions(-)
--
2.56.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-21 4:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-21 4:58 [PATCH 0/2] fs/ntfs3: fix silent corruption reading compressed files Senjin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox