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
10 changes: 7 additions & 3 deletions DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,11 @@ The proof is staged so each level is useful by itself and later levels build on
- Its named premises beyond the first form's: [J] `EpochAP` at boot and kept by every serial entry; for the two PTE slots [J] `hbuf` (IPC-buffer placement at every entry state, as the timer interrupt's `ub`) and, for Delete, [J] `hcdt` (CDT link well-formedness at the start), [P] the shared `LkKernelReadsA`, [P] `cs` (the invocation's cores are below 128) and [P] `CurUnbound` at the start (the invoking thread has no bound VCPU); no [W]. The PageMap and Delete-with-PTE slots' user-write obligation is proved, not assumed.
- AArch64 boot (`Fl4ProofsA64/P1/Boot*`, `Fl4ProofsA64/P2/Boot*`): two boot witnesses, `w0` (the kernel's boot state, no page tables) and `w1` (the root task's: its CNode, TCB, SC, one VSpace with a 512-entry leaf table). `EpochAP` holds at both (`boot_epochAP`, `w1_epochAP`; at `w1` the PTE set is the 512 words of the leaf table and equals `ptesR`, non-vacuously), so `w0_serial` / `w1_serial` are `serializable_fl4_localVP` with the epoch premise discharged, and `w1_vreStart_ex` starts the `arm_vm_entry_ready` slot at the concrete `w1` with no premise left. P1's `SysL` holds at `w0` (`boot_sysL`) and the MDB tree facts at `w1` (`w1_treeA`, `w1_mdbLk`).
- P1's `SysL` also holds at `w1` (`w1_sysL`, `BootSysL1`).
- Not yet proved on AArch64: `hbuf` and `hcdt` from AArch64 P1 invariants; the [J] premises of the other slots from P1; and the gate and lock implementations themselves (§9, "From serial to concurrent", (4)).
- §9 item 4, Half 1 (the CDT and the IPC buffer along an execution, `Fl4ProofsA64/P2/Mdb*`, `BufWireA`, `DelLkA`): the replay record `InvR` beside `InvH` gives a history memory `H` whose entries replayed serially explain the run; P1's MDB tree facts hold of it (`MdbSH`) along every execution of `fl4LocPB` (`serializable_fl4_localVP_mdb`), every slot's edit being one of P1's (`SlotWireP`). The top family is now **`fl4LocPBL`** (`DelLkA`): `fl4LocPB` with the Delete-with-PTE slot started at `CdtAtL`, the CDT facts at the slots the path itself locks, discharged from the execution (`delSlotPL_startExec`), so the Delete start's all-slot `MdbLk` / `NullLk` [J] is gone (`hcdt` from `MdbSH` of the history, under `hSer`). The IPC-buffer words are gate-owned, so no local path or hardware step writes them and `BufSH` (`bufU` from the memory) is kept along an execution (`serializable_fl4_localVPL_buf`, under `hSerB` and `BufSH` at the start; the PTE slots' `hbuf` from it, `delSlotPL_startAtB`). From the boot witnesses: `w0_serial_mdbL`, `w1_serial_mdbL`.
- Its remaining obligations, theorem hypotheses: `hSer` / `hSerB`, that serial entries keep `MdbSH` / `BufSH` (the serial kernel's AArch64 P1 / S1A obligations, at the top-level P1–P2 composition), and `BufSH` at `w0` / `w1` (S1A / Boot).
- §9 item 4, Half 2 (the gate and the locks themselves, `Fl4P2Base/GateImpl`, `GateLock`, `SerialW`, `SafeW`, `Fl4ProofsA64/P2/GateExecA`, `GateBootA`): `GateImpl.lean` is a hand transcription of `fl4-sync`'s gate (`try_enter_local`, `leave_local`, `acquire`, the serial body, `release`) and `fl4-store`'s lock table (`try_lock_object`, `unlock_held`) as a runtime configuration and steps (`ICfg`, `IStepG`, `IStepL`, and the guest's or MMU's hardware write `IStepHw`); its fidelity is reviewed, not proved, and it is listed in `TRUSTED`. `impl_sim` matches every runtime step by zero or one step of the gate model (`StepR`: `Serial.Step`, or a racy speculative read returning another value of the word's coherence order: any value, or a value of the current class where the gate or the core owns the class), keeping a refinement relation `Rel` and the lock table's invariant `LkInv`; a hardware write while a serial body is pending release is deferred and replayed after the model's `serial` at the release's decisive store. Racy reads are covered by weak safety `SafeW`, derived from the same per-path certificates (`LocalPath.safeW`). `impl_execPA` / `serializable_implPA` (`GateExecA`): every runtime execution from boot, under the per-step premises `IFl4StepPA` (`Fl4StepPA`'s glue `arm` / `start` [P] and the serial entries' layout [J], now stated at the serial body) and the hardware write's `HwStepPA` [P], is an FL4 execution `ExecPAR`, and where no local path is in progress and no body pending its memory is the serial run of the completed entries. At the boot witnesses, for `fl4LocPBL` under `EpochAP`: `w0_serializable_impl`, `w1_serializable_impl`.
- Half 2's named premises, the transcription's step granularity (in `GateImpl`'s docstring; no Lean hypothesis carries them): **[P] MM-SB** (the Dekker store→load order of the active flag and `closed`), **[P] MM-DRF** (plain accesses to lock- or gate-owned words read the latest write), **[P] MM-RACY** (a racy aligned 64-bit read returns some value of the word's coherence order), **[P] IPI** (a remote call runs inside the requesting serial body; `settle_resume_point` is sequenced at the tail of the core's previous local entry). No [W].
- Not yet proved on AArch64: `hSer` / `hSerB` and `BufSH` at the witnesses (above); the [J] premises of the other slots from P1; the Half 1 history facts (`MdbSH`, `BufSH`) along the weak executions `ExecPAR` (they are proved along `ExecPA`).
- **P3**, in `proofs/Fl4Proofs/P3`, against `Fl4Spec` (the l4v rt abstract spec ported to Lean, up to `call_kernel`; KernelInit_A is dead in l4v and left out). The top-level theorem `handle_invocation_refinesM` relates the decode and invocation of each capability to the spec, from per-capability results and named hypotheses, and carries the CDT invariant `MdbOK` (frame invariant, untyped bookkeeping, no overlap) through a per-step relation `MdbStep`:
- CSpace: lookups, every CNode invocation, delete and revoke (zombies, preemption), untyped retype and reset, the IRQ and IO port caps.
- TCBs: native TCB invocations, including cap installs. The dispatcher excludes the new SetEPTRoot label.
Expand All @@ -455,11 +459,11 @@ Decided: we port seL4's Isabelle abstract specification (the MCS version, from `

The argument

\(1\) Under the serial gate an entry runs alone on memory, so it is one serial kernel entry, which P0 to P3 are about. (2) A local path that runs ends in the state the general path, a serial entry, would (refinement), and writes only its footprint (frame). (3) The gate holder waits for active local paths and a local path starts only on an open gate (the Dekker handshake of §7), so serial entries and local paths never overlap; two local paths hold disjoint footprints, by their locks and their cores, so they commute. Together, any execution equals running its entries one after another, in the order serial entries take the gate and local paths finish. (1) is P0–P3; (2) and (3) are P2. (4) What is left unproven is that `fl4-store`, `fl4-sync` and the IPI paths implement the gate and the locks correctly on real memory. The simulator tests exactly that, and checks (2) on every local path it runs.
\(1\) Under the serial gate an entry runs alone on memory, so it is one serial kernel entry, which P0 to P3 are about. (2) A local path that runs ends in the state the general path, a serial entry, would (refinement), and writes only its footprint (frame). (3) The gate holder waits for active local paths and a local path starts only on an open gate (the Dekker handshake of §7), so serial entries and local paths never overlap; two local paths hold disjoint footprints, by their locks and their cores, so they commute. Together, any execution equals running its entries one after another, in the order serial entries take the gate and local paths finish. (1) is P0–P3; (2) and (3) are P2. (4) That `fl4-store`, `fl4-sync` and the IPI paths implement the gate and the locks: on AArch64, P2 proves that a hand transcription of their protocol core refines the gate model (§9 item 4, Half 2: `GateImpl`, `impl_execPA`), from four named memory-model and IPI premises; the transcription's fidelity to the Rust and those premises are trusted. The simulator tests the implementation on real memory, and checks (2) on every local path it runs.

### Trusted base

The proof assumes: Rust, LLVM and the linker, and the kernels' linker scripts; Charon, Aeneas and the Lean kernel; the abstract spec; entry assembly and boot code; `fl4-store` and `fl4-sync`; hardware backends; the totality of `Store` and `Arch` (for each extraction); and the processor's memory model. fl4-core's AArch64 slice has P0 only. Everything trusted is listed in one file in the repo, with its size tracked in CI.
The proof assumes: Rust, LLVM and the linker, and the kernels' linker scripts; Charon, Aeneas and the Lean kernel; the abstract spec; entry assembly and boot code; `fl4-store` and `fl4-sync`, and the Lean transcription of their protocol core (`proofs/Fl4P2Base/GateImpl.lean`); hardware backends; the totality of `Store` and `Arch` (for each extraction); and the processor's memory model. fl4-core's AArch64 slice has P0 only. Everything trusted is listed in one file in the repo, with its size tracked in CI.

## 10. Deterministic simulation

Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,15 @@ the VM-timer interrupt and `arm_vm_entry_ready`, from named premises
page-table entries (`KLayoutP` / `ownP`), adding the frame-cap PageMap and
the Delete of a mapped frame cap, under the epoch contract `EpochAP`,
which is proved at the two boot witnesses `w0` and `w1` (`w0_serial`,
`w1_serial`). `cargo xtask gate` checks the x86_64
`w1_serial`). The top family is `fl4LocPBL` (the Delete start checked
only at its own locked slots), with the CDT tree facts of the replayed
history kept along every execution (`w0_serial_mdbL`, `w1_serial_mdbL`),
and the runtime itself is tied to it: a hand transcription of `fl4-sync`'s
gate and `fl4-store`'s locks (`proofs/Fl4P2Base/GateImpl.lean`, in
`TRUSTED`) refines the gate model step by step, racy reads and the
guest's hardware writes included, so the runtime's executions from `w0` /
`w1` are serializable (`w0_serializable_impl`, `w1_serializable_impl`),
from four memory-model and IPI premises. `cargo xtask gate` checks the x86_64
extraction; the AArch64 one is extracted and checked on its own
(`lake build Fl4ProofsA64`). P3 also covers the x86_64 VCPU/EPT
extension on a joint VM state (`VmEptState`): retype and untyped, the EPT
Expand Down
29 changes: 25 additions & 4 deletions TRUSTED
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,26 @@ a64-core: crates/fl4-core/src/arch/aarch64
runtime: crates/fl4-store/src
runtime: crates/fl4-sync/src

# The hand transcription of that runtime's protocol core into Lean
# (DESIGN.md §9 item 4, Half 2): fl4-sync's gate (try_enter_local,
# leave_local, acquire, serial, release) and fl4-store's lock table
# (try_lock_object, unlock_held) as the configuration ICfg and the steps
# IStepG / IStepL / IStepHw that P2 proves refine Serial.Step. Its fidelity
# to the Rust is reviewed, not proved. Modelling choices (stated in the
# module docstring): one atomic Mem operation, one plain access or the
# serial body per step, justified by the named premises [P] MM-SB (the
# Dekker store->load order), MM-DRF (plain accesses to lock- or
# gate-owned words), MM-RACY (a racy aligned read returns some value of the
# word's coherence order) and IPI (remote calls run inside the requesting
# serial body); tickets as naturals (at most MAX_CPUS outstanding);
# `closed` as the three-valued Gate; the flag scan as one phase of
# per-core loads; fences as no-ops under SC except the SeqCst one;
# `owner`, `local_hit` and the policy word not modelled; the serial and
# local programs fixed at the ticket and at the first open load; ghost
# state (programs, taken objects, written words, ghost maps) beside the
# runtime words. GateLock.lean (the lock side) only proves facts about it.
transcription: proofs/Fl4P2Base/GateImpl.lean

# The interface between the verified core and the trusted world: what P0
# assumes the Store and Arch implementations do (that they are total), for
# each extraction. The x86_64 Arch methods are machine.rs and the macro it
Expand All @@ -46,8 +66,9 @@ interface: proofs/Fl4Core/FunsExternal.lean
interface: proofs/Fl4ProofsA64/P0/Totality.lean
interface: proofs/Fl4CoreA64/FunsExternal.lean

# The abstract model of the transactional runtime P2 was proved about,
# superseded with it (DESIGN.md §9). Nothing is proved about the serial
# gate and local paths that replaced it (P2 not started): the runtime
# group above is trusted and tested by fl4-sim.
# The abstract model of the transactional runtime P2 was first proved
# about, superseded with it (DESIGN.md §9). The serial gate and local paths
# that replaced it are related to P2's Serial model through the
# transcription above; the runtime group itself stays trusted and tested by
# fl4-sim.
model: proofs/Fl4Proofs/P2/Runtime.lean
Loading
Loading