Re: [PATCH v4 6/6] ntfs: validate resident index root values on lookup
From: Namjae Jeon
Date: Mon Jun 01 2026 - 00:37:55 EST
On Sat, May 30, 2026 at 11:35 PM DaeMyung Kang <charsyam@xxxxxxxxx> wrote:
>
> Resident $INDEX_ROOT values carry index header fields that callers
> consume after lookup. Some callers already validate parts of the layout
> before walking entries, but those checks are scattered and do not cover
> all root header invariants, such as entries_offset alignment and lower
> bound, index_length, and allocated_size consistency.
>
> Now that ntfs_ir_truncate() updates index.allocated_size before
> shrinking the resident value, lookup-time validation can cover these
> header invariants without tripping over the driver shrink path.
>
> Add $INDEX_ROOT to the minimum resident value size table and validate the
> resident index header fields before returning the attribute from lookup.
> Require 8-byte aligned index header fields, a sane entries_offset, an
> index_length within allocated_size, allocated_size within the resident
> value, and enough entry space for at least an index entry header.
>
> Signed-off-by: DaeMyung Kang <charsyam@xxxxxxxxx>
When this patch is applied, the generic/013 test fails randomly. The
failure can be reproduced by running xfstests generic/013 multiple
times. Additionally, ntfsprogs-plus must be installed to run fsck
checks.
Thanks.