Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ The proof is staged so each level is useful by itself and later levels build on
- Write footprints and frames for the native operations used by P3: cap-slot writes, installs, delete and finalisation, and VSpace operations. The native thread-finalisation leaf requires an unbound VCPU link. None of them breaks the invariant, and finalisation writes no cap slot.
- The two conditions seL4's C code relies on without checking are P1 invariants, kept by every kernel entry: the current thread has an SC when `switch_sched_context` runs (`BoundInv.resume`, l4v `active_sc_tcb_at`), and a thread blocked on reply has a reply object (`ReplyInv0.reply`).
- Typed-heap layout, object alignment and non-overlap appear as hypotheses (the sets P1 is parameterised by). CDT and untyped invariants are proved in P3 (`MdbOK`), not yet as P1 invariants.
- AArch64 (`proofs/Fl4ProofsA64/P1`, in progress): one capability invocation at a time, from P1's syscall-level bundle `SysL` (with `SymL`, the deletion input `DelIn` and the decode's placement facts). `syscall.decode_invocation.armQHAt` (`MdbArmQHD`) proves that every arm of `DecArmQH` ends in `ArmQIAt` (`SysL`, `SymL` and `BlkOK` at the result, plus the cap-only carries, including the page-table cap placement `PtCap`) and keeps the ASID table or zeroes an entry: CNode and deletion arms, TCB SetSchedParams / Suspend / ReadRegisters, IRQ control, Notification and Endpoint send, every VCPU invocation, and the VSpace arms (Stage-1 and `HighVSpace` Page / PageTable Map and Unmap, TestAndClearAccessed, the flushes, GetAddress, and every Stage-2 (EPT) operation). The step theorem is `syscall.decode_invocation.s1aStepR2K` (`S1aStepR2K`): on every arm of `DecArmS1aH` (`DecArmQH` plus Untyped Retype, ASIDPool Assign and ASIDControl MakePool) it takes, at entry, `S1aR2` (the VSpace record over the tables reachable from the ASID table: lookup, walks, root agreement, the Stage-1 and Stage-2 typings narrowed to reachable tables, exact path backing, footprint and placement), `S1aKtUt` (the kernel TTBR1 tables outside every Untyped) and `S1aHiK` (the levels of the kernel tables `Kt` and of the `HighVSpace` headers' copied descriptors, at the levels `KLv` of the platform contract `KTab`), and returns all three at the end, with `S1aStep`'s columns (`SysL`, `SymL`, the arm and cap columns, `PtCap`, `PtHG`, `HiCap511`, …; `S1aStepR2K.toR2` is `s1aStepR2`'s post). The boot witnesses give the entry (`w0_s1aStepEntryK`, `w1K_s1aStepEntryK`). Full typing of every live table is false on reachable states: `delete_asid_pool` leaves a mapped `HighVSpace` root whose private table still names a page table that can then be deleted and its memory retyped. So the deletion typing is the reachable one (`HiDelTyR`, a projection of `S1aR2`), and the tables an ASIDPool Assign makes reachable are typed by relabelling `S1aR2`'s levels on unreachable tables (`S1aR2.relabel`). Named premises: [P] `P0.ArchTotal`, `MaxSpi`, `ArchPlat` (the IPA width), `KTab`, `A64FrameMasks`. Covered arms: Null and Zombie caps, Endpoint and Notification sends, Domain, Untyped, IrqControl, IRQ handler Ack / Clear / Set, CNode Copy / Mint / Move / Mutate / Rotate / Revoke / Delete, the TCB labels SetSpace, SetHighVSpace, SetIPCBuffer, Configure, SetEPTRoot, SetTimeoutEndpoint, SetSchedParams, SetPriority, SetMCPriority, Suspend, ReadRegisters, SetTLSBase, SetPACKeys, SetFlags, ReadFPU and UnbindNotification, SchedContext Unbind / UnbindObject / Consumed, every VCPU label, every Stage-2 (`Ept`) invocation, Frame Map / Unmap / GetAddress / TestAndClearAccessed and the four cache operations, PageTable Map / Unmap, the `Pml4`, `PageDirectory` and `Pdpt` invocations, ASIDPool Assign and ASIDControl MakePool. Not covered on AArch64: Reply and SchedControl caps, direct `HighVSpace` invocations, CNode CancelBadgedSends, the TCB labels WriteRegisters, CopyRegisters, Resume, BindNotification, ConfigureSingleStepping, Set / Get / UnsetBreakpoint, SetTimer and WriteFPU, SchedContext Bind and YieldTo, Frame DeriveSubframe, and the unknown-label error branches. `IoPortControl`, `IoPort` and `TdxControl` are x86_64 only and do not apply on AArch64. Boundary: the theorem is about one `decode_invocation` of a `DecArmS1aH` arm, not `kernel_entry`, and it still takes entry-layer inputs its post does not return (`DelIn`, `DecPre`, `SysPlace`, the IRQ and slot-coverage facts `hIq` / `hSC`, and the thread facts `mcp`, `cs`, `fh`). The earlier tops `s1aStepH` / `s1aStepPt` / `s1aStepR2` remain, with their per-step inputs.
- AArch64 (`proofs/Fl4ProofsA64/P1`, in progress): one capability invocation at a time, from P1's syscall-level bundle `SysL` (with `SymL`, the deletion input `DelIn` and the decode's placement facts). `syscall.decode_invocation.armQHAt` (`MdbArmQHD`) proves that every arm of `DecArmQH` ends in `ArmQIAt` (`SysL`, `SymL` and `BlkOK` at the result, plus the cap-only carries, including the page-table cap placement `PtCap`) and keeps the ASID table or zeroes an entry: CNode and deletion arms, TCB SetSchedParams / Suspend / ReadRegisters, IRQ control, Notification and Endpoint send, every VCPU invocation, and the VSpace arms (Stage-1 and `HighVSpace` Page / PageTable Map and Unmap, TestAndClearAccessed, the flushes, GetAddress, and every Stage-2 (EPT) operation). The step theorem is `syscall.decode_invocation.s1aStepR2K` (`S1aStepR2K`): on every arm of `DecArmS1aH` (`DecArmQH` plus Untyped Retype, ASIDPool Assign and ASIDControl MakePool) it takes, at entry, `S1aR2` (the VSpace record over the tables reachable from the ASID table: lookup, walks, root agreement, the Stage-1 and Stage-2 typings narrowed to reachable tables, exact path backing, footprint and placement), `S1aKtUt` (the kernel TTBR1 tables outside every Untyped) and `S1aHiK` (the levels of the kernel tables `Kt` and of the `HighVSpace` headers' copied descriptors, at the levels `KLv` of the platform contract `KTab`), and returns all three at the end, with `S1aStep`'s columns (`SysL`, `SymL`, the arm and cap columns, `PtCap`, `PtHG`, `HiCap511`, …; `S1aStepR2K.toR2` is `s1aStepR2`'s post). The boot witnesses give the entry (`w0_s1aStepEntryK`, `w1K_s1aStepEntryK`). Full typing of every live table is false on reachable states: `delete_asid_pool` leaves a mapped `HighVSpace` root whose private table still names a page table that can then be deleted and its memory retyped. So the deletion typing is the reachable one (`HiDelTyR`, a projection of `S1aR2`), and the tables an ASIDPool Assign makes reachable are typed by relabelling `S1aR2`'s levels on unreachable tables (`S1aR2.relabel`). Named premises: [P] `P0.ArchTotal`, `MaxSpi`, `ArchPlat` (the IPA width), `KTab`, `A64FrameMasks`, and at boot `BootCanon` (the boot objects lie in the kernel window). Covered arms of `DecArmS1aH`: Null and Zombie caps, Endpoint and Notification sends, Domain, Untyped, IrqControl, IRQ handler Ack / Clear / Set, CNode Copy / Mint / Move / Mutate / Rotate / Revoke / Delete, the TCB labels SetSpace, SetHighVSpace, SetIPCBuffer, Configure, SetEPTRoot, SetTimeoutEndpoint, SetSchedParams, SetPriority, SetMCPriority, Suspend, ReadRegisters, SetTLSBase, SetPACKeys, SetFlags, ReadFPU and UnbindNotification, SchedContext Unbind / UnbindObject / Consumed, every VCPU label, every Stage-2 (`Ept`) invocation, Frame Map / Unmap / GetAddress / TestAndClearAccessed and the four cache operations, PageTable Map / Unmap, the `Pml4`, `PageDirectory` and `Pdpt` invocations, ASIDPool Assign and ASIDControl MakePool. The sibling `syscall.decode_invocation.s1aStepR2All` (`S1aCAll`, same hypotheses and post) covers `DecArmS1aAll` = `DecArmS1aH` plus `DecArmS1aC`: the rejected invocations (direct `HighVSpace`, the unknown CNode / IRQ-handler / Frame / PageTable / ASID / VCPU labels, `IoPortControl` and `TdxControl` under `lbl < 2^52`, `IoPort` by `SysL.ci`), the unknown TCB and SchedContext labels (a stall only), TCB WriteFPU, SetTimer, BindNotification, Resume, WriteRegisters and CopyRegisters, CNode CancelBadgedSends, SchedContext Bind and YieldTo, SchedControl ConfigureFlags and the Reply cap. Each new arm but Reply exports `ArmQIAt ∧ TabKeepOrZero ∧ ArmVsK ∧ OSKeep` and is closed by `S1aStepR2K.ofKeep'`; `migrate_tcb`'s debug-list and `OWNER_CPU` writes (SchedContext Bind, ConfigureFlags) go through the Suspend footprint `SusW` (`DMR`, `ArmQIAt.ofSusW`). ConfigureFlags (`S1aCSchedCtlD`) takes two case facts, [J] cap well-formedness for a future cap-typing column: the SchedControl cap's core is a core (`cpu ∈ Cs`) and an extra SchedContext cap carries its object's size (`sz.val = H.scBits p`); neither follows from `SlotTy` / `CapTy`. The Reply arm (`S1aCReplyA`) exports `XferSlots2` (the reply's transfer, then the timeout fault IPC's) instead of `OSKeep` and is closed by `S1aStepR2K.ofXfer2`; the timeout IPC's placement after the first transfer comes from `SlotTy.ofXfer` (`S1aCXferTy`: a derived copy is the source cap, `Null`, `Domain` or a frame cap, the source keeps its cap or turns full). ConfigureSingleStepping and Set / Get / UnsetBreakpoint share SetEPTRoot's label `U64::MAX` and decode as it. Not covered on AArch64: Frame DeriveSubframe, by ruling: `FrameOK` requires every frame object to be the exact size of its cap (`FrObj`), which a 4 KiB subframe beside its 2 MiB source violates (MdbVsGaQ's `SysL.sub_false`); generalising `FrObj` to containment is a backlog item with its own review. Boot (`S1aCBootSym`, `S1aBootDel0`, `S1aBootDel1`): `boot_symL`, `w1_symL` and `w1K_symL` give `SymL` at w0, w1 and the kernel-table extension; `w0_delIn` / `w1_delIn` give `DelIn` from [P] `BootCanon` (non-vacuous: `bootCanon_ex` exhibits `BootLay1 ∧ BootCanon` at `kb = PPTR_BASE`), so `w1K_bundleU` is the boot bundle with no further input. Non-decode steps: each kernel function has its own theorem from the same per-state inputs to `S1aStepR2K`: `update_timestamp`, `commit_time`, `postpone`, `end_timeslice`, `charge_budget` (`S1aCTime`, `S1aCBudget`), `check_budget` / `check_budget_restart` (`.rpw` to the Reply-walk post `RpPost`, `.s1a` by `S1aStepR2K.ofRpPost`; `S1aCBudget`, `S1aCYield`), `schedule`, `activate_thread`, `vcpu::check` and `syscall::finish` (`S1aCSched`, `S1aCFinish`), `handle_fault` / `handle_timeout` (`S1aCFault`), `handle_yield` and `mcs_preemption_point` (`S1aCYield`), and `handle_recv` (`S1aCRecv`: `receive_ipc` with `take_reply`, the wait, `receive_from_sender` and `complete_signal`; `receive_signal`; the cap faults; a looked-up cap is a typed `OS` slot's cap, `cspace.lookup_cap.os`; the notification states are the existing [J] of `recvOK`), and the interrupt side (`S1aCIrq`): `handle_interrupt` (the IRQ slot's notification typed and named by its `OS` slot), `vcpu::complete_run`, `handle_vgic_maintenance` and `handle_vppi_event` (the `VPPI_MASKED` word as a VCPU-word step); `reply_error` and `msg.reply_success_empty` (`S1aCReplyErr`: registers and IPC-buffer words over the normal transfer's carry). The entry wrappers (`budget_ok` / `update_timestamp` / `check_budget`, a kernel function, `finish`; the fault, interrupt, VGIC, vPPI and VCPU-run entries, `set_tls_base_self`, the debug syscalls) are not composed on this line: by ruling they are composed at entry level, from the per-function theorems, whose inputs are stated at each function's own start state. The entry facts after a decode arm (`S1aCEnt`): `syscall.decode_invocation.s1aStepEntAll` gives, beside `s1aStepR2All`'s post, `S1aStepEnt` at the decode's heap and slot set (`SysL`, `HeapOK`, `BXI`, `OSOK`, `UserOK` of the entry's user words, `VsTy` of the reachable tables via `VsTyR.toVsTy`, the state block's width), the fields of P2's `EntryInvA` and P3's `SysInvA`, on the arms that keep the heap (`DecArmS1aEnt`). Untyped Retype and ASIDControl MakePool are not covered: `UserOK` leaves the user words an arbitrary set disjoint from the heap objects, with nothing tying them to frame caps, so it does not follow over the grown heap. The non-decode steps' per-state facts are the queue-level ones (`CurOK`, the current thread's SC and blocking facts, [J] `RunVcpuInv`, on the receive side [J] `nvm` and the notification states of `recvOK`); `schedule` is walked with a bundle `SW` (`RpW` with every slot kept and the VCPU words kept, `VKeep`), each step a `DMD` step or a queue step writing low state-block words. Boundary: the decode theorems (`s1aStepR2All`, `s1aStepEntAll`) are about one `decode_invocation` of a `DecArmS1aAll` arm, not `kernel_entry`, and they still take entry-layer inputs their posts do not return (`DelIn`, `DecPre`, `SysPlace`, the IRQ and slot-coverage facts `hIq` / `hSC`, the thread facts `mcp`, `cs`, `fh`, and the SchedControl case fact `hScC`). The earlier tops `s1aStepH` / `s1aStepPt` / `s1aStepR2` remain, with their per-step inputs.
- **P2**: for x86_64, not started. The transaction-soundness theorem it replaces (`proofs/Fl4Proofs/P2/Runtime.lean`, `sound` and `snapshot`) is complete, but about the transactional runtime removed on 2026-11-21 (§7); the Lean tree still builds it.
- AArch64: the architecture-independent gate model (`Serial`, `SerialSafe`, `SafeCert`, and the hardware-step model `SerialHw`) is one library, `proofs/Fl4P2Base`, shared by both trees (the x86_64 `Fl4Proofs/P2` modules of the same names re-export it); the core-generic x86_64 guard and local-path modules are copied into `Fl4ProofsA64/P2` only by `xtask/scripts/port_p2_a64.py` (`--check` verifies the copies).
- AArch64 serializability, first form: `serializable_fl4_localVXb` (`Fl4ProofsA64/P2/E2EFl4VXS.lean`). Every execution that starts with an empty log and no local path in progress, made of core steps (serial entries under the gate, and local paths) and hardware steps (a running guest's VCPU words, rules 7 and 8), and that ends with no local path in progress, has a log whose entries, run one after another from the initial memory, give the final memory (`RunAll`). Its local paths are each an `E2E.LocalPath` (refinement of the general path, footprint, read-once), cut and lifted to the VCPU ownership map: the VM fault, the VM ReplyRecv, `TCB_SetTimer`, the timer interrupt (including the fire case), the local syscall path, NBWait, the `ARMVCPURun` exit, the VM-timer interrupt and `arm_vm_entry_ready`. The run is under an epoch predicate, `EpochA`: the boot layout and every serial entry's result are a typed layout linked to memory on the aligned non-user words, and a local path starts in that epoch (`StartAtE`).
Expand Down
53 changes: 33 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,29 +191,42 @@ and by the proof extractions (`proofs/Fl4Core` for x86_64,
`proofs/Fl4CoreA64` for AArch64). P0 (no failure) covers both builds;
P3 is about the x86_64 build, one serial kernel entry at a time; P1 covers
the x86_64 entries and, on AArch64, the decode step of the capability
invocations in `DecArmS1aH` (`syscall.decode_invocation.s1aStepR2K`; DESIGN.md
§9): from the reachable VSpace record `S1aR2`, the kernel-table / Untyped
separation and the kernel-table level column `S1aHiK` it returns all three
with the syscall-level bundle, and the boot witnesses give them at entry. The
arms covered are Null and Zombie caps, Endpoint and Notification sends, Domain,
invocations in `DecArmS1aAll` (`syscall.decode_invocation.s1aStepR2All`, a
sibling of `s1aStepR2K` over `DecArmS1aH`; DESIGN.md §9): from the reachable
VSpace record `S1aR2`, the kernel-table / Untyped separation and the
kernel-table level column `S1aHiK` it returns all three with the
syscall-level bundle, and the boot witnesses give them at entry. The arms
covered are Null and Zombie caps, Endpoint and Notification sends, Domain,
Untyped, IrqControl, IRQ handler Ack / Clear / Set, CNode Copy / Mint / Move /
Mutate / Rotate / Revoke / Delete, the TCB labels SetSpace, SetHighVSpace,
SetIPCBuffer, Configure, SetEPTRoot, SetTimeoutEndpoint, SetSchedParams,
SetPriority, SetMCPriority, Suspend, ReadRegisters, SetTLSBase, SetPACKeys,
SetFlags, ReadFPU and UnbindNotification, SchedContext Unbind /
UnbindObject / Consumed, every VCPU label, every Stage-2 (`Ept`) invocation,
Frame Map / Unmap / GetAddress / TestAndClearAccessed and the four cache
operations, PageTable Map / Unmap, the `Pml4`, `PageDirectory` and `Pdpt`
invocations, ASIDPool Assign and ASIDControl MakePool. Not covered on AArch64:
Reply and SchedControl caps, direct `HighVSpace` invocations, CNode
CancelBadgedSends, the TCB labels WriteRegisters, CopyRegisters, Resume,
BindNotification, ConfigureSingleStepping, Set / Get / UnsetBreakpoint,
SetTimer and WriteFPU, SchedContext Bind and YieldTo, Frame DeriveSubframe,
and the unknown-label error branches. `IoPortControl`, `IoPort` and
`TdxControl` are x86_64 only (not applicable on AArch64). The step still
Mutate / Rotate / Revoke / Delete / CancelBadgedSends, every TCB label
(SetSpace, SetHighVSpace, SetIPCBuffer, Configure, SetEPTRoot,
SetTimeoutEndpoint, SetSchedParams, SetPriority, SetMCPriority, Suspend,
Resume, ReadRegisters, WriteRegisters, CopyRegisters, SetTLSBase,
SetPACKeys, SetFlags, ReadFPU, WriteFPU, SetTimer, BindNotification and
UnbindNotification; ConfigureSingleStepping and Set / Get / UnsetBreakpoint
share SetEPTRoot's label `U64::MAX` on AArch64 and decode as it), SchedContext
Unbind / UnbindObject / Consumed / Bind / YieldTo, SchedControl
ConfigureFlags (with two cap well-formedness case facts: the core and the SC
cap's size), the Reply cap (its transfer and timeout fault), every VCPU label, every
Stage-2 (`Ept`) invocation, Frame Map / Unmap / GetAddress /
TestAndClearAccessed and the four cache operations, PageTable Map / Unmap,
the `Pml4`, `PageDirectory` and `Pdpt` invocations, ASIDPool Assign and
ASIDControl MakePool, direct `HighVSpace` invocations and every unknown-label
error branch (all rejected), and the `IoPortControl`, `IoPort` and
`TdxControl` caps, which AArch64 rejects. Not covered on AArch64: Frame
DeriveSubframe (`FrameOK`'s exact-size frame objects, which a subframe beside
its source violates; generalising them is a backlog item). The step still
takes entry-layer inputs its post does not return (`DelIn`, `DecPre`,
`SysPlace`, `hIq`, `hSC`, `mcp`, `cs`, `fh`), so it is not yet an induction
`SysPlace`, `hIq`, `hSC`, `mcp`, `cs`, `fh`, and `s1aStepR2All`'s `hScC`), so it is not yet an induction
over `kernel_entry`.
Outside the decode, the time and budget functions, `schedule`,
`activate_thread`, `vcpu::check`, `syscall::finish`, the fault handlers,
yield, the MCS preemption point, `handle_recv`, `handle_interrupt` and
the VCPU completion / VGIC / vPPI events, `reply_error` and `reply_success_empty` each have a theorem
from the same inputs to the same post; the entry wrappers around them are
composed at entry level. On the decode arms that keep the heap, a sibling
post also gives the entry facts (`S1aStepEnt`: `HeapOK`, `BXI`, `OSOK`,
`UserOK`, `VsTy`, `SysL`).
The existing x86_64 P2 theorem is about the transactional runtime that
was removed (DESIGN.md §9). On AArch64, P2 proves serializability for
the serial gate and the local paths that run SMP today
Expand Down
Loading
Loading