init: /protocol replaces the ServiceId registry
A protocol is reached by name now, not by a compile-time integer. Init is PID 1 and already knows which binary it started, so init serves /protocol as a vfs backend: bind claims a contract with the provider's endpoint attached, open answers with that endpoint as the reply's capability, and readdir lists what is bound with the task and binary behind it. The kernel reserves the prefix — nothing may mount over it, under it, or unmount it — and ServiceId, ipc_register and ipc_lookup are gone, their syscall numbers left vacant. A bind is authorized by who the caller *is*: the kernel-stamped binary together with the supervising task's identity, matched against /system/configuration/protocol.csv. Identity, not spelling — spawn is ungated, so an attacker can run any bundled binary, and a name-only rule would have let it launder grants through an init of its own making. A name a live process holds is refused to everyone else; a dead one's is released. Three review rounds against a hostile ring-3 process found what 108 green tests could not, because the suite contains no attacker. Publishing init's supervision endpoint as the registry put PID 1's mailbox in every process's hands, where two forged bytes reached the shutdown path: privileged traffic is now believed only from the task that holds the contract it speaks for. A capability arriving on a request outlived every path that ignored it, one handle per call until the table was full — in init, and in the harness ten services share — so the arriving capability is owned by the turn and released unless a handler says otherwise. And the kernel let anyone holding an endpoint handle aim signals, timers, exit notices and interrupts at it: binding now requires having created it. Suite 108/108. The new protocol-registry case asserts eleven properties, each one an attack that must fail.
This commit is contained in:
@@ -846,6 +846,33 @@ CASES = [
|
||||
{"name": "input",
|
||||
"expect": r"DANOS-TEST-RESULT: PASS",
|
||||
"fail": r"DANOS-TEST-RESULT: FAIL"},
|
||||
# The protocol registry (docs/os-development/protocol-namespace.md): init serves
|
||||
# /protocol, and the fixture drives the registrar's whole contract — an ungranted
|
||||
# bind refused (-EPERM), the kernel's reserved prefix holding against mount and
|
||||
# unmount, a live owner's name refused (-EBUSY), and a killed provider's channel
|
||||
# failing while a re-resolve reaches the restarted instance. Each step prints its
|
||||
# own line, so a failure says which rule broke, not merely that one did.
|
||||
# Three of the steps are the registrar's security contract, and each fails
|
||||
# catastrophically rather than quietly if it regresses: a forged power event
|
||||
# posted to PID 1's mailbox must not shut the machine down (a regression ends
|
||||
# the boot), capability-carrying zero-length pings must not consume PID 1's
|
||||
# handle table (a regression makes every later bind impossible), and a granted
|
||||
# binary spawned by an unauthorized task must be refused while the same binary
|
||||
# spawned by an authorized one is not (the laundering deputy).
|
||||
{"name": "protocol-registry",
|
||||
"expect": r"(?s)(?=.*protocol-registry: ungranted bind refused)"
|
||||
r"(?=.*protocol-registry: /protocol reserved)"
|
||||
r"(?=.*protocol-registry: forged power event ignored)"
|
||||
r"(?=.*protocol-registry: capability-carrying pings did not exhaust the registrar)"
|
||||
r"(?=.*protocol-registry: collision refused)"
|
||||
r"(?=.*protocol-registry: dead channel refused)"
|
||||
r"(?=.*protocol-registry: restarted provider reached)"
|
||||
r"(?=.*protocol-registry: laundering deputy refused)"
|
||||
r"(?=.*protocol-registry: foreign signal binding refused)"
|
||||
r"(?=.*protocol-registry: foreign timer and exit binding refused)"
|
||||
r"(?=.*protocol-registry: capability-carrying pings did not exhaust the harness)"
|
||||
r"(?=.*DANOS-TEST-RESULT: PASS)",
|
||||
"fail": r"DANOS-TEST-RESULT: FAIL|protocol-registry: FAIL"},
|
||||
# Device manager: a ring-3 service enumerates /system/devices, matches the PCI host
|
||||
# bridge to pci-bus, and spawns it — end-to-end proof of discover -> match -> spawn
|
||||
# -> driver-up (the spawned pci-bus logs "<N> functions found").
|
||||
|
||||
Reference in New Issue
Block a user