Repository navigation
P3 (x86): refine VM and EPT operations through kernel entry - #150
Merged
Merged
Conversation
Connect VM and EPT capability dispatch, VMEnter, host faults and interrupts, and both saved-vector VCPU exit paths to the VM-aware schedule and finish. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Scope
This completes the x86 VM Stage-2 serial core-entry refinement over
VmEptStateand the extended abstract spec. The result relates each covered entry to a spec outcome and returns the joint VM relation throughVEAny. The relation tracks the common kernel state, the VCPU images and bindings, and the EPT tables. The change is confined to Lean proofs, the saved-IRQ extension and status documentation. The Rust kernel, x86 extraction, ported seL4 spec and AArch64 proof and spec trees have no changes in this commit.Theorems
VmEptState.decodeDispassembles the per-capability decoder results inVDispAll. These include VCPU operations and replies, owned I/O ports, EPT table and frame operations, CNode labels 25–32, untyped retype and reset, EPT-root assignment and SetEPTRoot. The EPT-mapped frame cases include unmap, address, subframe and accessed-bit operations, plus the corresponding invalid-label and wrong-mapping guards. The separately provedcapDeleteandcnodeDecodeAllare carried forward into this dispatcher.VmEptState.dispatchAtdischarges the VCPU, EPT-table, EPT-mapped frame and I/O-port routes at entry. It takesVDispNativeAtfor theVs.NativeCapbranch, including the CNode, untyped, TCB and ASID-pool cap routes.handleInvocationE,afterVandVmEptPre.preemptPathVFkcarry success and preemption through the joint state.scheduleVFandfinishVFcompose timer awakening, scheduling, activation and the current VCPU check.VmEptState.dispatchVandVmEptState.kernel_entrycover native syscall dispatch and entry. Separate entry theorems covervmEnterEntry,unknownSyscallEntry,trapSyscallEntry,interruptEntry,userExceptionEntry,vmFaultEntry,vcpuExitStalledandvcpuExitUnstalled. The VMEnter proof covers VMX and SVM staging, notification completion and the budget-declined arm. The unstalled-exit proof composes timestamp, VCPU check and budget charge throughVmEptState.checkTimestampHole, including exhausted-budget outcomes and timeout suppression while the thread remainsrunningVM.Named premises
KEntryArmsV.budgetrelates the budget test after the FaultIP write.fastrelates accepted ReplyRecv and requires a decline to leave the state unchanged.dispis the native-capability dispatch agreement at a reached invocation.orcisVmOrcat each related preempted outcome.recvcovers Recv, NBRecv, Wait and NBWait.recvMidcovers the receive after a non-preempted ReplyRecv, NBSendRecv or NBSendWait first phase.yieldcovers Yield.finsuppliesKFinVEat each reachable finish.KFinVEcarrieshd(domainTime ≠ 0 ∨ NdOK),orc(VmOrc),arch(ArchSwF),archNd(ArchNdF),fo(FpuOwnOK) andidle(IdleVt). The outer event and VCPU-exit theorems quantify the same fields at each reached finish viaEventFinishVEandVcpuExitFinishVE.VmEptState,Enteredor the resumed/current-thread facts where required, the current thread outside its ready queue, and the native valid-fault-handler projection.ZvCtRunsupplies the running host caller where required. Timestamp and charge useValidMachineTimeandSched.OffReady. Fresh host IRQ usesValidIrqMasks. Ordinary unknown syscall usesFastFaultOKfor the outer fast-fault bridge.VxE,SpecGlob,PPR0,MRVand the relevant endpoint-queue (EpQPre), no-switch (Vs.NoSwitch), slot placement, CNode bound and argument/extra-cap relations. The otherVDispAllfields retain the corresponding current-thread, cap/tag, slot, VCPU placement and buffer premises, includingAbsSlot,Canonical,BufOut,VArgs,ExtraOKandExtraRel2where used. The VM proofs dischargeSigVmDonJ3and the VM signal tail. The shared scheduler's native instantiation still usesSignalJHypB.P1.LawfulStore,P1.PlainStore,P0.StoreTotal,P0.ArchTotal,StoreExt,ARIface,ARKeep,ARMaskandArchRefines. Machine-state agreement isMR a σ.machineStateand the applicableMachPlat/MachPlatC,MRKeep/MRKeepD,PPPlatAandIrqPlatA.TimeAgree,SetDlDet(the native producer usesSetDlDetR), agreement onsporadic.min_budgetandsporadic.max_release_time, theticks_to_usandmaxTicksToUsagreement, and the event-specificIrqHw,UserHwandVmfHwrecords.MachPlatsupplies the timestamp agreement before charge, including after the fresh host IRQ read.ArchSwFandArchNdFdescribe platform effects at the finish states above.ZvVirtAgree, the exact concrete backend-code agreement,ZvSyncKeep,VirtSanEq.CapAgreefor VMX control sanitization, andPortInValAt/PortInValMR.[S] Boundaries
IrqHwagreement on the line selected by the oracle, with a vector below 256. For saved guest IRQs,SavedIrqAtrelates the no-IRQ sentinel or the exact 8-bit vector. Both paths exclude remote-call IPI 126 and reschedule IPI 127. The saved path includes active and inactive device vectors and non-IPI vectors above the device range. A stalled exit skips timestamp, VCPU check and charge, and still handles its saved vector and finishes.UnkSys(out-of-range number or set trap flag) andNoDbgSys(excludes debug/TLS calls −12 through −20 and requires a disabled backend or lack of a VCPU binding for −23). The spec must select the ordinary fault case. A trapped −23 for which the spec selects VMEnter therefore falls outside that case. Trap vectors are below 256 and use FL4's zero-extended payload convention. Host fault arguments use the native hardware agreements listed above.NativeScopeis confined to native compatibility lemmas.Spec extension and shared statements
Fl4Spec/Ext/VirtExitIrqF.leanaddshandleSavedIrqVF,vcpuExitPrefixVFandfl4VcpuExitSavedVF. A captured inactive device vector is masked and acknowledged. The other vectors reusehandleInterruptVF, and the optional saved vector requires no fresh IRQ selection. The new module is documented inproofs/Fl4Spec/PORTING.md.JHoleandJTHentry witnesses useJAtZB. Their charge, budget and timeout result families also carryNatFoot, includingJHole.chargeBudget*,JHole.checkBudget*,JHole.toJand theJTH.endTimesliceTmo*and timeout IPC results. The native projectionsJAtZ.ppJHC,ppJHMandpreHoleCretain the separateJExtwitness. The shared preemption-path and post-invocation families use source-indexedJAtNin the results in place of the formerJAt,JStabandPPQJIforms, removing the correspondingVxErequirements.awaken_refinesW*,schedule_refinesW*) parameterize the timer transition relation. Native callers instantiate it withFires. The shared queue/state invariant statements (oiQ,OIK,OIKE,OIS,oi_setThreadState) takeOIx, tracking either the idle state orrunningVMand the threads allowed in that state.jowes_slotDFHtakesJAtZB. The frame-alias statements (MdbStep.frameAlias,Vs.FrameInv.alias',VsMdbInv.frameAlias) accept the source EPT bit while retaining the unmapped destination requirement.Verification
The single CommaBot commit
08cf8d52c3f0dd513b8056b4b70c423798a36b16has parentc16cc0aca44ff7436ca558d984f46db8eda16aeaand changes 157 files. It is the verified squasha7e422600with 49 unimported per-generation scratch scripts underproofs/scratch/ax73–ax82removed; every other path is byte-identical. The following ran on the verified snapshot on afkprover.lake buildpassed 10,493 jobs. Both reported zero errors and zerosorrywarnings.propext,Classical.choice,Quot.soundor has no axiom dependency.sorry,admit,axiom,opaque,native_decideorbv_decidehits, including underFl4Spec/Ext/. The final source hashes were rechecked after the build and AX sweep.🤖 Generated with Claude Code