[FEATURE] Provide restricted terminal controls for mediated descriptors #5
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/ttyd#5
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 programs need terminal controls through their Posixd descriptors. Existing TTY byte endpoints do not provide those controls, and the separate session-owner route carries unrelated authority.
Proposed behavior and scope
Provide restricted Ttyd control views, then adopt them through LibIPC, LibPosixABI, Posixd and namespaced LibCstd interfaces. Bind each view to its original live PTY and byte stream, with explicit operation rights.
Cover terminal identification and naming, attributes and control characters, speeds, window dimensions, drain/flush/flow/break, and compatibility session/foreground-group operations. Specify real effects and errors for virtual PTYs and physical serial terminals. Unsupported hardware behavior must never report invented success. Conventional POSIX aliases retain their separate startup and signal-delivery requirements.
Authority, security and reliability
Mint views from the actual admitted terminal owner. Do not forward its session-lifecycle endpoint, grant hangup or trusted UI operations, or widen existing stdin/stdout loans. Byte-only realms receive no new terminal authority.
Retain the original view, stream association, caller and descriptor occupation through pending calls, aliases and close/dup races. Revoking a recipient's view must preserve the lender's PTY and streams. Preflight fallible reservations before effects; retain original request/reply evidence and first failure through cancellation or uncertain cleanup. Publish C outputs only after original call retirement.
Acceptance criteria
Alternatives and tradeoffs
Reusing the session-owner endpoint would carry unrelated operations; widening byte endpoints would change existing loans. Direct TTY or host-system calls would bypass descriptor mediation. A mode-bit wrapper alone would leave required terminal behavior missing.
Tracking and rollout
Part of the libc plan and Phase 6 tracking. Related work: descriptor bridge, C library PR, Posixd PR.
Publish the native control contract first, followed by mediator/ABI support, libc adapters and the guest workload. Keep producer/consumer revisions coherent and remove superseded paths.
Terminal-control creation will use a separate provisioning endpoint because transferring its two capability inputs requires SEND|GRANT. The existing session-provision grants will stay unchanged. An explicit, versioned Procd BootConfig policy will enable the new route; storage counts will remain independent of authority. Rootd will create and delegate the endpoint, with exact optional intake policies and startup checks in Procd and Ttyd. Disabled deployments must have no alias for this route; malformed policy or inconsistent roles and capacity will refuse before startup.
The restricted terminal-control route is implemented across Ttyd, Rootd, Procd, Launchd and Posixd. Per-view rights stay tied to the original stream; boot policy explicitly requests the separate route, and Posixd retains control owners through aliases and teardown. The C identification/window adapters are next; complete termios behavior remains open.
The C identification/window adapters now use the retained native views through Posixd. The explicit terminal workload requests STATE and RESIZE, keeps its peer byte-only, and includes window restoration and last-alias cleanup checks. Full termios and native workload acceptance remain open.