notes

A frame per filesystem client channel: the fork

Written 2026-09-26 (UTC) by lane milestone/fs-client-page, for milestone 599 (a frame per filesystem client channel), whose number is provisional. The block is design/roadmap/0599-a-frame-per-filesystem-client-channel.md. The file name is a lane's coinage and provisional.

What is being decided: how the file server learns which client's frame a request's bytes are in. Every way to give each client its own frame runs into that question, and every answer the tree could build either changes the kernel's endpoint semantics or adds a protocol. That makes it calef's, so the lane stopped here instead of building one.

What is blocked until it is answered: all of milestone 599's wiring, and through it milestone 47 (navigation and naming)'s set grant at the prompt (rm *.txt), which names this as its prerequisite in notes/a-set-grant-at-the-prompt.md. Nothing else is blocked. The witness test can be built before the ruling, because its attacker is the same under every option.

Why the proposal's one-line fix does not work on its own

The proposal (case A of shared-page-audit.md) says to allocate the frame "in spawn_fs_client / start_granted* / narrow_dir rather than in ensure". That fixes the client side only. The server is the other holder of every channel, and it:

So if two clients each had a private frame, the server would read one window, and there is nothing in a request that could tell it which frame to look in. A per-client frame the server can read needs one of the mechanisms below.

The premise, checked

It is true, and it is a correctness bug and a confinement one. Honest clients race too: a client stages its name or data in the page and then calls, so its use straddles the call. While the server is blocked on the block server serving someone else, a second client's staging lands on top. The tree already designs around this. notes/pipes/the-file-end.md is why the shell backs a > redirection itself rather than handing it to a process: "two client processes using it at once race", and ls > out.txt would corrupt both. Today's safety is that the shell keeps one FS client active at a time. A set grant at the prompt would run a checking caretaker beside the shell's own > writer in one pipeline, which is two active clients by construction.

Not yet verified by a run: that the substitution lands on a real boot with two live clients. That is the witness test's job, and it is the next piece of this milestone either way.

What the tree does in the analogous cases

The options

All costs below are computed from constants in the tree, not measured on a boot, except where a benchmark note is cited. The per-channel figure is the same under A, C and D: one channel is file_system::TRANSFER_PAGES = 16 pages, 64 KiB of physically contiguous memory per concurrent client, where today the whole boot shares one 64 KiB channel. A directory job's region is DIR_JOB_REGION_PAGES = 96 pages (384 KiB), so carving the channel from the job's own region adds about 17% to it.

A. Badged endpoint capabilities (seL4's answer)

A derived endpoint capability carries a badge word the kernel delivers to the receiver on RECEIVE_CAPABILITY. The server maps K windows and reads request b from FILE_PAGE + b * TRANSFER_MAXIMUM. The progenitor holds a pool of K (badged endpoint, frame) pairs and hands one to each caretaker chain, taking it back at reap.

B. The kernel moves the server's window to the caller's frame at the rendezvous

An endpoint capability is bound, when it is minted, to the caller's channel frame. At CALL, the kernel remaps the receiver's FILE_PAGE window to that frame before the server runs. This is classic L4's receive window for map items (recalled from memory of the L4 X.2 and Fiasco specifications, not read for this note), which seL4 did not keep.

C. No kernel change: private client frames plus a staging token

Each confined program gets a private frame shared only with its caretaker. The caretaker copies a request into the server's page and the reply out of it. It holds a token (a rendezvous used as a lock) from before staging until after the copy-out, so no two writers of the server page overlap.

Refused

Reversibility, and who has acted on it

A and B change the system call surface, which every future program is written against: the expensive side of the line. C is reversible in code but adds a cross-program convention that is not. Nobody has built against any of them. The network-stack proposal is waiting on the same question in A's form. Per the rule for irreversible forks, this note gives options not a recommendation.

The ruling, and what it left open

calef ruled option A on 2026-09-26, and the mechanism is built (milestone 599's block). The production progenitor hands every client window 0, and wiring it raises a second fork.

The progenitor's pool: the fork

What is being decided: how the progenitor gets each client its own window's frame into the client's address space. address_space::MAP_INTO maps a frame the caller holds a capability to, and it maps the whole run that capability names. So today the progenitor needs one frame capability per window.

The constraint is the progenitor's capability table. CAPABILITY_TABLE_SLOTS is 24 and CAPABILITY_TABLE_PEAK_MEASURED is 23 (milestone 590 (the booted system starts its network stack), 2026-09-24), reached during the login block. That constant's own doc says the next permanent capability "should buy a slot back rather than spend the last one". Holding the seven extra windows' capabilities permanently needs seven slots that do not exist. So every option below must cost the progenitor zero permanent slots.

Transient slots are different: a caretaker is built at the prompt, after the login block's peak, so per-client transients land below it. That is an estimate from where the peak is recorded; script/swish-check is what would confirm it.

What is blocked: only the production pool, and through it milestone 47 (navigation and naming)'s set grant.

1. A wider table

Raise CAPABILITY_TABLE_SLOTS from 24 to 32 and hold the seven window capabilities permanently.

2. An untyped the progenitor retypes per client

Hand the progenitor an untyped; per client it retypes a fresh 16-page frame run, maps it into the client, and passes the server a capability to it.

3. Mapping by physical address

Let the progenitor map a physical address it was told, with no frame capability.

4. One run capability over the pool, sliced per client (found)

Give the progenitor one PageFrame naming all K windows as one run, in the slot fs_page holds today. A new method derives a capability naming one window; the progenitor slices window w, maps it into the client with MAP_INTO, and deletes the slice.

One capability does cover the pool, and the 24-slot problem goes away with it: net zero permanent slots. The run half needs nothing new. The kernel already mints run capabilities (run_cap, §102 is built), and calef's 2026-09-26 ruling that MemoryRegion::RETYPE takes a page count (#1373) gives a region the same power. What does not go away is handing a client only its window. MAP_INTO maps a capability's whole run, and the whole pool in a client is every client's window, the original bug. So one operation is still owed, this slice or option 5's offset, and neither §102 nor #1373 provides it.

5. MAP_INTO with an offset into a run (found)

Same single run capability as option 4, but MAP_INTO itself takes a page offset and count, packed into its third argument beside the map kind.

6. A window broker (found)

A small process holds the K window capabilities in its own table (eight fit easily; it holds little else). The progenitor holds one endpoint to it, in fs_page's slot. Per client it asks for a window, receives a frame capability with SEND_CAPABILITY, maps it, and deletes it; at reap it tells the broker the window is free.

Refused

Costs side by side

Option Permanent slots Per spawn Memory Surface
1. Wider table +7 (of 8 added) nothing 64 KiB, every thread table size, FAULT_EP_SLOT
2. Retype per client 0 1 attach rendezvous 64 KiB per client wire verb
3. Map by phys 0 nothing none system call
4. Sliced run 0 2 system calls none extra new PageFrame method
5. Offset in MAP_INTO 0 nothing none extra method argument shape
6. Broker 0 1 call round trip about 32 KiB, once two-program protocol

Recommendation, and where it stops

Options 2 to 5 touch the system call surface or a wire format, so under the rule for irreversible forks this note gives them as options, not a recommendation. Between the two that do not, 6 over 1: 1 spends 64 KiB and the table's headroom on every thread in the machine to fix one process, which is the representation §102 already refused.

Would we choose 6 if 4 cost the same? No. Option 4 has fewer moving parts and is the shape §102 describes; 6's case is only that it avoids new system call surface. The question for calef is therefore one method: a PageFrame slice (4) or a MAP_INTO offset (5). With either, the pool is one capability and the slot problem is gone.