Skip to content

femu: validate report lengths and preserve ZRWA reopen transitions - #206

Draft
huaicheng wants to merge 3 commits into
masterfrom
up/continuation-20260921
Draft

huaicheng wants to merge 3 commits into
masterfrom
up/continuation-20260921

Conversation

@huaicheng

Copy link
Copy Markdown
Contributor

Large log and management-report requests could wrap their dword counts into short transfers and return success. This series keeps the length arithmetic wide until validation, enforces the FDP status transfer limit, and rejects lengths the transfer APIs cannot represent.

It also fixes Open Zone with ZRWA allocation on a closed zone that already owns a ZRWA: the command now reopens the zone while preserving its existing resource. Previously it returned success without changing the zone state.

Validation:

  • Six new qtest cases reproduce the old behavior and pass with the fixes, including ordinary-transfer controls and ZRWA exhaustion/reuse.
  • All 37 FEMU qtests pass locally and on an ASan/UBSan build with FTL assertions.
  • NAND media tests: 46 passed. Configuration self-test: 18 passed.
  • All three commits pass checkpatch with no errors or warnings.
  • Full guest regression matrix is running; results will be added before marking ready.

Get Log Page decoded the zero-based dword count in 32 bits, so a request
for more than four gigabytes could wrap to a small successful transfer
before the MDTS check. The Open-Channel Set Log Page path decoded the
count the same way.

Keep the arithmetic wide until the length has been checked against the
transfer helpers and chunk log bounds. Exercise wrapping counts with and
without MDTS, along with the Open-Channel set path and ordinary
transfers.

Signed-off-by: Huaicheng Li <lhcwhu@gmail.com>
Zone Management Receive and I/O Management Receive evaluated their dword
counts in 32 bits. Large requests could wrap to short successful reports,
and the FDP status path did not enforce MDTS.

Decode the counts in 64 bits and validate them before allocating or
transferring a report. Leave the no-operation management command alone.
Cover both report commands with wrapping counts and working controls.

Signed-off-by: Huaicheng Li <lhcwhu@gmail.com>
Open Zone with the allocation bit returned success immediately when the
zone already owned a ZRWA. A closed zone therefore stayed closed even
though the host had successfully requested an explicit open.

Skip allocation for an existing resource, but still perform the zone
state transition. Charge a resource only when one is newly allocated.
Test repeated close and reopen operations, resource exhaustion, and
reuse after reset.

Signed-off-by: Huaicheng Li <lhcwhu@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant