Repository navigation
Conversation
Review of #1238 at 9f94ce8ArchitectureThe kernel-side shape is right. The approved exit (a) is to refuse the label at Folding in the refused-syscall issue is the right call. Deleting the six For exit (b), every judge that reads a Size: production code is net about +7 lines. The validator's +12 roughly offsets the six deleted Metal (T14 readbacks at 9f94ce8, judged from a clean detached worktree at 9f94ce8)Command, run through the build slot from a clean worktree (
The i219 red is independent of this change. The job's own lines repeat the signature recorded in
Required
Suggestions (optional)
Interfaces the later spawn-path PRs inherit
Evidence checked
SEND BACK. Two required findings remain. Both fixes are small: the SDK fits the path label, and the depth arm keeps a check of the depth or stops claiming it. What re-review needs: the SDK host test, plus a |
`SYS_SPAWN`'s path is a label its caller states, which the kernel quotes in the spawn's record, and quoted in each refusal's. It was any UTF-8 up to 64 KiB, so a caller could put a line break and a whole kernel record of its own writing into `/log`, a job's exit record among them, or state another program's path. The boundary: `toyos_abi::syscall::spawn_path` takes a path of at most `MAX_PATH` bytes of UTF-8 every character of which `spawn_path_holds`: no control character, the shape `process_name` and `last_words` have. `SYS_SPAWN` answers `InvalidArgument` for any other before it copies it. White space stays: a file's name may hold a space. The SDK states the path it spawns from with each character `spawn_path_holds` refuses replaced by U+FFFD, cut at a character to `MAX_PATH` bytes, as it fits a process's name. A file's name may hold a control character, and nothing opens the label, so such a program still runs. The record now says the kernel's fields first and the path last, `spawn: pid=N (total=Nms) <path>`. A path may be 4096 bytes and a record holds 992, so with the path first a long one cut the pid off its own record; last, a cut or anything the path says reaches nothing the kernel said. `abuse_spawn_path_and_name` holds a path of two lines, one holding an escape, one that is not UTF-8 and one a byte past the bound refused, and the longest path starting a child. A refused spawn writes no record. Each of its six refusals wrote one per call, naming the path, into the log every program shares, and its caller chose how often. The error is the answer. `InvalidArgument` and `Gone` say why; `ResourceExhausted` covers the depth, the pid space, an address space and a kernel stack alike, and nothing now tells them apart: an explicitly reported failure, which a program that cares says in its own ring, under logkeeper's limit. The landed spawn's record is then the one place the kernel quotes the path. `process_tree`'s metal judge, which read the depth refusal's record for its depth, now holds that every `spawn:` record of the boot is of a spawn that landed: red on a kernel that records the chain's refusal. The depth is the guest's: the job runs two below the supervisor, so its chain must stop at link `MAX_DEPTH - 2`, since only where it stops says the refusal was the depth's. The `dlopen` the issue named is gone with `SYS_DLOPEN`. The judges: none reads a `spawn:` record's path any more. - `bootlog::spawned_pid` reads the pid from the record's head, which is the kernel's, and is held to the kernel's format string by the source check. - The supervisor's boot line names the pid it started (`supervisor: started logkeeper pid=N`), and `one_clock` and `virt_job` find the kernel's record of that spawn by it. - `claims::job_records` takes the job's pid from its exit record and the spawn that pid landed by. - The audio judges open a job's window at the test runner's own start line, one whose head carries no `pid=`, which a job's line in the runner's ring does. - `virt_user_mode` and `virt_low_ecam` wait for the second spawn record, the first a program asked for; `session_lifecycle` for the terminal's own line and a spawn landing after the command was typed; the typed `ls` for its exit record; and the undeclared boot for the holder's own line. - `run_test` no longer moves a spawn record that preceded its test's start marker into the window. It dates from the kernel's records reaching the console by another road than a program's lines; since the console carries logkeeper's rounds in stamp order the runner's marker, stamped before it spawns, is never behind the record. 1508 job starts in 199 captured logs show none. No other kernel record prints a process's text raw: a name is one token (`process_name`), last words are one line (`last_words`), a crash's frames escape the path, the firmware's OEM id is debug-printed, and thread names, namespace names and endowment labels reach no record. Closes issues/a-spawns-record-quotes-the-path-its-caller-states.md and issues/a-refused-syscall-writes-a-log-record-per-call-and-nothing-bounds-the-caller.md. What is left is recorded: a holder of the device or power right still has a record per refused claim, declaration or stop (issues/a-capability-holders-refused-claim-or-stop-writes-a-record-per-call.md), a judge that searches a whole line can be answered by what a spawn's record quotes (issues/a-judge-that-searches-a-whole-line-reads-what-a-record-quotes.md), and an exit record's name is its spawner's label too (issues/a-metal-judge-takes-a-names-lowest-pid-for-the-job.md). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-up review of #1238 at 6cdc1d0 (round 2)Scope: the two required findings from the previous review, the code changed to fix them, and the suggestions taken. I read the PR's own interdiff ArchitectureBoth fixes are in the right place. The ABI owns the predicate. Required finding 1: SDK path label. Resolved.
Required finding 2:
|
A refused spawn writes no record since the spawn's path became one line, so the doc no longer says the log names `ResourceExhausted`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Orchestrator: verified e91c70e. |
|
Orchestrator: T14 |
…hat a spawn copies `SYS_NAMESPACE_OPEN`'s name was the last caller of `SyscallContext::user_str`; #1238 already reads a spawn's path as bytes bounded by `MAX_PATH`. So `user_str` and `MAX_USER_STR` go, and `KernelStack::heap` charges each thread for what its largest call copies in and holds while preempted: a spawn's path, name and build-id at their bounds, its ranges and its endowments, by their types. It used to charge two 64 KiB strings and a page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hat its spawn copies `SYS_NAMESPACE_OPEN`'s name was the last caller of `SyscallContext::user_str`; #1238 already reads a spawn's path as bytes bounded by `MAX_PATH`. So `user_str` and `MAX_USER_STR` go. `KernelStack::heap` charged every thread two 64 KiB strings and a page for what a call copies in. It now charges, by their types, what a spawn copies in and holds where it may be preempted: - its path, name and build-id at their bounds; - its ranges; - its endowments; - the mappings of the device claims it moves, in a vector now sized once at the first claim so it never grows past that. It claims nothing for another call. `SYS_SYSINFO`'s roster, larger and held across a copy-out that can wait, is charged to its caller for the call, in a commit of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hat its spawn copies `SYS_NAMESPACE_OPEN`'s name was the last caller of `SyscallContext::user_str`; #1238 already reads a spawn's path as bytes bounded by `MAX_PATH`. So `user_str` and `MAX_USER_STR` go. `KernelStack::heap` charged every thread two 64 KiB strings and a page for what a call copies in. It now charges, by their types, what a spawn copies in and holds where it may be preempted: - its path, name and build-id at their bounds; - its ranges; - its endowments; - the mappings of the device claims it moves, in a vector now sized once at the first claim so it never grows past that. It claims nothing for another call. `SYS_SYSINFO`'s roster, larger and held across a copy-out that can wait, is charged to its caller for the call, in a commit of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cks' spawn records in main's form Main moved under the branch in three places this branch also changes: #1241 renamed `machine_shutdown_short_stop` to `machine_shutdown_with_a_thread_spinning`, which is now that name's `MACHINE_TESTS` entry; #1238 changed `virt_user_mode`'s arm, which this branch moved into a function and which now carries the change; and #1238 changed the kernel's spawn record to `spawn: pid=N (total=Xms) <path>` and the supervisor's to `started logkeeper pid=N`, which the one-clock check's planted log now writes beside the T14's first record. #1238's readers no longer read the older form, so the two bench readbacks this branch carries as fixtures, written before it, read as a boot with no record of logkeeper's spawn and a job with no spawn record. Their three lines each are rewritten in the form the kernel and the supervisor now write, with the same pids and times. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cks' spawn records in main's form Main moved under the branch in three places this branch also changes: #1241 renamed `machine_shutdown_short_stop` to `machine_shutdown_with_a_thread_spinning`, which is now that name's `MACHINE_TESTS` entry; #1238 changed `virt_user_mode`'s arm, which this branch moved into a function and which now carries the change; and #1238 changed the kernel's spawn record to `spawn: pid=N (total=Xms) <path>` and the supervisor's to `started logkeeper pid=N`, which the one-clock check's planted log now writes beside the T14's first record. #1238's readers no longer read the older form, so the two bench readbacks this branch carries as fixtures, written before it, read as a boot with no record of logkeeper's spawn and a job with no spawn record. Their three lines each are rewritten in the form the kernel and the supervisor now write, with the same pids and times. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hat its spawn copies `SYS_NAMESPACE_OPEN`'s name was the last caller of `SyscallContext::user_str`; #1238 already reads a spawn's path as bytes bounded by `MAX_PATH`. So `user_str` and `MAX_USER_STR` go. `KernelStack::heap` charged every thread two 64 KiB strings and a page for what a call copies in. It now charges, by their types, what a spawn copies in and holds where it may be preempted: - its path, name and build-id at their bounds; - its ranges; - its endowments; - the mappings of the device claims it moves, in a vector now sized once at the first claim so it never grows past that. It claims nothing for another call. `SYS_SYSINFO`'s roster, larger and held across a copy-out that can wait, is charged to its caller for the call, in a commit of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…leave the kernel The kernel kept, for every process, the labels its parent put on each endowment, compared three of them (`job`, `self`, `quit`), answered them back through `SYS_ENDOWMENTS`, and held a namespace object that mapped service names to connectors behind three more calls. None of that is the kernel's: it is what one program calls a handle it gave another. Now a spawn moves a list of handles and nothing else. The child's table starts with its handle to itself (`RawHandle::SELF`), its notice (`RawHandle::NOTICE`), then the endowments in the order the spawn listed them (`RawHandle::endowed(i)`); the kernel installs them so and asserts it. What the parent calls each is a table it writes in the child's startup block, which the child's SDK checks once, whole, before it looks one up: a table that is no list of distinct, non-empty UTF-8 names ends the child, said on its `fd:2` where the table still names one. - `SpawnArgs::job` replaces the `job` label: a borrowed handle carrying `WRITE`, resolved once like the place and the pager, so the commit's re-check that the moved handle still named the job goes. - `SYS_CONNECT` (102, `SYS_NAMESPACE_OPEN`'s number) connects through a connector carrying `WRITE`, which a connector is now minted with. One without it may only be passed on. - `SYS_ENDOWMENTS` (99), `SYS_NAMESPACE_BUILD` (101), `SYS_NAMESPACE_NAMES` (170), the namespace object, `SpawnEndow`, `EndowEntry`, the label blob and its per-process charge go; the freed numbers stay unassigned. `MAX_SPAWN_ENDOWMENTS` is 96: the 30 a spawn carried plus the 64 a namespace held, so everything one table and one namespace expressed still fits. The names are bounded by the startup block alone. - The supervisor, whose parent is the kernel, starts holding its system capability, the file server's image, ROOT's and the boot names at the four handles `toyos_abi::boot::supervisor` states. In userland a service is a connector named `svc:<name>` (a row's `receives`, its view's `fs:` directories, minted grants) or `provide:<name>` (one a launching client sent). `endow::service` looks one up and connects; a helper is given a duplicate of each its parent holds, narrowed by `CommandExt::services_only`. Everything else is taken once by name. The supervisor gives a provided connector to a row that does not receive it without `WRITE`; swap's connector arrives with `WRITE` alone, as its one holder only connects. The supervisor adopts its own directory capabilities (`std::os::toyos::fs::adopt_services`), which no child inherits: so a storage row, whose view is empty, now starts holding no file grant, where it inherited the supervisor's whole tree. `SYS_NAMESPACE_OPEN`'s name was the last caller of `SyscallContext::user_str`, since #1238 reads a spawn's path as bytes bounded by `MAX_PATH`. So `user_str` and `MAX_USER_STR` go. `KernelStack::heap` charged every thread two 64 KiB strings and a page for what a call copies in. It now charges, by their types, what a spawn copies in and holds where it may be preempted: - its path, name and build-id at their bounds; - its ranges; - its endowments; - the mappings of the device claims it moves, in a vector sized once at the first claim so it never grows past that. It claims nothing for another call. A block session holds a connector and no service name, so diskserver's two messages for a session's server that broke the protocol or went silent name the session by its partition GUID. Kernel: 55,155 lines in 211 files at main 8188095 to 54,797 in 210. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…leave the kernel The kernel kept, for every process, the labels its parent put on each endowment, compared three of them (`job`, `self`, `quit`), answered them back through `SYS_ENDOWMENTS`, and held a namespace object that mapped service names to connectors behind three more calls. None of that is the kernel's: it is what one program calls a handle it gave another. Now a spawn moves a list of handles and nothing else. The child's table starts with its handle to itself (`RawHandle::SELF`), its notice (`RawHandle::NOTICE`), then the endowments in the order the spawn listed them (`RawHandle::endowed(i)`); the kernel installs them so and asserts it. What the parent calls each is a table it writes in the child's startup block, which the child's SDK checks once, whole, before it looks one up: a table that is no list of distinct, non-empty UTF-8 names ends the child, said on its `fd:2` where the table still names one. - `SpawnArgs::job` replaces the `job` label: a borrowed handle carrying `WRITE`, resolved once like the place and the pager, so the commit's re-check that the moved handle still named the job goes. - `SYS_CONNECT` (102, `SYS_NAMESPACE_OPEN`'s number) connects through a connector carrying `WRITE`, which a connector is now minted with. One without it may only be passed on. - `SYS_ENDOWMENTS` (99), `SYS_NAMESPACE_BUILD` (101), `SYS_NAMESPACE_NAMES` (170), the namespace object, `SpawnEndow`, `EndowEntry`, the label blob and its per-process charge go; the freed numbers stay unassigned. `MAX_SPAWN_ENDOWMENTS` is 96: the 30 a spawn carried plus the 64 a namespace held, so everything one table and one namespace expressed still fits. The names are bounded by the startup block alone. - The supervisor, whose parent is the kernel, starts holding its system capability, the file server's image, ROOT's and the boot names at the four handles `toyos_abi::boot::supervisor` states. In userland a service is a connector named `svc:<name>` (a row's `receives`, its view's `fs:` directories, minted grants) or `provide:<name>` (one a launching client sent). `endow::service` looks one up and connects; a helper is given a duplicate of each its parent holds, narrowed by `CommandExt::services_only`. Everything else is taken once by name. The supervisor gives a provided connector to a row that does not receive it without `WRITE`; swap's connector arrives with `WRITE` alone, as its one holder only connects. The supervisor adopts its own directory capabilities (`std::os::toyos::fs::adopt_services`), which no child inherits: so a storage row, whose view is empty, now starts holding no file grant, where it inherited the supervisor's whole tree. `SYS_NAMESPACE_OPEN`'s name was the last caller of `SyscallContext::user_str`, since #1238 reads a spawn's path as bytes bounded by `MAX_PATH`. So `user_str` and `MAX_USER_STR` go. `KernelStack::heap` charged every thread two 64 KiB strings and a page for what a call copies in. It now charges, by their types, what a spawn copies in and holds where it may be preempted: - its path, name and build-id at their bounds; - its ranges; - its endowments; - the mappings of the device claims it moves, in a vector sized once at the first claim so it never grows past that. It claims nothing for another call. A block session holds a connector and no service name, so diskserver's two messages for a session's server that broke the protocol or went silent name the session by its partition GUID. Kernel: 55,416 lines in 212 files at main 75bdec3 to 55,058 in 211. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…leave the kernel The kernel kept, for every process, the labels its parent put on each endowment, compared three of them (`job`, `self`, `quit`), answered them back through `SYS_ENDOWMENTS`, and held a namespace object that mapped service names to connectors behind three more calls. None of that is the kernel's: it is what one program calls a handle it gave another. Now a spawn moves a list of handles and nothing else. The child's table starts with its handle to itself (`RawHandle::SELF`), its notice (`RawHandle::NOTICE`), then the endowments in the order the spawn listed them (`RawHandle::endowed(i)`); the kernel installs them so and asserts it. What the parent calls each is a table it writes in the child's startup block, which the child's SDK checks once, whole, before it looks one up: a table that is no list of distinct, non-empty UTF-8 names ends the child, said on its `fd:2` where the table still names one. - `SpawnArgs::job` replaces the `job` label: a borrowed handle carrying `WRITE`, resolved once like the place and the pager, so the commit's re-check that the moved handle still named the job goes. - `SYS_CONNECT` (102, `SYS_NAMESPACE_OPEN`'s number) connects through a connector carrying `WRITE`, which a connector is now minted with. One without it may only be passed on. - `SYS_ENDOWMENTS` (99), `SYS_NAMESPACE_BUILD` (101), `SYS_NAMESPACE_NAMES` (170), the namespace object, `SpawnEndow`, `EndowEntry`, the label blob and its per-process charge go; the freed numbers stay unassigned. `MAX_SPAWN_ENDOWMENTS` is 96: the 30 a spawn carried plus the 64 a namespace held, so everything one table and one namespace expressed still fits. The names are bounded by the startup block alone. - `ObjectKind::Namespace` goes and its word 8 stays unused, as `ObjectKind` says a word that goes does: `SysCap` through `DeviceSet` keep 9 to 19, `from_word` looks a word up rather than indexing by it, the SDK's census finds a kind's count by its place in `ALL`, and the SDK's receive test takes word 8 and the word past the last kind as ones no kind has. - The supervisor, whose parent is the kernel, starts holding its system capability, the file server's image, ROOT's and the boot names at the four handles `toyos_abi::boot::supervisor` states. In userland a service is a connector named `svc:<name>` (a row's `receives`, its view's `fs:` directories, minted grants) or `provide:<name>` (one a launching client sent). `endow::service` looks one up and connects; a helper is given a duplicate of each its parent holds, narrowed by `CommandExt::services_only`. Everything else is taken once by name. The supervisor gives a provided connector to a row that does not receive it without `WRITE`; swap's connector arrives with `WRITE` alone, as its one holder only connects. The supervisor adopts its own directory capabilities (`std::os::toyos::fs::adopt_services`), which no child inherits: so a storage row, whose view is empty, now starts holding no file grant, where it inherited the supervisor's whole tree. A connector a peer sent, as a session's launcher and controls are, is typed only where the kernel reported a connector (`ReceivedHandle::typed`), and an endowed one on its parent's word. std's `adopt_services` is `unsafe`, as `adopt_namespace` was: the handles it takes are its caller's word. `SYS_NAMESPACE_OPEN`'s name was the last caller of `SyscallContext::user_str`, since #1238 reads a spawn's path as bytes bounded by `MAX_PATH`. So `user_str` and `MAX_USER_STR` go. `KernelStack::heap` charged every thread two 64 KiB strings and a page for what a call copies in. It now charges, by their types, what a spawn copies in and holds where it may be preempted: - its path, name and build-id at their bounds; - its ranges; - its endowments; - the mappings of the device claims it moves, in a vector sized once at the first claim so it never grows past that. It claims nothing for another call. A block session holds a connector and no service name, so diskserver's two messages for a session's server that broke the protocol or went silent name the session by its partition GUID. Kernel: 55,742 lines in 212 files at main 429f772 to 55,384 in 211. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…leave the kernel The kernel kept, for every process, the labels its parent put on each endowment, compared three of them (`job`, `self`, `quit`), answered them back through `SYS_ENDOWMENTS`, and held a namespace object that mapped service names to connectors behind three more calls. None of that is the kernel's: it is what one program calls a handle it gave another. Now a spawn moves a list of handles and nothing else. The child's table starts with its handle to itself (`RawHandle::SELF`), its notice (`RawHandle::NOTICE`), then the endowments in the order the spawn listed them (`RawHandle::endowed(i)`); the kernel installs them so and asserts it. What the parent calls each is a table it writes in the child's startup block, which the child's SDK checks once, whole, before it looks one up: a table that is no list of distinct, non-empty UTF-8 names ends the child, said on its `fd:2` where the table still names one. - `SpawnArgs::job` replaces the `job` label: a borrowed handle carrying `WRITE`, resolved once like the place and the pager, so the commit's re-check that the moved handle still named the job goes. - `SYS_CONNECT` (102, `SYS_NAMESPACE_OPEN`'s number) connects through a connector carrying `WRITE`, which a connector is now minted with. One without it may only be passed on. - `SYS_ENDOWMENTS` (99), `SYS_NAMESPACE_BUILD` (101), `SYS_NAMESPACE_NAMES` (170), the namespace object, `SpawnEndow`, `EndowEntry`, the label blob and its per-process charge go; the freed numbers stay unassigned. `MAX_SPAWN_ENDOWMENTS` is 96: the 30 a spawn carried plus the 64 a namespace held, so everything one table and one namespace expressed still fits. The names are bounded by the startup block alone. - `ObjectKind::Namespace` goes and its word 8 stays unused, as `ObjectKind` says a word that goes does: `SysCap` through `DeviceSet` keep 9 to 19, `from_word` looks a word up rather than indexing by it, the SDK's census finds a kind's count by its place in `ALL`, and the SDK's receive test takes word 8 and the word past the last kind as ones no kind has. - The supervisor, whose parent is the kernel, starts holding its system capability, the file server's image, ROOT's and the boot names at the four handles `toyos_abi::boot::supervisor` states. In userland a service is a connector named `svc:<name>` (a row's `receives`, its view's `fs:` directories, minted grants) or `provide:<name>` (one a launching client sent). `endow::service` looks one up and connects; a helper is given a duplicate of each its parent holds, narrowed by `CommandExt::services_only`. Everything else is taken once by name. The supervisor gives a provided connector to a row that does not receive it without `WRITE`; swap's connector arrives with `WRITE` alone, as its one holder only connects. The supervisor adopts its own directory capabilities (`std::os::toyos::fs::adopt_services`), which no child inherits: so a storage row, whose view is empty, now starts holding no file grant, where it inherited the supervisor's whole tree. A connector a peer sent, as a session's launcher and controls are, is typed only where the kernel reported a connector (`ReceivedHandle::typed`), and an endowed one on its parent's word. std's `adopt_services` is `unsafe`, as `adopt_namespace` was: the handles it takes are its caller's word. `SYS_NAMESPACE_OPEN`'s name was the last caller of `SyscallContext::user_str`, since #1238 reads a spawn's path as bytes bounded by `MAX_PATH`. So `user_str` and `MAX_USER_STR` go. `KernelStack::heap` charged every thread two 64 KiB strings and a page for what a call copies in. It now charges, by their types, what a spawn copies in and holds where it may be preempted: - its path, name and build-id at their bounds; - its ranges; - its endowments; - the mappings of the device claims it moves, in a vector sized once at the first claim so it never grows past that. It claims nothing for another call. A block session holds a connector and no service name, so diskserver's two messages for a session's server that broke the protocol or went silent name the session by its partition GUID. #1261's `poll_belongs_to_its_handle` connects through its connector, where it opened a one-entry namespace. Kernel: 55,475 lines in 210 files at main a7ca8ad to 55,117 in 209. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…leave the kernel The kernel kept, for every process, the labels its parent put on each endowment, compared three of them (`job`, `self`, `quit`), answered them back through `SYS_ENDOWMENTS`, and held a namespace object that mapped service names to connectors behind three more calls. None of that is the kernel's: it is what one program calls a handle it gave another. Now a spawn moves a list of handles and nothing else. The child's table starts with its handle to itself (`RawHandle::SELF`), its notice (`RawHandle::NOTICE`), then the endowments in the order the spawn listed them (`RawHandle::endowed(i)`); the kernel installs them so and asserts it. What the parent calls each is a table it writes in the child's startup block, which the child's SDK checks once, whole, before it looks one up: a table that is no list of distinct, non-empty UTF-8 names ends the child, said on its `fd:2` where the table still names one. - `SpawnArgs::job` replaces the `job` label: a borrowed handle carrying `WRITE`, resolved once like the place and the pager, so the commit's re-check that the moved handle still named the job goes. - `SYS_CONNECT` (102, `SYS_NAMESPACE_OPEN`'s number) connects through a connector carrying `WRITE`, which a connector is now minted with. One without it may only be passed on. - `SYS_ENDOWMENTS` (99), `SYS_NAMESPACE_BUILD` (101), `SYS_NAMESPACE_NAMES` (170), the namespace object, `SpawnEndow`, `EndowEntry`, the label blob and its per-process charge go; the freed numbers stay unassigned. `MAX_SPAWN_ENDOWMENTS` is 96: the 30 a spawn carried plus the 64 a namespace held, so everything one table and one namespace expressed still fits. The names are bounded by the startup block alone. - `ObjectKind::Namespace` goes and its word 8 stays unused, as `ObjectKind` says a word that goes does: `SysCap` through `DeviceSet` keep 9 to 19, `from_word` looks a word up rather than indexing by it, the SDK's census finds a kind's count by its place in `ALL`, and the SDK's receive test takes word 8 and the word past the last kind as ones no kind has. - The supervisor, whose parent is the kernel, starts holding its system capability, the file server's image, ROOT's and the boot names at the four handles `toyos_abi::boot::supervisor` states. In userland a service is a connector named `svc:<name>` (a row's `receives`, its view's `fs:` directories, minted grants) or `provide:<name>` (one a launching client sent). `endow::service` looks one up and connects; a helper is given a duplicate of each its parent holds, narrowed by `CommandExt::services_only`. Everything else is taken once by name. The supervisor gives a provided connector to a row that does not receive it without `WRITE`; swap's connector arrives with `WRITE` alone, as its one holder only connects. The supervisor adopts its own directory capabilities (`std::os::toyos::fs::adopt_services`), which no child inherits: so a storage row, whose view is empty, now starts holding no file grant, where it inherited the supervisor's whole tree. A connector a peer sent, as a session's launcher and controls are, is typed only where the kernel reported a connector (`ReceivedHandle::typed`), and an endowed one on its parent's word. std's `adopt_services` is `unsafe`, as `adopt_namespace` was: the handles it takes are its caller's word. `SYS_NAMESPACE_OPEN`'s name was the last caller of `SyscallContext::user_str`, since #1238 reads a spawn's path as bytes bounded by `MAX_PATH`. So `user_str` and `MAX_USER_STR` go. `KernelStack::heap` charged every thread two 64 KiB strings and a page for what a call copies in. It now charges, by their types, what a spawn copies in and holds where it may be preempted: - its path, name and build-id at their bounds; - its ranges; - its endowments; - the mappings of the device claims it moves, in a vector sized once at the first claim so it never grows past that. It claims nothing for another call. A block session holds a connector and no service name, so diskserver's two messages for a session's server that broke the protocol or went silent name the session by its partition GUID. #1261's `poll_belongs_to_its_handle` connects through its connector, where it opened a one-entry namespace. Kernel: 56,188 lines in 212 files at main d1cefba to 55,830 in 211. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
SYS_SPAWN's path is a label its caller states; nothing opens it. It was any UTF-8 up to 64 KiB and the kernel quoted it raw in the spawn's record and in each refusal's record. A caller could therefore put a line break and a whole forged kernel record into/log(a job'sexit:among them, which a metal verdict reads), or state another program's path so that a judge searchingspawn: /system/bin/<x>took the wrong process. Each refused spawn also wrote a record, at a rate its caller chose.Closes
issues/a-spawns-record-quotes-the-path-its-caller-states.md(both parts of its exit) andissues/a-refused-syscall-writes-a-log-record-per-call-and-nothing-bounds-the-caller.md(its first shape).Resulting behaviour
toyos_abi::syscall::spawn_pathtakes at mostMAX_PATH(4096) bytes of UTF-8 every character of whichspawn_path_holds: no control character (UnicodeCc: C0, DEL, C1), the rule shapeprocess_namehas.SYS_SPAWNanswersInvalidArgumentotherwise, bounded before it copies. White space is allowed: a file name may hold a space, and the path is never a token of a record./), and nothing opens the spawn's path. SoHelper::spawnsends the path with each characterspawn_path_holdsrefuses replaced by U+FFFD, cut at a character toMAX_PATHbytes, asname()fits the process name. The ABI's rule is the one predicate both use. Such a program runs as before; only its label in the record shows the replacement.spawn: pid=N (total=Nms) <path>: the kernel's fields first, the caller's text last. With the path first, a path longer than a record's 992-byte message cut the pid off its own record; now a cut, or anything the path says, reaches nothing the kernel said.InvalidArgumentandGonesay why.ResourceExhaustedcovers depth, the pid space, an address space and a kernel stack alike, and nothing now tells them apart: this is an explicitly reported failure, which a program that cares says in its own ring under logkeeper's limit.process_tree's metal judge, which read the depth refusal's record, now holds that everyspawn:record of the boot parses as a landed spawn: red on a kernel that records a refusal.ResourceExhausted, so only where the chain stops says it was the depth bound. The job runs two below the supervisor (supervisor 0, test-runner 1, job 2), and linkkruns2 + kbelow it. Soprocess_treenow asserts the chain's last link isMAX_DEPTH - 2(62), where it accepted any stop past link 2, and a link past 62 that starts is reported as unbounded. A kernel that refuses a link early for frames, PCIDs or a miscounted depth, or admits one past the bound, now fails the guest.spawn:record's path any more:bootlog::spawned_pidreads the pid from the record's head; the source check holds it to the kernel's format string.supervisor: started logkeeper pid=N);one_clockandvirt_jobfind the kernel's record of that spawn by it.claims::job_recordstakes the job's pid from its exit record and its window from the spawn that pid landed by.===TEST_STARTline, under its registered head with nopid=. A line a job writes into the runner's ring carries one.virt_user_modeandvirt_low_ecamwait for the first spawn a program asked for;session_lifecyclefor the terminal's ownterminal: readyand a spawn landing after the command; the typedlsfor itsexit:record; the undeclared boot for the holder's own line.run_testno longer moves a spawn record that preceded the test's start marker into the window. Since the console carries logkeeper's rounds in stamp order and the runner stamps its marker before it spawns, the record is never behind the marker. A scan of 199 logs captured on 2026-11-11 (metal readbacks of both benches and harness output) finds the job's own spawn record after its marker at every one of 1508 starts (script and result in the evidence).Other caller text in kernel records was checked: a process name is one token, last words one line, a crash's frames escape the path, and thread names, namespace names and endowment labels reach no record.
Recorded, not fixed here
issues/a-capability-holders-refused-claim-or-stop-writes-a-record-per-call.md: a holder of the device or power right still gets a record per refused PCI claim, late declaration of the root bridges' memory, or stop. Not the same mechanism (those records are what device judges read), so not folded in.issues/a-judge-that-searches-a-whole-line-reads-what-a-record-quotes.md:must_say/must_not_sayand marker waits match anywhere in a line, so a quoted path can still answer them.issues/a-metal-judge-takes-a-names-lowest-pid-for-the-job.mdgains that the exit record's name is also a spawner's label.Checks
Head e91c70e. It is 6cdc1d0 plus one comment-only commit, which deletes
Admission::ask's stale claim that the log names a refusal (follow-up review). Every check below at 6cdc1d0 holds for it. 6cdc1d0 carries the review's fixes in the PR's main commit, rebased onto main f79df95 (main's new commit touches none of this PR's files). The branch merges cleanly into main at 67713cb. The fixes against 9f94ce8 arer2/fixes.diffin the evidence. Checks follow the owner's targeted-testing policy.Round 2, at 6cdc1d0 (clean tree)
Host, each exit 0:
cargo test -p toyos --lib spawn: 7 passed, among them the newa_path_label_is_the_path_as_the_kernel_takes_one. It checks thatspawn_path(path_label(p))isSomefor paths holding control characters, pastMAX_PATH, and those that grow past it once replaced.cargo test -p toyos-abi: 50 + 4 passed.cargo test --lib bootlog: 16 passed, among themthe_writers_write_the_lines_the_host_reads, whose supervisor needle is now derived fromLOGKEEPER_STARTED.cargo test --test toyos-checks: 44 passed, among themmetal_audio_judgeswith its new case: a job's line under the runner's head, carryingpid=, does not open the window.toyos-abi,toyosandtoyos-build.Negative controls, each patch checked, applied, run and restored in the same run, and the test green again after:
path_labelkeeping every character, the SDK test fails with exit 101.pid=test dropped,metal_audio_judgesfails with exit 101.That
Helper::spawncallspath_labelis one line, read by inspection; no host test reaches the syscall.process_tree's link-count assertion, on the T14 at 6cdc1d0.process_treehas no QEMU row (it needstests/images/proctreecase.toml's launcher, declaredcatand shell), so the T14'sproctreecaseboot is the only place to check it.passed.cargo test --test toyos-build -- --metal --metal-readback <dir> process_treeexits 0, "PASS process_tree, 1 passed, 0 failed, 1 boot(s)".a chain of 62 links stopped at a depth refusal (link 62: its next link was refused: out of memory) and died whole, thenprocess_tree: PASSandexit=0. At this revision the guest assertsstarted == MAX_DEPTH - 2(62), so the pass is that assertion holding.spawn:records of the boot parse as landed spawns.path_label.Metal at 9f94ce8 (the T14, judged by the orchestrator from a clean worktree)
cargo test --test toyos-build -- --metal --metal-readback <dir> abuse_spawn_path_and_name process_tree hda_tone hda_tone_resampled tone_beside_a_log_write claim_reuses_its_remapping_entry i219_messages_on_its_msi_vectorexited 1: 6 passed, 1 failed, 2 boots.abuse_spawn_path_and_name(shared member)process_treespawn:record fails to parse; the chain stopped at link 62hda_tonehda_tone_resampledtone_beside_a_log_writeclaim_reuses_its_remapping_entry00:1f.6: irte3 written by both claims, not present after each release, throughclaims::job_recordsby pid)i219_messages_on_its_msi_vectortest_rs_i219_msi exited 1The i219 red is the job's own exit, before any judge this PR touches, and the PR changes no NIC, interrupt or network code. Its lines repeat the signature recorded in
issues/i219-msi-passes-only-when-the-network-sends-it-a-frame.md: "no frame arrived on a message under traffic", and "the MAC saw 0 frame(s)".one_clockheld on both boots: the kernel'sspawn: pid=3 (total=0ms) /system/bin/logkeeperandsupervisor: started logkeeper pid=3are at the same millisecond.The round-2 changes to the audio judge (start line without
pid=) and toclaims(none) leave these verdicts as they are. The readback's 13 runner start lines carry nopid=.Round 1, at cafb947 / 9f94ce8 (still valid)
cargo run -- --ci hostat cafb947: 108 of 110 steps green, including the kernel's library, the models and clippy. The red steps were the known macOS llvm test (issues/the-llvm-environment-test-breaks-git-on-macos.md) and the workspace host members, whose files vanished under a concurrent build. The kernel is unchanged since then.spawn_path,a_spawn_path_is_one_bounded_linefails with exit 101.session_lifecycle,a_usb_key_reaches_the_console,a_claim_before_the_declaration_is_refused_at_once), 3 passed. 43030459072, aarch64 (virt_user_mode,virt_low_ecam,virt_first_entry), 3 passed. Round 2 changes nothing these rows run but the SDK's path label, which every spawn they make passes through unchanged.Evidence: https://github.com/ToyOSOrg/evidence/tree/01e8615713ba3af85f7a6f666caf783f3e284689 (
README.mdmaps each file to its command, revision and exit code).Risks
issues/quote the old order as history. A later change that adds kernel fields to the record (stage timings, say) must updatebootlog::spawned_pid, the source check's needle and the fixtures together, orprocess_tree's metal judge reads its records as spawns that did not land. Kernel fields go before the path.claims::job_recordsinherits the lowest-pid-by-name rule the pid-reuse finding records.run_test. Its deleted move can change a window only when a job's spawn record precedes its start marker, which the scan never finds, and no QEMU judge reads aspawn:record from a test's window any more. The nightly matrix runs the rest.process_treenow holds the job's depth to 2: test-runner is one of the supervisor's programs and spawns each job itself. A runner started deeper, or jobs launched through another process, would fail the assertion with the link count it saw. That is a loud failure, not a silent pass.🤖 Generated with Claude Code