[PATCH v6 0/4] ntfs: finish resident attribute lookup validation

DaeMyung Kang posted 4 patches 2 weeks, 4 days ago
fs/ntfs/attrib.c | 49 +++++++++++++++++++++++-
fs/ntfs/index.c  | 96 +++++++++++++++++++++++++++++++-----------------
2 files changed, 111 insertions(+), 34 deletions(-)
[PATCH v6 0/4] ntfs: finish resident attribute lookup validation
Posted by DaeMyung Kang 2 weeks, 4 days ago
Hi,

this is v6 of the remaining NTFS resident attribute lookup validation
fixes, rebased onto the current ntfs-next branch from git.kernel.org.

v5 was generated against the temporary linux-ntfs ntfs-next test branch,
where the earlier lookup validation patches and the initial resident
$INDEX_ROOT validator were already present. That made the final
allocated_size-only patch depend on context that is not present in the
official ntfs-next branch.

This version is generated on top of:

  git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/ntfs.git
  branch ntfs-next
  base: <b3f6cd1d54aa>

The current official ntfs-next branch already contains the earlier shared
attribute-value validator, the volume-name error handling fix, the volume
information search-context reinit fix, and the resident $VOLUME_NAME
validator. This resend therefore contains only the remaining official-base
delta:

- reject non-resident records for all resident-only attribute types;
- fix the $INDEX_ROOT grow and shrink ordering so header capacity never
  exceeds the resident value visible to lookup-time validation;
- add the full resident $INDEX_ROOT lookup validator, including
  allocated_size checks.

Changes since v5:
- Rebased onto the official git.kernel.org ntfs-next branch instead of
  the temporary out-of-tree test branch, so the series no longer depends
  on patches that only existed there.
- Patch 4 is now a complete resident $INDEX_ROOT validator. In v5 it was
  an incremental allocated_size-only change on top of the out-of-tree
  validator; the resulting validator function is unchanged, but it now
  stands on its own against ntfs-next.
- No functional changes to the other three patches.

Testing:
- Applied this 4-patch series on top of the ntfs-next base above with
  git am; git diff --check is clean and scripts/checkpatch.pl --strict
  passes on all four patches.
- Built a KASAN kernel (CONFIG_KASAN=y, CONFIG_NTFS_FS=y) and ran it
  under QEMU against fresh 512 MiB NTFS images: mounted each read-write,
  created 12 directories and 2160 files, then renamed, removed, cleaned
  up and unmounted. Repeated three times; no KASAN report, oops or
  panic, and ntfsfix -n reported each image clean after every run.

DaeMyung Kang (4):
  ntfs: reject non-resident records for resident-only attributes
  ntfs: grow index root value before reparent header update
  ntfs: update index root allocated size before shrink
  ntfs: validate resident index root values on lookup

 fs/ntfs/attrib.c | 49 +++++++++++++++++++++++-
 fs/ntfs/index.c  | 96 +++++++++++++++++++++++++++++++-----------------
 2 files changed, 111 insertions(+), 34 deletions(-)


base-commit: b3f6cd1d54aa279cc4f47aa27939ebe517a2c390
-- 
2.43.0
Re: [PATCH v6 0/4] ntfs: finish resident attribute lookup validation
Posted by Namjae Jeon 2 weeks, 4 days ago
On Tue, Jun 9, 2026 at 12:49 AM DaeMyung Kang <charsyam@gmail.com> wrote:
>
> Hi,
>
> this is v6 of the remaining NTFS resident attribute lookup validation
> fixes, rebased onto the current ntfs-next branch from git.kernel.org.
>
> v5 was generated against the temporary linux-ntfs ntfs-next test branch,
> where the earlier lookup validation patches and the initial resident
> $INDEX_ROOT validator were already present. That made the final
> allocated_size-only patch depend on context that is not present in the
> official ntfs-next branch.
>
> This version is generated on top of:
>
>   git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/ntfs.git
>   branch ntfs-next
>   base: <b3f6cd1d54aa>
>
> The current official ntfs-next branch already contains the earlier shared
> attribute-value validator, the volume-name error handling fix, the volume
> information search-context reinit fix, and the resident $VOLUME_NAME
> validator. This resend therefore contains only the remaining official-base
> delta:
>
> - reject non-resident records for all resident-only attribute types;
> - fix the $INDEX_ROOT grow and shrink ordering so header capacity never
>   exceeds the resident value visible to lookup-time validation;
> - add the full resident $INDEX_ROOT lookup validator, including
>   allocated_size checks.
>
> Changes since v5:
> - Rebased onto the official git.kernel.org ntfs-next branch instead of
>   the temporary out-of-tree test branch, so the series no longer depends
>   on patches that only existed there.
> - Patch 4 is now a complete resident $INDEX_ROOT validator. In v5 it was
>   an incremental allocated_size-only change on top of the out-of-tree
>   validator; the resulting validator function is unchanged, but it now
>   stands on its own against ntfs-next.
> - No functional changes to the other three patches.
>
> Testing:
> - Applied this 4-patch series on top of the ntfs-next base above with
>   git am; git diff --check is clean and scripts/checkpatch.pl --strict
>   passes on all four patches.
> - Built a KASAN kernel (CONFIG_KASAN=y, CONFIG_NTFS_FS=y) and ran it
>   under QEMU against fresh 512 MiB NTFS images: mounted each read-write,
>   created 12 directories and 2160 files, then renamed, removed, cleaned
>   up and unmounted. Repeated three times; no KASAN report, oops or
>   panic, and ntfsfix -n reported each image clean after every run.
>
> DaeMyung Kang (4):
>   ntfs: reject non-resident records for resident-only attributes
>   ntfs: grow index root value before reparent header update
>   ntfs: update index root allocated size before shrink
>   ntfs: validate resident index root values on lookup
Applied them to #ntfs-next.
Thanks!