Skip to content

fs/ntfs3: fix log replay payload overreads

Giulia Aloia lkml ntfs3 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2fs/ntfs3: fix out-of-bounds read of redo/undo data during log replayfs/ntfs3/fslog.c+31 -00 replies
2/2fs/ntfs3: validate SetNewAttributeSizes payload lengthfs/ntfs3/fslog.c+3 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] fs/ntfs3: fix log replay payload overreads

This series fixes two journal replay paths that can read past crafted redo or undo payloads while mounting a dirty NTFS volume.

Patch 1 validates that redo and undo payload ranges stay within the log record before replay uses them, while preserving the compensation-log record undo exception used by Windows. It also validates the fixed-size OpenNonresidentAttribute redo entry and optional undo name before the analysis pass copies them.

Patch 2 validates the minimum payload length for SetNewAttributeSizes, which always reads alloc_size, valid_size and data_size but previously only checked whether the optional total_size field was present.

The two checks are complementary. Patch 1 makes sure the selected payload range is inside the log record when that range is expected to be present. Patch 2 makes sure that the selected range is large enough for the SetNewAttributeSizes operation that interprets it.

Both issues are reachable while mounting crafted images. Each patch contains the KASAN report observed before the fix. With these patches, the same images are rejected during mount without sanitizer reports.

Giulia Aloia (2):
fs/ntfs3: fix out-of-bounds read of redo/undo data during log replay fs/ntfs3: validate SetNewAttributeSizes payload length

 fs/ntfs3/fslog.c | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
Signature · 1 line
2.55.0