[PATCH 0/2] fs/ntfs3: accept later attribute segments written by ntfs-3g and ntfs
From: Ernest Borowski via B4 Relay
Date: Fri Dec 04 2026 - 16:31:39 EST
mi_enum_attr() checks every attribute segment on its own, but two of its
checks assume that a later segment (svcn != 0) carries the same flags and
compression unit as the first one, or none at all. Files written by
ntfs-3g and by the ntfs driver do not always match that, and ntfs3 marks
them bad although ntfs-3g, ntfs and ntfsck read and check them fine:
- a sparse file whose later segments were created before it became
sparse keeps those segments flagged as normal, and their vcns may lie
past the end of the volume (patch 1, a regression in v7.3);
- ntfs-3g stores the compression unit in every segment of a compressed
file (patch 2).
Both are reproduced on a fragmented 64 MiB volume with 512-byte clusters
in QEMU. With the series applied, ntfs3 reads all test files with the
expected contents, the sanitizers stay quiet and the remaining checks
still bound every segment.
Zhan Xusheng's "fs/ntfs3: accept $Bad covering the last partial
cluster" [1] relaxes the same evcn check for the first segment of
$BadClus:$Bad. The two accept different cases, but they edit the same
comment and lines, so whichever is applied second needs a small manual
merge.
Joas Antonio dos Santos's "ntfs3: reject on-disk c_unit values that
cause shift overflow" [2] adds a bound on c_unit two lines above the
check that patch 2 changes. The two do not conflict in meaning, but the
one applied second needs its context adjusted.
The series is based on the master branch of the ntfs3 tree,
https://github.com/Paragon-Software-Group/linux-ntfs3.git (6ad211033e3e).
[1] https://lore.kernel.org/all/20261119070319.3803611-1-zhanxusheng1024@xxxxxxxxx/
[2] https://lore.kernel.org/all/20261108-ntfs3-cunit-fix-v1-1-fb8d02b3f8a2@xxxxxxxxx/
---
Ernest Borowski (2):
fs/ntfs3: do not bound the vcns of later attribute segments by the volume
fs/ntfs3: do not require compression unit 0 in later attribute segments
fs/ntfs3/record.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
---
base-commit: 6ad211033e3e31dbbc8c6c1b8a0949adc7ddf2e9
change-id: 20261121-b4-ntfs3-extent-checks-c2825b793a6b
Best regards,
--
Ernest Borowski <ernest.borowski.git@xxxxxxxxx>