Repository navigation
feat(minvmd): decide the host gate's frames with a verified kernel (netcore) - #3869
Draft
bryan-minimal wants to merge 10 commits into
Draft
bryan-minimal wants to merge 10 commits into
bryan-minimal wants to merge 10 commits into
Conversation
…space crate The host-side network gate's decisions move to a formally verified kernel, netcore: pure functions over owned data with no I/O, no clock and no dependencies. This commit adds the crate (its source, manifest, README and axiom registry) and wires it into the workspace. No code in the workspace calls it in this commit, and it carries no statement lock and no Verus or Kani lane. Wiring: the member and the path entry in the workspace manifest; the workspace's check-cfg lists cfg(verus_keep_ghost) beside cfg(kani), so the crate's proofs compile away quietly on a normal build; minvmd depends on it; the lock entry. netcore joins the leaf layer in metrics/layers.toml (every member must have one), the session plane in docs/architecture.md, and the committed metadata fixture the layers test reads. The crate's source, 29 files, sha256 (first 8) of each file in src: alias 19570962, answer 59f852ae, cohort 3e26d4d8, dnsa d3075c2a, dnsq 2c3937db, finish e83b9381, flow f91f48f6, frame a0efe4f3, gate 23e6a5d8, ingress af667382, isolation 281d091f, judge 6b17cc71, ledger 489be280, lib 7420e55d, node ad2de630, notes 68407e30, origin 417a4c36, pins 50338bef, plan ef243e9f, policy e5619e99, pool e60aa9ad, rebind f557c82d, report 0765e790, route 4fc12f5e, row 5175895b, slab 20ddb865, split 9db422e7, sweep 95389a5a, time 45291540. The axiom registry: ddce3c82. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…i lanes The kernel's statements are locked apart from their proofs, so a change to what netcore claims is a diff in a file its owner reads. crates/netcore-lock holds the two locks and their scripts: STATEMENTS.lock, the crate's claims as text (contracts, specification and proof signatures, the assumption and control rows, the pinned count), and VIEW.lock, the verifier's own account of each function, digested from the run's dump; statements.py and view.py check each, and statements_selftest.py holds the attacks both must catch. The kernel's negative controls are one file, controls.toml: each is an edit to the crate that Verus must reject, with the functions it must fail in and the run that showed it. controls.py checks the file against the crate, and the lists in crates/netcore/verus, one per module, are generated from it with the results they cite. scripts/verus.sh runs Verus over netcore at the pinned release and resource limit, expects its verified count, checks both locks against the same run, and then checks the control file against the crate. .github/workflows/ci-verus.yml runs it, path-scoped to the crate, its lock and the lane, as an advisory lane. netcore's Kani harnesses run beside the existing lane in .github/workflows/ci-kani.yml: scripts/kani.sh netcore runs the crate's default set, 112 harnesses, four at a time in its own job, and scripts/kani.sh netcore-heavy runs each of its three heavy harnesses (behind the kani-full feature) one to a job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e box registry The verified kernel decides a frame against a configuration that changes only through its own operations. The box registry now holds that configuration and keeps it in step: every write section that changes a row or a resident host_ip box makes the matching change in the configuration before it ends, with the configuration's lock taken inside the row lock or the resident set's lock and never the other way round. - a row's rules come from the policy it is registered with, after defaulting, read into the kernel's declaration; entries the compiled rules drop (an IPv6 block, a prefix past 32, an entry that cannot be read) are not enforced here either; - a row's names are numbers from the kernel's interner, and a row the kernel cannot hold is refused before any row changes; - the resident host_ip boxes are the kernel's members, in session order; - the alias holds Minimal's own listeners' ports, the answerer's and the Box Egress Proxy's, from the moment the configuration is made, and the node row's hostname proxy ports; - the node's baseline reaches the kernel as its IPv4 blocks, checked against the product's own count, and every prefix a switch subnet accepts is one the kernel plans. A change the configuration cannot follow is counted, logged as an error and repaired in the same section by rebuilding it from the registry; the tests assert the count is zero and compare the live configuration with one built from scratch. A registration or admit whose policy declares a subnet the gate does not enforce is said once for each policy in a warn line naming the box and those entries. Nothing is refused. The kernel decides nothing yet. A test runs each frame of a table through the relay and through the kernel, by the configuration the registry keeps, and asserts the two decide alike except at the differences written down beforehand, each asserted as a difference; the zone-question reading's cases are among both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The kernel's alias state now holds the host exposures as well as Minimal's own listeners and the node's baseline ports. The gate reads the exposure table where it always has, on a frame to the host alias, at most once a second, and hands the list it read (with ports Minimal's own listeners hold left out) to the kernel's configuration from there: no poller. The box table carries the configuration, and the hand-over takes its lock alone, with no registry lock held: for reading to see whether the list is the one already given, and for writing only when it is not. A removed entry, or one a listener comes to hold, gives a new list, and the next frame to the alias hands it over, so the port closes. Only a frame to the alias asks whether the alias is open, and every such frame whose answer depends on the exposures refreshes the list before that answer is used. The gate still decides every frame by its own path; nothing reads the kernel's answer yet. Tests: an entry written to an exposure file opens the alias at its port for the kernel's arm, and its removal closes it; when the node's row comes to hold an exposure's port, the next frame to the alias closes it for the kernel too; an exposure pushed at a port Minimal's own listener holds stays closed for the kernel's arm in a configuration just made, while one at another port opens; the in-step helper checks the alias's hostname-proxy ports against the node row the registry holds; the decision test's table gains the alias at an exposed port, admitted on both sides for the rows that name the host and refused on both for the others, beside the alias at a port with no exposure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both relay legs ask the kernel's configuration once per frame and act on its answer: egress_first for a guest's frame, ingress_first for a frame toward a guest, and a frame to the host alias again on a configuration that holds the exposure list it read. The configuration's read lock is held only around that call; the answer is copied out and the lock released before any registry or table is read. The decisions taken from the kernel here are stateless and take no time; the rule that a frame is decided at one instant comes with the kernel's tables, in a later change. A frame to the host alias is asked again, at most three times, while the configuration holds an exposure list other than the one the frame read; when every round finds another, the frame is dropped under the rule "internal", with a rate-limited line naming the alias as its destination, and nothing is recorded. A frame to any other address reads no list. The answer for a guest's frame carries the generations of the registry records it was made for: the row at the source, and the resident host_ip boxes' record. The resident host_ip boxes' members and their record's generation change in one write of the configuration, so no frame is decided on new members under the old record's generation. The gate reads the records the registry holds (the boxes' record only for a marked frame from the node address) and asks again once when one is another; when the second answer is for another record too, the frame is dropped the same way. The reply and refusal lookups, the DNS-admission lifts, the relay's mark of the row it carried and the recording of a DNS question all use the records the answer was made for, and an older record never replaces the DNS table a newer one holds at the same address. A frame that meets the configuration's lock poisoned by a panic is decided on nothing: it is dropped under the internal rule in either direction, with a rate-limited line naming the cause, and nothing is recorded. The registry's write sections go on taking the lock, so registrations and withdrawals keep the configuration in step with the registry. On the guest-to-switch leg: a frame that is not one, or whose first fragment lacks a whole transport header, is dropped under the kernel's rule; then a query a row or cohort that names nothing may not send is dropped under the deny-all DNS rule, with no table asked; then the reply and refusal lookups, for the source's row; then the arm, with the DNS-admission, alias-by-name and box-name lifts, the node's pin lift for fetch-shaped frames and the cohort's pin lift. Toward a guest, a short transport header is dropped and recorded nowhere, with a line of its own: the destination named as the destination, the ingress rule, and a rate window per destination and rule. Toward a guest, bytes that are not a frame (too short for their header, an ARP packet of another shape, an IPv4 header with a bad version, header length or total length) are dropped and nothing is recorded, under the rule for bytes that are no frame, with the same line naming no destination. Ports, flags and DNS datagrams for the daemon's tables come from the kernel's facts, and a delivered frame is recorded in the reply tables only when the kernel's configuration names its destination as a row's and the registry holds a row there. A gate decides by the node-plane baseline it is spawned with: spawning it gives that baseline to the kernel's configuration before the gate accepts a connection, with no registry lock held, so the gate's pin lift, its exposure reads and the kernel cannot disagree. Tests that check the configuration without a gate give it a baseline through the box table, as a gate does. The deny-all DNS line names the queried name and type, read for the line only, and prints "<unparseable>" when the payload cannot be read; when the question is inside the box zone, or there is none, it says the query is not a plain question for a box-zone name. A cohort's refused query is said with its name and type and no namespace, its window keyed by the node address and the name. A frame with no ports prints no port field in its drop line. The warning for subnets the gate does not enforce adds one clause when what is left of the policy names nothing the gate enforces, no enforced IPv4 subnet allowed and no DNS host declared: the box reaches only names in the box zone through the resolver. That reading restates the condition the kernel refuses a row's or the cohort's DNS query by; a check holds the two together over a table of policies, for a row and for a host_ip box, with and without a lane, through the kernel's arm. The box zone's apex in wire form is one constant, checked against the zone's name. The old readers and deciders are removed: row, node, cohort and gate verdicts, the alias openings, the infrastructure ranges, dns_pins' frame parsers and deny-all check, and HostExposure::admits, which nothing calls. The decision test keeps its table as literals, asserted against the kernel's rule and against the new decider called whole; the relay column of its named differences is literal, as the relay decided before the kernel did, the zone-question reading's cases included. Each behaviour change has a named unit check, and the test frame helper builds whole frames. Two tests are restated: a zone query of two questions passes written out with plain labels and is refused when encoded with a pointer, and a row that names nothing reaches the resolver only with a zone question. Checks added: a refused query attributes and carries nothing; an answer toward the node address for a host_ip box's question fills the cohort's pin; the cohort's refusal line names no box; the ingress drop's line; a gate spawned with the in-force baseline refuses the node's frame to an unpinned address; a task row does not take its box's credentialed lane. Checks through the gate's entry points: a short transport header or bytes that are no frame, toward a guest, leave no reply-table entry and no pin, beside the same frames whole, which do; a fragment that is not the first is decided with no port, and the host-alias line of an ICMP frame and of such a fragment prints no port; a row that names nothing is refused a query for the zone's apex of any type, and its query is read to the end of its counted questions and not past them. Through a test-only seam: a frame to the alias whose every round finds another list is dropped with its line while the same box's frame elsewhere is decided as usual; a row registered again between the answer and the read gives the frame the new row's arm and the new row's pin, and a row that changes after both answers drops the frame; a marked frame from the node address is dropped when the host_ip boxes' record changes after both answers; the relay's mark goes only to the row a frame was decided for; an older record gets no DNS table where a newer one's stands; and on the relay, a row registered again right after the verdict on a box's DNS question is not marked carried by that frame and is not given the question, so the answer pins nothing for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e and the cohort The network kernel's configuration now holds each registered row's three tables (the reply records, the refusal notes and the DNS tables), made empty by the kernel's own constructor when the row is registered, made empty again when it is registered again or at the end of a relay that carried it, and dropped with the row. The node's tables and the cohort's DNS table stand beside them, the cohort's owned by the address the cohort sends from. Nothing reads or writes the tables yet. The limits are the gate's existing capacities and windows, with TCP's closing windows of 120 s after the first FIN and 10 s after the second or a reset, and room in a box's DNS table for a name's quota of admissions for each name it declares. A registration declaring more DNS hosts than a table holds room for is refused before anything changes, with a line naming the count and the most. Each table set keeps the names its DNS table numbers: the box's declared DNS hosts, normalized as a question is matched and each kept once, a name's number its position. The node's are its baseline's endpoint names in the baseline's order; the cohort's are its members' names together, normalized and sorted. A rebuild keeps a row's reply records and notes only for the registration they were made for, and its DNS table only while its names are also numbered as before; a row registered again since then starts with empty tables, and so do tables whose lock was poisoned. The cohort's DNS table is kept while its names are numbered as before; the node's tables are kept, with the baseline's endpoints, so that the same baseline adopted again keeps the node's DNS table. A DNS table that cannot be made with room for every name is made empty at the largest size, with an error line saying names past its room are refused for room. The node's DNS table is kept when its baseline is adopted unchanged: in force or not as before, the same endpoints as given (its names and its blocks) and the same names. Otherwise it is made empty again, so no address admitted under an old allow list outlives a change of blocks. Node tables whose lock was poisoned are never adopted: the node gets empty ones. The in-step check now also asserts that exactly the registered rows have tables, each owned by its row's address, that the node's and the cohort's are owned as the configuration says, and that the node's row declares no DNS host (the node's names are its baseline's while the baseline is in force). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The kernel's tables record what the daemon's own tables record, beside them. The daemon's own tables decide, and nothing the kernel's tables say changes a decision or a frame. A frame or a DNS exchange whose kernel table's lock was poisoned by a panic is not recorded, with a debug line; nothing is touched, and the frame goes on as the daemon's own tables decided it. A frame toward a guest, once it has its slot in the queue, is recorded by the kernel's own reading in the tables of the box it is for. The record comes before the daemon's own two refusals (the proxy's opening packet, a flow at the box's cap), and the kernel's observation refuses the same two by its own contract, so neither side records a frame the other refuses. A DNS question a guest sent, once the switch's queue took it, is recorded in the DNS table the kernel routes its source to (a row's, the node's or the cohort's), under the name's position in that table's list: the name as the resolver library reads it, the id from the header, the port from the kernel's reading. Only a question the daemon's own table records is recorded: one addressed to the plan's resolver at UDP 53, within the existing size bound of 4,096 bytes, read whole by the library, with the response flag clear. The operation code is not read, as the daemon's own table does not read it. A DNS answer toward a box is taken only from the resolver's address at port 53. It is read by the kernel's answer reader, its addresses passed through the kernel's floor first, and offered to that box's DNS table, or at the node's address to the node's and then the cohort's, each under the asked name's position in its own list, compared in wire form, with the rules the existing check reads: a row's own, the baseline's blocks for the node, the resolving members' allowed subnets for the cohort. The cohort's answer goes through the kernel's answer step with its DNS table standing in the node's tables for the one call, put back on every path, and only while the cohort sends from the node's address. Each kept name list carries its names' wire encodings; a declared name that cannot be encoded matches no answer and is said once at registration. Where a publication is retracted and no other applied publish still dials its inside port, the reply records that port earned are ended in the kernel's tables in the same step as in the daemon's own, for the same box, protocol and port: an applied unexpose, a publish the switch refused, the unbind pass at a row's withdrawal, a waiting forward whose bind failed, and a mirrored bind the node forgets. At the node's address the node's tables are ended as well as its row's. The kernel's tables are reached there through a handle that holds the configuration alone, so the mirror ledger the box table keeps holds one without a cycle; tests that drive the retraction paths with reply tables of their own have a co 8000 nfiguration of their own too. Checks: at the relay, a question to another host's port 53 is not recorded and an answer from another address's port 53 admits nothing in either table, while the resolver's exchange right after admits in both; a question past the size bound is not one the gate records; an answer naming the plan's own block admits nothing; an unchanged baseline keeps the node's DNS table and a changed one empties it; an equal host_ip readmit keeps the cohort's DNS table, through the registry and through the relay, and a readmit with other rules empties it; a question meeting a poisoned table is not recorded (a_question_meeting_a_poisoned_table_is_not_recorded). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…by the kernel's tables Both legs of the gate decide on the network kernel's tables, in one step. The egress leg asks the kernel's configuration for its whole decision on each frame a guest sends: egress_first, then for a frame it routes to a row, the node or the cohort, that kind's finish step on the box's own tables, all under one read lock with the box's tables locked inside it in this order: the cohort's DNS table, then the node's tables, then a row's tables. A reply on a live record, the refusal of a noted connect, the arm and the lifts the arm allows are the kernel's, on the records the kernel keeps, turned into the gate's drops and admits. Bytes that are no frame, a short header, a stray source and the DNS refusal of a row or of the cohort are egress_first's drops. A frame to the host alias is decided only on a configuration that holds the exposure list the frame read; when it holds another, nothing is decided and no table is touched before the list is handed over and the frame asked again. When every round finds another list, the frame is dropped under the internal rule and recorded nowhere. Each frame is decided at one instant: the kernel's clock is read once for the frame, before any lock, and that reading is the one every decision and every write to the kernel's tables on the frame takes, on both legs: the egress decision and its second ask, the record toward a guest, the answer and the question. The daemon's own tables, the rate limiter's windows, the forwarded-flow table and the exposure table's file check keep their own clocks. A decision stands only for the registry records it was made for, which the kernel's configuration names by their generation under the decision's lock: the row at the frame's source, and for a marked frame from the node address the resident host_ip boxes' record. When the record the registry holds there is another one by the time it is read, the frame is asked again once, at the same instant; when the second decision is not for the records held either, the frame is dropped under the internal rule, with a line naming the cause. Nothing is recorded in the tables of the row now at the address. A frame asked again has been decided once already, and what that decision wrote stays where it was written. For a row those are the tables that left the configuration with it. For a frame from the node's address they are the node's own reply records, notes and DNS table, at the same instant; a refusal that consumed its note on the first decision is not admitted by the second. What the relay records for a frame after its verdict is recorded for the records it was decided for: the carry marks that row alone, and the kernel's DNS table records the box's question only while its row, or the cohort's record, is the one the frame was decided for. A drop line names the box only while the row at its address is the one the frame was decided for, and a line about a frame toward a guest only while the row at its destination is the one whose tables recorded it; otherwise it names no box. From this commit a frame that meets a lock it is decided under poisoned (the configuration's, its box's tables', or the node's for a frame from the node's address) is dropped under the internal rule with that cause, on either leg, and no table is touched; a question meeting a lock poisoned after its frame's decision is not recorded, with a debug line. Behaviour change: the gate reads DNS only from whole datagrams. A question is recorded, and an answer read, only from a datagram that is not a fragment with more to follow; a first fragment of a question or of a reply is decided and delivered as any frame is, and the kernel's DNS tables take nothing from it. One reader of the frame's UDP payload serves both legs. A frame the finish step calls misrouted, or a routed row that holds no tables, is said in an error line, counted and dropped under the internal rule, its line naming the cause. That arm is a broken invariant, not a case: tables exist exactly while a row holds its address, and the in-step check asserts that every registered row has its tables and that nothing was misrouted, so no test takes it. The gate's four causes for a frame it cannot decide (an exposure list that changed in every round, records that changed after each decision, a lock poisoned by a panic, a misrouted frame) share one drop and one line shape. On the switch-to-guest leg the kernel's tables decide delivery. The box egress proxy's opening packet toward a published port and a new flow at the box's reply-table cap are dropped, each with its existing line; a frame that meets another box's tables is dropped and said as an error; everything else is delivered. The holder counts the refusals at the cap for each box, and the lines about a record (one opened, the box's first, the table's first fill, records ended) are said from the kernel's tables, with their existing text, levels and rate windows. The daemon's own reply, refusal and DNS tables are asked by neither leg's decision, and are marked unused outside tests where nothing else asks them, until they are deleted. The reply tables keep their records of what was delivered, and say nothing; the DNS table keeps its records of questions and answers and says the DNS lines but one: the at-capacity line, that the box's flow table is at its cap, and its counter are not said in this commit, and return in the next from the kernel's decision. A withdrawn row's records are said in one debug line with their count. The gate's tests set their state up, and read their counts, in the kernel's tables, by the calls the relay makes. The box's FIN gives its record the closing window and does not remove it, so the box's frame behind the FIN passes. Through the relay: at a cap of two, the dial after a conversation both sides finished is delivered and answered, and the further dial at a table holding no finished conversation is refused with the cap's line and counted; three conversations in a row that both sides close are all delivered; the box's last acknowledgement and a retransmitted FIN pass after both FINs; the box is heard after the client's reset; a full table gives a finished conversation's place to a new dial at once and keeps an unfinished one; a row registered again holds no record; a box whose tables' lock was poisoned has its next frame dropped under the internal rule while another box's is decided; a row registered again whose restate the configuration refuses is rebuilt with empty tables, so a reply on the earlier registration's flow is not admitted; the proxy's opening packet is dropped and said; a frame meeting another box's tables is dropped and said as an error; each leg reads the kernel's clock once a frame, counted in test builds, and a frame asked again costs no second reading. A frame whose row is registered again between the decision and the read of the row is decided by the new row's arm and its own kernel tables, and dropped under the internal rule when the row changes after both decisions; a marked frame from the node is dropped the same way when the host_ip boxes' record changes after both; after a verdict, a row registered again at the box's address is not marked carried and its DNS table does not take the box's question. The first-inbound-flow line names the box as namespace=<name>, unquoted. DNS, through the relay: an answer with another id, one toward another port, a second answer to a question already answered, a box-zone name answered with another box's address, an answer the kernel's reader refuses, and an undeclared name's answer each admit nothing; an answer addressed to another box admits for neither; an unmarked node query for a member's name admits no cohort frame; a datagram the box sends its resolver with the response flag set is not recorded, so the resolver's later answer admits nothing; a rebinding answer's refused addresses are admitted nowhere and said under their rules; an address past the admission table's room is not admitted; at the DNS flow capacity a frame passes on the window with no flow recorded. At the holder's explicit instants: an admission past its window, a question past its expiry, a refusal note past its window and an expired DNS flow each give up their place; a member change empties the cohort's questions; the node's baseline names admit only their own answers, at most 32 addresses a name; a box's DNS table refuses the 17th outstanding question for room, holds names times 32 addresses, and records the 4,096th flow and passes the next frame on the window with no flow. DNS fragments, through the relay: a reply split in two, whose first fragment holds the whole answer section, is delivered and admits nothing, and the same reply whole admits; a question sent as a first fragment with more to follow reaches the switch and is not recorded, so its answer admits nothing. The test a_udp_datagram_gives_the_payload_this_frame_carries becomes a_whole_udp_datagram_gives_its_payload_and_a_first_fragment_gives_none, with the reading it asserts. Checks of the recording the kernel's tables took on in the commit before this one: a baseline naming more names than a DNS table holds room for gives the node the largest table, said in an error line, and the name past its room is refused for room; a reply the switch-to-guest leg drops, a first fragment from the resolver's port too short for its UDP header, offers nothing, and the question it left outstanding is answered by the whole reply after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The lines about a DNS answer toward a box come from the kernel's tables, which decide, matched by address and with their existing text, levels and rate windows: each refused address under its rule (an address the floor removed under the rule the check gives it, the rest by its fate); the node plane's pin and re-pin lines, naming the baseline entry by its categories; the box's first-fill line, once for its tables; the window's debug line; and an answer too large or unreadable for the library. A box's admission table holds its names times the per-name quota, so every refusal for room is one at the name's quota: it is said under the existing per-name cap line, with its text, level and fields, and counted for the box. The lines about a box's DNS question come from the kernel's tables too, with their existing text, levels and rate windows: a query too large or unreadable for the library, sent to the resolver's port at the switch's address by a box whose table holds names, and a question the table did not record for want of room. A question the kernel's table does not record because the row it was decided for is no longer at its address is said in a debug line of its own, naming the question and no box, and is not counted. A question is recorded, in the kernel's table and the daemon's own alike, only when the gate records it: within the existing size bound, read whole, with the response flag clear. A question or an answer that meets a lock poisoned by a panic is not recorded, with a debug line, and none of these lines is said of it. The line that a box's DNS flows are at their capacity is said from the kernel's decision, once a minute for a table at most, with the per-table count of frames so admitted. It is read under the decision's lock: a frame with ports, not a closing segment, admitted on the window with no flow at a full flow table. A DNS line names a box only while the registry holds the record the frame was decided for, or the record whose tables took the answer; when the row at the address is another one, a refusal is said naming no box, and a line about the box's own state is not said. The daemon's own DNS table keeps its records of questions and answers, and decides and says nothing. A refusal about a box's DNS question is said naming no box once the row at its address has been registered again, a question decided for a row registered again before it is recorded is said as not recorded, and the at-capacity line is not said for a frame whose row was registered again between its verdict and the line. Checks: the table tests that read these lines from the daemon's table name the relay tests that read them from the kernel's (the node plane's pin and re-pin, the first-fill line once per box, and the refusals by address); a unit check reads the room line and its counter; a unit check holds the at-capacity reading to its one case and none of the others the window covers; a query to another host's port 53 says neither the oversized nor the unreadable line; after a rebuild the node's answer names its baseline entry, as the pin line says it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The network kernel's tables decide every frame and say every line, so the daemon's own copies of a box's tables are deleted with what fed them. Deleted, in net/egress_gate.rs: - ReplyTables, ReplyInner, BoxReplies and RefusalNotes, with observe_delivered, observe_refusable, reply_admits, refusal_admits, retire, end_port_at, live_flows, refused_at_cap_of, record_count_of, shrink_cap_of and reply_tuple_of; - their call sites: the switch-to-guest leg's two observations, the relay end's retire, the port-end helper's half that ended the daemon's records, the mirror ledger's field, and the parameters that carried the tables from the gate's spawn through every relay; - DecidedFor::asker, which named whose daemon table a question went to. Deleted, in net/dns_pins.rs: - DnsPins, Inner, BoxPins, FlowTable, FlowKey, QueryKey, Admission, NodePlaneNames and Asker, with their operations, counters and readers; - the DnsPins the gate was spawned with, in net.rs and every test harness. Marked, not deleted: L4Packet's tcp_seq, tcp_ack and tcp_payload_len, and NodePlaneBaseline::rules, each unread outside tests, with kernel_facts' constructor and its tests as they were. No product code reads the baseline's compiled set: the kernel's adoption of the baseline takes its names and blocks itself. Lines, counted from `git diff -U0` of this commit, each hunk line counted as product or test by whether it falls before or after the file's first test module (`test_support` or `tests`) in the old and the new file; the registry and the lock are neither: - net/egress_gate.rs: product -701 +91, tests -578 +216; - net/dns_pins.rs: product -1332 +58, tests -1959 +158; - box_registry.rs: product -5 +21; - net.rs: product -14 +1; - net/baseline.rs: product -1 +10; - net/kernel_config.rs: product -2 +2 (comments); - crates/netcore/axioms/REGISTRY.md: -39 +39 (the check and state cells of the rows about the caller); - crates/netcore-lock/STATEMENTS.lock: -39 +39 (those rows). Kept: question_of, normalized, the deny-all line and question, DenyAllRefusal, L4Packet's addressing and flags, MAX_DATAGRAM and the test builders other modules use; boxes' shared ReplyFlows, which the in-VM gate uses; the forwarded-flow table; the kernel's shrink and retire hooks, with a hook that shrinks a row's refusal-note table. The per-box counters a status surface will read are the holder's (refused_at_cap_of, refused_for_room_of, the at-capacity count). No product code read the daemon's counters, and none reads these: no status surface is wired in this change. The tests of the daemon's tables are deleted, each covered as named: - host_ip_box_names_pin_apart_from_the_node_plane: the cohort tests at the relay, and an_unmarked_node_query_for_a_members_name_admits_no_cohort_frame; - host_ip_readmit_with_equal_rules_keeps_the_cohort_pins: an_equal_readmit_keeps_the_kernels_cohort_table_and_a_changed_one_empties_it and the_cohorts_admission_survives_an_equal_readmit_at_the_relay; - node_address_queries_pin_only_in_the_entry_their_mark_names: the same unmarked-query test; origin::Sources::origin, whose contract the holder's record_question routes a question by its source and mark with; netcore's unit check a_question_is_recorded_in_the_table_its_source_and_mark_name; and, for the marked-query half, a_question_from_the_node_is_recorded_only_in_the_table_its_mark_names, through the holder's record_question; - baseline_entry_pins_the_daemon_lookup_answers: the_nodes_baseline_names_admit_only_their_own_answers_within_the_cap, the_node_planes_pin_and_re_pin_lines_come_from_the_kernel and node_plane_frame_admitted_only_to_pinned_baseline_address; - host_pins_are_the_answers_the_box_received: the relay tests of an undeclared name, an answer toward another box, the first-fill line and the admission table's room; - host_window_refuses_denied_and_infrastructure_ranges: netcore's rebind::theorem_rb1_refused_ranges, and the relay tests a_rebinding_answers_refusals_are_said_by_address_from_the_kernel and a_rebinding_answers_refused_addresses_are_admitted_nowhere_and_said; - host_window_refuses_this_host_multicast_broadcast_and_reserved_answers: netcore's rebind::theorem_rb1_the_ranges_no_name_may_name and rebind::theorem_rb1_refused_ranges, and the relay test a_rebinding_answers_refusals_are_said_by_address_from_the_kernel; - a_replacement_row_inherits_neither_pins_nor_flows: a_row_registered_again_holds_no_record_from_before, and the closed relay's retire; for the DNS half, a_rows_tables_exist_exactly_while_a_row_holds_its_address; - the_flow_table_is_bounded_per_box: a_boxs_dns_table_holds_the_documented_limits, the flow capacity test at the relay and the at-capacity reading; - at_the_cap_one_sweep_per_second_reclaims_the_idle_flows: an_expired_dns_flow_gives_its_place_at_an_insert, which asserts that a full DNS flow table makes room at an insert by giving up one expired flow; a search for an expired flow that finds none sets a floor at the earliest deadline it saw, a flow written with an earlier deadline lowers the floor to that deadline, and no search reads the table while the clock is below the floor (netcore's slab::find_expired); - only_a_reply_to_the_boxs_own_outstanding_query_pins: the relay tests of an answer with another id, to another port, and a second answer; - only_the_answers_chain_pins: netcore's dnsa::theorem_da3_addresses_come_from_the_chain; - a_row_whose_resolver_is_not_the_plans_own_is_refused: unreachable. Every row's resolver is compiled from the registry's own subnet, and the kernel's plan is made from that same subnet; only the daemon's table, built for another plan as this test built it, could disagree; - reply_flow_record_never_admits_a_frame_to_the_proxy: netcore's J1 (judge::judge_row's contract: nothing toward the proxy is admitted as a reply or a refusal), which control judge:1 cuts, and proxy_sourced_dial_records_no_reply_flow at the decision; - an_older_record_never_replaces_a_newer_records_entry: a row's kernel tables are made at its registration and written only for the record they were made for, by the decision's generation check and the question's: a_frame_is_decided_by_the_row_registered_again_at_its_source_and_its_tables and after_its_verdict_a_frame_is_recorded_for_the_row_it_was_decided_for. The recording checks of frames spoiled toward a guest read the kernel's refusal notes for the box where they read the daemon's reply entry. The relay tests that read the daemon's record counts read the kernel's live records. One expected count changes: before any dial, host_gate_reply_record_never_opened_by_the_box reads none held, because a box's tables exist from its registration. The live-flow gauge went with the daemon's table, and its assertion with it. forwarder_flow_expires_and_table_is_bounded is restated on the kernel's tables, its retire half included: after the relay ends, the kernel holds no record for the flow. New check: with a box's refusal-note table at one note, another client's connect is refused a note, so the box's reset to it does not pass, while the first client's live note answers its own connect's reset. The two decision tests that called the old decision with the daemon's tables (a task row does not inherit its box's credentialed lane; the alias-by-name lift admits the alias alone) call it with the frame, the table and the baseline alone. netcore's registry rows about the caller name the tests of this change that check them, or say what at the call site holds them; the statement lock is rewritten to match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
|
Member
|
/review |
Contributor
|
Approved: no findings at Nothing to do. Clobber: not checked in depth. If that was not intentional, restore the earlier change. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The decisions of the host's network gate (what a frame is, whether it passes, which box's records it touches, which rule is reported) move into one crate,
crates/netcore: pure functions over owned data, with each guarantee stated as a theorem beside the code and machine-checked. The host code keeps the sockets, the locks, the clock and the events, and asks the kernel. (In the crate,Gateis a type; the host code is called the shell.)There is no switch and no second path: where the host code calls the kernel, it decides nothing itself. A box's reply records, refusal notes and DNS tables are the kernel's, and the host's own copies are gone (commit 9).
Where to spend review time
The shell first. The proofs are about
crates/netcore; nothing proves the calling code. The unproved risk is in two files,crates/minvmd/src/net/egress_gate.rsandnet/kernel_config.rs: what they hand the kernel, under which lock, and what they do with its answer. Commits 2 to 9 are those files, andaxioms/REGISTRY.mdlists, row by row, what the kernel requires of them and what checks each requirement.What the daemon calls. The daemon holds each box's tables itself and decides through the per-box entry points in
splitandfinish(egress_first,finish_row,finish_node,finish_cohort,finish_ingress), withanswer::answerand the tables' own operations. It never buildsnetcore::gate::GateorLedger. Those are the sequential specification: the headline theorems are stated ofGate, and SP1, SP2 and IS1 are what carry them to the entry points the daemon uses. A reviewer checking "does the proof reach production" reads those three.In the kernel, the parts that decide every frame of every box: the frame reader (
frame), a box's rules made from its declared policy (policy) and its decision table (row), a box's own records (flow,notes,pins) over the bounded table they are kept in (slab, specified bypool), the DNS readers (dnsq,dnsa) and the answer check (rebind,answer), the whole row decision (judge), and the entry points (split,finish). The modules for boxes that share an address, for boxes that name each other, and for holding many boxes in one structure (cohort, the box-name rule,gate,isolation,ledger) are proved to the same standard and are not where a first reading should start.Three things in the shell worth knowing before reading it:
BETWEEN_READS,AFTER_EXPOSURES_PUSHED,AFTER_DECIDED) exist so tests can force a registration or an exposure change between two steps; outside test builds they compile to nothing.How to review it
The commits are the review order. Proof bodies do not need reading; what is claimed does.
crates/netcore: source, manifest, README,axioms/REGISTRY.mdsrc/lib.rs: each row names what is guaranteed and the function or theorem that carries it. Then the tables a decision is proved equal to, each written out in the specification:row::row_spec,node::node_spec,cohort::cohort_spec,alias::alias_spec, the rebinding table inrebind, the route inroute, the reported rules inreport. No proof says a table is the right rule, only that the code equals it and that it has the listed properties: whether each table is the rule the product documents is what a reviewer who knows the product checks here. Each table follows the gate's existing decision arm by arm, including where the product's documents are silent on an arm; the comparison of the old decision with the new on generated frames is what shows that. The tables were also read arm by arm against the architecture reference (gominimal/arch at bf831998f150161bed316677bdb43d6deef30094) and the networking spec. That reading was done by Claude, not by a person; a reviewer who knows the product should treat it as a first pass. Then the registry: what is relied on and not proved, each with its checkSTATEMENTS.lock,VIEW.lock, the gate scripts and their self-test, the negative controls; the Verus lane with the lock checks; the crate's line in the Kani laneWhat is a claim and what is proof: a specification function, a
requires, anensuresand a lemma's statement are claims; the text inside aproof!block or a lemma's body is proof and can be skipped.STATEMENTS.locklists every claim. A reviewer who wants to test one rather than read it: break the code under it in a copy and runscripts/verus.sh.Reading the diff, by hand or with an assistant
About half of the added lines are generated and are collapsed in the diff:
crates/netcore-lock/STATEMENTS.lockandVIEW.lock(the locked statements), the control lists incrates/netcore/verus/, and the run table incrates/netcore-lock/results/. They are read through their source: a statement in the crate, a control incontrols.toml. An assistant asked to review this change should be pointed at the commits in order and told to skip those files.To check a claim without reading its proof: pick a control in
controls.toml, apply its edit to a copy of the crate, and runscripts/verus.sh; the verifier must reject the copy inside the functions the control names..github/workflows/ci-verus.ymlshows how the pinned Verus is installed (one release archive, checked by digest); with it onPATH,scripts/verus.shis the whole lane, about a minute.The Verus and Kani lanes are advisory, as the existing Kani lane is: they report on every change to the crate and block nothing until they are promoted in branch protection.
Behaviour after this change
Each row is what the gate guarantees, with the rule reported and the test that asserts it.
egress-truncated-transporta_guest_first_fragment_without_a_whole_transport_header_is_dropped_as_truncated_transportingress-truncated-transporta_short_first_fragment_toward_a_guest_is_said_as_an_ingress_dropa_protocol_without_ports_is_decided_with_no_portegress-truncated-ipv4an_arp_of_another_shape_is_no_frameegress-truncated-ipv4an_ipv4_header_with_a_bad_version_length_or_total_is_no_frameegress-deny-all-dns-querya_narrowed_rows_zone_query_of_any_type_is_admitteda_row_that_declares_no_subnet_and_no_dns_host_is_narrowed,an_unenforced_subnet_is_said_once_at_registrationonly_the_resolvers_arm_is_narrowed_and_a_query_that_cannot_be_read_is_refuseda_cohort_whose_members_name_nothing_is_narrowed,a_cohorts_refused_query_is_said_with_its_name_and_no_boxa_fragmented_dns_query_from_a_narrowed_row_is_refusedegress-host-ip-boxesa_cohorts_unlifted_dns_admission_is_reported_under_the_host_ip_boxes_rulea_narrowed_rows_zone_question_must_be_class_in_and_plain_labels,deny_all_row_passes_only_zone_lookupsa_row_dns_frame_reaches_no_table,a_cohort_dns_frame_reaches_no_table,a_refused_query_neither_attributes_nor_carries_its_sourceingress-truncated-ipv4a_malformed_frame_toward_a_guest_is_dropped_as_no_frame_and_the_next_is_delivered,a_malformed_frame_toward_a_guest_is_dropped_as_no_frame_and_another_kind_is_deliveredthe_boxs_last_ack_and_a_retransmitted_fin_pass_after_both_finsthe_box_is_heard_for_the_closed_window_after_the_clients_resetegress-inbound-flow-caponly when no such record is helda_full_tables_finished_conversation_gives_its_place_to_a_new_dial_at_once,conversations_the_box_closes_never_fill_the_reply_tableat_a_full_notes_table_another_clients_connect_is_refused_a_notean_answer_the_kernels_reader_refuses_admits_nothingdns-rebinding-denied-subnet,dns-rebinding-infrastructurea_rebinding_answers_refused_addresses_are_admitted_nowhere_and_saidpins::Pins::egress, under the box's table lock; no test of its owna_frame_at_the_dns_flow_capacity_passes_on_the_window_with_no_flow,an_expired_dns_flow_gives_its_place_at_an_insertan_address_refused_for_room_is_said_and_counted,a_boxs_dns_table_holds_the_documented_limitsthe_guest_leg_reads_the_kernels_clock_once_a_frame,the_switch_leg_reads_the_kernels_clock_once_a_frame,a_frame_asked_again_is_decided_at_its_one_instanta_row_registered_again_holds_no_record_from_before,a_rows_tables_exist_exactly_while_a_row_holds_its_addressinternala_frame_to_the_alias_is_dropped_when_every_round_finds_another_listinternala_frame_is_decided_by_the_row_registered_again_at_its_source_and_its_tables,after_its_verdict_a_frame_is_recorded_for_the_row_it_was_decided_fora_reply_split_in_two_admits_nothing_and_the_same_reply_whole_admits,a_question_sent_as_a_first_fragment_is_not_recorded_and_its_answer_admits_nothinginternala_poisoned_configuration_decides_no_frame_and_a_withdrawal_still_completes,a_box_whose_tables_lock_was_poisoned_drops_its_frames_and_another_box_is_decideda_rebuild_keeps_a_rows_records_only_for_the_registration_they_were_made_for,a_row_whose_restate_is_refused_admits_no_reply_on_the_earlier_registrations_flowRows 18 and 22 (a note's expiry and later deadline; room made at an insert) are checked at the configuration's holder with instants given by hand, not through the relay, which cannot move the clock. Row 12's reliance on the next hop is stated in "What is assumed" (registry rows NC38, NC39, NX5).
Reported rules. Every
rule_matchedname the gate reported before is kept, with the same meaning. Five are added:egress-truncated-ipv4,egress-truncated-transport,ingress-truncated-ipv4,ingress-truncated-transportandinternal. Dashboards and runbooks that match on names need only the additions.What is assumed
crates/netcore/axioms/REGISTRY.mdlists what the proofs rest on and do not show: facts about the next hop and the resolver, and what the calling code must do (one clock, the right direction, the rules it hands over, its locks). Each row names its check and its state. Of the 38 rows about the calling code at the tip: 24 are tested by named tests of the daemon; 9 hold by construction (the row says what at the call site makes a violation impossible, and that no test would notice a change there); 3 do not apply (the daemon does not call the entry point); 2 are unchecked (the lock order, NC21, and that a frame's source belongs to its sender, NC23). Of the 8 rows about the world: 2 are probed (NX6: in ordinary traffic in either direction, no frame the reader calls no frame and no short transport header, 17,027,804 frames counted on two distros; and that the switch's resolver answers zone names itself), 1 is read at the pinned switch, 1 records that nothing is relied on, and 4 are unchecked, each with the probe that would check it.What is not covered
gominimal/archatbf831998f150), and where the two differ the table keeps the existing decision.external_bodystubs inslab, which the attribute that gives a function a ghost result writes beside its verified body; each is uncallable (requires false), and the second lock fails on a third.Going back
This is a cutover: there is no runtime switch. A switch would mean keeping and testing two decision paths, and the tables this change deletes would have to stay. The way back is the release before this change.
Testing
crates/netcore-lock/controls.toml: 981 controls, 862 run on this text, each rejected by the verifier inside the functions it names (a resource-limit error is recorded as cost and never counts as a place); every theorem of the crate is the place of at least one rejection; the rest retired, replaced or not cuttable, each with its reason. The lists incrates/netcore/verus/are generated from itinternal, and none dropped under a policy rule. The only drops are the relay's full-queue dropsChecklist
crates/netcore/README.md,crates/netcore/axioms/REGISTRY.mdandcrates/netcore-lock/README.mdare new; the behaviour table above lists every change, and the five addedrule_matchednames.BREAKING CHANGE:footer present if this is a breaking change: not one. No command, file format or existing rule name changes.🤖 Generated with Claude Code