[BUG] Preserve private provider ID uniqueness through exhaustion and reset #4

Closed
opened 2026-09-29 09:14:36 +02:00 by erikinkinen · 0 comments
Owner

Summary

Private mount and ordinary handle counters use saturating addition, so the maximum ID can be returned again instead of refusing allocation. Clearing provider state also restarts those counters at one. These paths violate the provider's lifetime uniqueness contract and disagree with cwd/exact-entry allocation behavior.

Reproduction

Source-audited boundary cases; no runtime reproduction or test run is claimed. In the provider's existing unit fixture, seed a next-ID counter at u64::MAX with spare rows and allocate twice. Separately allocate a mount/handle, reset provider state, then allocate successors. The old implementation repeats IDs in both cases. These are fixture-controlled cases; no ordinary guest session has been demonstrated to reach counter exhaustion.

The accompanying store::identity_tests controls cover the final nonzero value, permanent exhaustion, reset retirement, original live handles and refusal before creation effects. Test execution is deferred by the user.

Expected and actual behavior

Expected: each nonzero wire ID, including u64::MAX, is available once per provider state/endpoint lifetime. Exhaustion returns BUSY before filesystem creation; reset clears records without rewinding either sequence. Stale private labels cannot name successor records.

Source behavior before the fix: ordinary allocation saturates at the maximum, reset reinitializes the sequences, and special handle paths implement separate boundary checks. Native endpoint admission is still required; IDs are descriptive and grant no authority.

Environment and identity

Evidence and prior checks

Implemented in signed a5ae1119 and selected by signed Integration c010965a. Closing as fixed under the user's testing waiver: regression controls are authored, not executed, and closure does not assert a passing test or CI result. The complete native permission feature remains separate unfinished work.

Inspection found the allocation and reset paths in src/store.rs, with separate cwd/exact-entry checks. The fix centralizes preflight in src/store/handles.rs, commits only after successful media operations, and keeps reset from reviving retired IDs. New controls are authored but unrun. Tests, builds, lint checks, VM runs and CI observation remain deferred; no pass or warning-free build is claimed.

Tracking

## Summary Private mount and ordinary handle counters use saturating addition, so the maximum ID can be returned again instead of refusing allocation. Clearing provider state also restarts those counters at one. These paths violate the provider's lifetime uniqueness contract and disagree with cwd/exact-entry allocation behavior. ## Reproduction Source-audited boundary cases; no runtime reproduction or test run is claimed. In the provider's existing unit fixture, seed a next-ID counter at `u64::MAX` with spare rows and allocate twice. Separately allocate a mount/handle, reset provider state, then allocate successors. The old implementation repeats IDs in both cases. These are fixture-controlled cases; no ordinary guest session has been demonstrated to reach counter exhaustion. The accompanying `store::identity_tests` controls cover the final nonzero value, permanent exhaustion, reset retirement, original live handles and refusal before creation effects. Test execution is deferred by the user. ## Expected and actual behavior Expected: each nonzero wire ID, including `u64::MAX`, is available once per provider state/endpoint lifetime. Exhaustion returns `BUSY` before filesystem creation; reset clears records without rewinding either sequence. Stale private labels cannot name successor records. Source behavior before the fix: ordinary allocation saturates at the maximum, reset reinitializes the sequences, and special handle paths implement separate boundary checks. Native endpoint admission is still required; IDs are descriptive and grant no authority. ## Environment and identity - Component: [fatd at `5e2393d2bbf44d1fd0795f35a43e2f6936ffb098`](https://git.erikinkinen.fi/erix/fatd/commit/5e2393d2bbf44d1fd0795f35a43e2f6936ffb098), `feature/posix-compat`. - Integration source selection: [`3eaec99bc5561dbd5989e4c667014dab312f1f20`](https://git.erikinkinen.fi/erix/integration/commit/3eaec99bc5561dbd5989e4c667014dab312f1f20). - Image, hardware/VM, firmware and toolchain: not exercised; this finding comes from source inspection and fixture authoring. - Route: provider-local state behind the existing admitted native endpoint, without new capabilities. - Last known working revision: unknown. ## Evidence and prior checks Implemented in signed [a5ae1119](https://git.erikinkinen.fi/erix/fatd/commit/a5ae111940705e9bfbeb413d94def8b58d81a048) and selected by signed [Integration c010965a](https://git.erikinkinen.fi/erix/integration/commit/c010965a9126073a2eda15fb2e79fabc97db2346). Closing as fixed under the user's testing waiver: regression controls are authored, not executed, and closure does not assert a passing test or CI result. The complete native permission feature remains separate unfinished work. Inspection found the allocation and reset paths in `src/store.rs`, with separate cwd/exact-entry checks. The fix centralizes preflight in `src/store/handles.rs`, commits only after successful media operations, and keeps reset from reviving retired IDs. New controls are authored but unrun. Tests, builds, lint checks, VM runs and CI observation remain deferred; no pass or warning-free build is claimed. ## Tracking - Review: [fatd implementation](https://git.erikinkinen.fi/erix/fatd/pulls/3). - Repository audit: [fatd audit](https://git.erikinkinen.fi/erix/fatd/issues/1). - Overall completion: [Phase 6 master issue](https://git.erikinkinen.fi/erix/integration/issues/65). - Related provider contract: [retained permission evidence](https://git.erikinkinen.fi/erix/posixd/issues/10).
erikinkinen added this to the Alpha 1 milestone 2026-10-30 09:33:59 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
erix/fatd#4
No description provided.