# NTFS fixup lifecycle: a transformation is not a predicate

Executed 23 October 2026. Original, bounded native-library evidence extending
the existing update-sequence study. No new glossary entity or standalone article.

## Finding

In the tested NTFS-3G library, double pre-write protection of the same buffer
overwrites the saved original trailer words. A subsequent checked read succeeds
but restores the previous marker as trailer payload. Correctly paired writer
operations preserve the original bytes. Calling the read fixup twice is different:
the second call rejects the already-restored buffer.

This is deliberately incorrect caller sequencing, not a discovered defect in a
production caller, a Windows result, or a newly discovered library vulnerability.

## Method

The unchanged installed Ubuntu libntfs-3g89t64 package is
1:2022.10.3-1.2ubuntu3.2. The full library SHA-256, resolved path, package version,
Python version and platform appear in each capture. Source review uses
NTFS-3G commit 78414d93613532fd82f3a82aba5d4a1c32898781; that is not a claim
that the packaged binary was built from exactly that unpatched source.

The original harness creates synthetic 512-, 1024- and 4096-byte buffers.
They contain a FILE signature and a bounded multisector layout, not complete
MFT attribute records. Each stride receives a distinct original trailer word:
0x8100 + 0x23 * stride_number. Distinct words help expose restoration-order
errors that a repeating-byte fixture could miss.

Eight call sequences at three sizes yield 24 cases and 48 native calls per
capture. Two retained captures are byte-identical on one host. The C ABI for
the unchecked post-write function is declared void; its recorded return is
JSON null, never a successful verification. The harness validates array bounds
before calling that unchecked function.

Each step is compared with a separately written byte oracle. Captures retain
the full input and final output, each intermediate input/output hash, return
codes and errno, and the final trailer words. The payload comparison is
explicitly bytes 100 through the end: the header and update-sequence array are
excluded because those legitimately change. Tests also compare every output
byte in the double-protection counterexample.

## Results

| Sequence | Final operation across three sizes | Original payload matched |
| --- | --- | --- |
| Read once | 3 checked successes | 3/3 |
| Read twice | 3 errors on the second read | 3/3 |
| Protect, restore, protect, checked read | 3 checked successes | 3/3 |
| Protect twice, checked read | 3 checked successes | 0/3 |
| Bad marker, checked read | 3 errors | 0/3 |
| Bad marker, unchecked restore | 3 void calls, no verification status | 3/3 |
| Valid input, unchecked restore | 3 void calls, no verification status | 3/3 |
| Protect, restore twice | 3 final void calls, no verification status | 3/3 |

The table reports deterministic fixture coverage, not failure probabilities.
The bad-marker control flips only the last trailer marker. The unchecked helper
restores its saved payload and discards that mismatching marker. Recovering the
original fixture bytes in this case does not establish that any input was checked.

For the 1024-byte double-protection witness, the original trailer words are
0x8123 and 0x8146. Protection advances marker 42 to 43, then a second protection
advances it to 44 and saves 43 in both array slots. Checked read accepts marker 44
and restores 43 in both trailers. All three checked calls return zero, but the
original trailer payload is gone. No physical I/O is involved.

## Source interpretation

The pinned mst.c documents post-write restoration as an unchecked writer-side
operation, assuming preceding protection. This supports a practical distinction
between restoration and validation. Keep raw input, protected output and restored
working buffers distinct, and track which transformations have occurred.
A zero errno value after a void helper does not supply a missing validation result.

[Gunawi et al., EIO: Error Handling is Occasionally Correct, FAST 2008](https://www.usenix.org/legacy/events/fast08/tech/full_papers/gunawi/gunawi_html/index.html)
used static error-propagation analysis on Linux 2.6.15.4 and selected disk-I/O
fault injection. Sections 2.2.3-2.2.4 distinguish checking an error from handling
it and describe unmodeled channels. Section 3.1.3 discusses alternative status
channels and manual false-positive review. A deliberately void helper is not
itself one of their ignored-error cases. Our inference is that a caller must
first identify the API's status contract; this is not a replication of their study.
Authors: Haryadi S. Gunawi, Cindy Rubio-Gonzalez, Andrea C. Arpaci-Dusseau,
Remzi H. Arpaci-Dusseau and Ben Liblit. Proceedings pages 207-222; no DOI verified.

[Microsoft's NTFS v3 structure contract](https://learn.microsoft.com/en-us/windows/win32/devnotes/multi-sector-header)
defines transfer-marker scope; it does not specify this userspace API lifecycle.
[The pinned NTFS-3G implementation](https://github.com/tuxera/ntfs-3g/blob/78414d93613532fd82f3a82aba5d4a1c32898781/libntfs-3g/mst.c)
is the primary API evidence. Source retrieval hashes and section locators are in
lifecycle-sources.json. Source licenses remain with their owners; no upstream
implementation or binary is redistributed.

## Research-reader repair

The previous study CLI used ordinary json.loads, so duplicate object keys were
silently collapsed before native comparison. A capture with conflicting
schemaVersion fields was accepted after parsing. The new strict reader rejects
duplicate keys at any nesting level, non-finite constants and trailing JSON.
Invalid top-level and row shapes now fail before launching a native replay.
Tests retain the rejection cases. This is a defect in our research reader,
not evidence of a production website or NTFS vulnerability.

## Reproduction

From this directory, on the recorded environment:

```sh
python3 lifecycle.py capture lifecycle-new.json
python3 lifecycle.py verify lifecycle-new.json
python3 lifecycle.py summary lifecycle-new.json
python3 -m unittest -v test_study.py test_lifecycle.py
python3 -O -m unittest -v test_study.py test_lifecycle.py
sha256sum -c SHA256SUMS
sha256sum -c LIFECYCLE-SHA256SUMS
```

Another library or platform requires a separate retained capture and explicit
difference review. Original 36 read cases, five transitions, captures and result
data are preserved. The parser/tests change, but no historical observation is
rewritten. Fixture ordering is intentional; counts do not imply independence.

Original harness, fixtures and observations: CC0-1.0. Limits: one host/library,
no Windows driver, mounted filesystem, storage device, crash, performance
measurement or real application caller audit. No confidence interval or fleet
inference applies to these selected deterministic cases.
