[BUG] Native thread admission omits the initial lifetime charge #40

Closed
opened 2026-10-12 17:50:35 +02:00 by erikinkinen · 1 comment
Owner

Summary

Posixd does not count the initial thread against a client's native capacity.
With capacity 2 and one additional member, a second creation can reach Kernel
if the realm has spare rows. Kernel refuses it correctly; Posixd retains that
native error and stops ordinary service instead of returning EAGAIN.

Reproduction

Apply the new independent quota regression control to Posixd
b049eb0e6530dedec8dbd6eb5245d63dca2c1a5b, then run:

RUSTFLAGS='-D warnings' cargo +1.93.0 test --lib \
  factory_capacity_includes_the_initial_execution_and_refuses_before_native_effects \
  --quiet

The control supplies two clients with capacity 2 and spare realm storage.
Create one member, retire its creator call, then request a second member from
the same client. Its independent backend enforces Kernel's initial-inclusive
quota; the original implementation fails deterministically.

Expected and actual behavior

Return EAGAIN before any destination query, row reservation or native operation.
Preserve all generations, existing owners and the other client's capacity.
Instead, Prepare returns NativeStatus(7) (RESOURCE_EXHAUSTED), and ordinary
service freezes. The control exits 101 with 0 passed; 1 failed.

Environment and identity

Rust 1.93.0 on x86_64 Linux; this is a host regression, with no guest execution.
Kernel 3f9ba9cd357bcd4474e24e1d9cc62e83891b9dab charges the initial member
through its process lifetime. Original CLAIM/factory/member custody remains
explicit; requests carry no authority selectors. No earlier working revision
of ordinary native creation is known.

Evidence and prior checks

Kernel's actual-object preparation controls independently establish that capacity
1 allows no additional member. The new controls cover spare global rows,
capacity 1, an outstanding reservation and the peer's separate quota. They
compare native effects and counted generations before and after refusal.

Tracking

Correct Posixd admission while retaining Kernel's quota checks and the initial
lifetime charge through thread-only departure. Related: ordinary creation,
native lifetime and
Phase 6.

## Summary Posixd does not count the initial thread against a client's native capacity. With capacity 2 and one additional member, a second creation can reach Kernel if the realm has spare rows. Kernel refuses it correctly; Posixd retains that native error and stops ordinary service instead of returning EAGAIN. ## Reproduction Apply the new independent quota regression control to Posixd `b049eb0e6530dedec8dbd6eb5245d63dca2c1a5b`, then run: ```sh RUSTFLAGS='-D warnings' cargo +1.93.0 test --lib \ factory_capacity_includes_the_initial_execution_and_refuses_before_native_effects \ --quiet ``` The control supplies two clients with capacity 2 and spare realm storage. Create one member, retire its creator call, then request a second member from the same client. Its independent backend enforces Kernel's initial-inclusive quota; the original implementation fails deterministically. ## Expected and actual behavior Return EAGAIN before any destination query, row reservation or native operation. Preserve all generations, existing owners and the other client's capacity. Instead, Prepare returns `NativeStatus(7)` (RESOURCE_EXHAUSTED), and ordinary service freezes. The control exits 101 with `0 passed; 1 failed`. ## Environment and identity Rust 1.93.0 on x86_64 Linux; this is a host regression, with no guest execution. Kernel `3f9ba9cd357bcd4474e24e1d9cc62e83891b9dab` charges the initial member through its process lifetime. Original CLAIM/factory/member custody remains explicit; requests carry no authority selectors. No earlier working revision of ordinary native creation is known. ## Evidence and prior checks Kernel's actual-object preparation controls independently establish that capacity 1 allows no additional member. The new controls cover spare global rows, capacity 1, an outstanding reservation and the peer's separate quota. They compare native effects and counted generations before and after refusal. ## Tracking Correct Posixd admission while retaining Kernel's quota checks and the initial lifetime charge through thread-only departure. Related: [ordinary creation](https://git.erikinkinen.fi/erix/posixd/issues/34), [native lifetime](https://git.erikinkinen.fi/erix/kernel/issues/47) and [Phase 6](https://git.erikinkinen.fi/erix/integration/issues/65).
Author
Owner

The fix counts the initial lifetime charge before any native effect. Spare realm rows, capacity 1, outstanding reservations and the peer quota are covered by the independent regression controls. The initial charge survives thread-only departure.

The [fix](https://git.erikinkinen.fi/erix/posixd/commit/4462a514289d74cfaaeb764d530e07346ca03a5a) counts the initial lifetime charge before any native effect. Spare realm rows, capacity 1, outstanding reservations and the peer quota are covered by the independent regression controls. The initial charge survives thread-only departure.
erikinkinen added this to the Alpha 1 milestone 2026-10-30 09:35:08 +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/posixd#40
No description provided.