[FEATURE] Add process-owned working directories and cwd adapters #44
Labels
No labels
alpha-1
bug
ci
docs
duplicate
enhancement
help wanted
invalid
performance
phase-6
question
refactor
security
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
erix/posixd#44
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem and motivation
Compatibility processes need an owned current directory for build tools which
change directories, retain directory fds and request their physical cwd name.
The mediator currently resolves cwd-relative paths through the initial native
scope selector. It has no process cwd owner or chdir/fchdir/getcwd interface.
Proposed behavior and scope
Implement process-owned cwd shared by threads, with an original cwd snapshot
for each pending relative operation. Add counted chdir and fchdir adapters with
fresh SEARCH checks, without adding a directory READ requirement. Closing or
replacing an fd must not revoke an admitted fchdir or pending pathname base.
Return fresh physical getcwd names rooted at the actual process ceiling,
including after rename. Support results larger than a native packet through a
retained immutable paged report and checked caller capacity, without PATH_MAX
as a policy limit. Too-small buffers return ERANGE and remain unchanged; no
malloc-return extension is included. An unavailable rooted name is an honest
error while its actual directory pin remains retained.
Scope includes the native/protocol contracts, counted producer storage, Posixd,
Cstd explicit-prefix adapters, real native consumer, provider controls and manuals.
Compatibility fork/exec remains its own unimplemented process feature; specify
its future ownership boundary and change only actual existing lifecycle hooks.
Authority, security and reliability
Retain original directory objects, scope and generation through all provider
work, cancellation, failed publication and terminal cleanup. Paths, PWD strings,
uid zero, numeric object IDs and report keys grant no authority. Absolute paths
and '..' cannot exceed the original root or inherited ceilings, including after
moves and detachment. Keep final and prefix search policy separate from content
READ rights.
Do not reinterpret consumed permission evidence as a stable namespace version.
Freeze a real revision/epoch strategy for concurrent rename before publishing
physical reports. Uncertain native work preserves its original owner, packet,
first cause and backing, with no ordinary replay or false unchanged-cwd error.
No callback runs under a process-global data gate across blocking I/O.
Acceptance criteria
chdir, fchdir fd close/dup2, both relative namespace operands, generation limits
and actual original retirement without capability widening.
physical getcwd after rename, mount traversal and detach, with root confinement.
semantics, wrong-origin/key/range refusal, cancellation, unwind and cleanup.
native C/Rust adapters, headers and manuals; preserve existing contracts.
ext and FAT; report source, compiler and native acceptance separately. Full
fork/exec and in-EriX build acceptance remain separate requirements.
Alternatives and tradeoffs
Cached PWD strings do not represent renamed or detached original objects. A
shared mutable native cwd selector can retarget already pending calls. Reopening
paths loses object identity, and READ-admitting a directory to implement SEARCH
widens rights. Reuse the existing native pin, mount-parent and counted-description
mechanisms, adding only the missing process ownership and reporting contracts.
Tracking and rollout
This completes a required part of mediated libc file operations tracked by
LibCstd file adapters.
Coordinate protocol/storage migration, native provider/reporting, mediator and
C/native adoption before selecting the new cohort. Follow file timestamp updates
and the mediator PR for the
related changes. Retire superseded cwd lookup only after
all actual pathname consumers use retained process snapshots.
The C consumer now requests a 952-byte raw physical cwd across the existing reply boundary, checks a short buffer and two complete results, then removes the tree through retained parents. New adapter controls cover a successful first chunk followed by an error, unchanged caller bytes, original report release and a later fresh request. Implementation.