Skip to content

P1 (aarch64): close the S1A invariant (R2/R3/B2) — the decode step chains from boot - #151

Merged
losfair merged 1 commit into
losfair:mainfrom
CommaBot:pr/a64-s1a-close
Dec 3, 2026
Merged

losfair merged 1 commit into
losfair:mainfrom
CommaBot:pr/a64-s1a-close

Conversation

@CommaBot

@CommaBot CommaBot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR completes the AArch64 P1 S1A invariant line after the #146 snapshot:

  • R2: the reachable-VSpace typing invariant.
  • R3: the ASID table and pool columns.
  • B2: the decode step.

The main result is syscall.decode_invocation.s1aStepR2K: one decode_invocation step on any DecArmS1aH arm re-establishes three things:

  • S1aR2;
  • S1aKtUt;
  • S1aHiK, the kernel-table level column.

The step takes no per-step typing input, so it chains from boot. The boot entries are BootWit.w0_s1aStepEntryK and BootWit.w1K_s1aStepEntryK.

Why the old witness was dropped

The earlier step took a witness HiDelTy: full typing of every live HighVSpace root and everything below it. That is false on reachable states. A concrete sequence:

  1. Assign a HighVSpace root R and map a page table Q at R+4096.
  2. Delete the ASID pool cap. delete_asid_pool clears only the ASID-table entry, so R's cap stays live.
  3. Delete Q's last cap. unmap_page_table returns early because the ASID lookup now fails, so R+4096 → Q stays.
  4. Retype a TCB over Q.

HiDelTy would then force Q to be a page table. The replacement:

  • HiDelTyR types only what is reachable from the ASID table. This is the same shape as l4v's valid_vspace_objs.
  • HiDelTyR is a projection of R2.
  • The Assign arm takes its kernel-table levels from the new S1aHiK column.
  • S1aR2.relabel adjusts levels on unreachable tables.

Scope

README.md and DESIGN.md §9 list exactly what is covered.

  • Covered: every DecArmS1aH arm. That is the null and zombie caps, Endpoint/Notification send, Domain, Untyped, IrqControl and IRQ handler, the CNode copy/move/revoke/delete family, 16 TCB labels, SchedContext Unbind/UnbindObject/Consumed, every VCPU and EPT invocation, Frame/PageTable/root operations, and ASIDPool Assign / ASIDControl MakePool.
  • Not covered on AArch64:
    • Reply and SchedControl caps;
    • direct HighVSpace invocation;
    • CNode CancelBadgedSends;
    • TCB WriteRegisters, CopyRegisters, Resume, BindNotification, ConfigureSingleStepping, Set/Get/UnsetBreakpoint, SetTimer and WriteFPU;
    • SchedContext Bind and YieldTo;
    • Frame DeriveSubframe;
    • the unknown-label branches.
  • IoPort* and TdxControl are x86_64-only.
  • The result covers one decode step, not kernel_entry. It still takes outer inputs that its post does not return: DelIn, DecPre, SysPlace, hIq, hSC, mcp, cs and fh.

Named premises are tagged in each module docstring:

  • [P] MaxSpi, ArchPlat, KTab, A64FrameMasks, P0.ArchTotal.

Changes to statements merged in #146

#146 squashed an intermediate state of this same line. Measured against it:

Changes by cause:

  • FinKZ gained a Pt parameter and now means "every VsR kb Pt word is kept or zeroed". This implies the old form. It affects 91 statements; finKZ_s2 discharges the new premise.
  • RunW/RunB/DMU/DMB/VFW take a decode-state parameter sd, with narrower FrBw ∧ FrCw write sets.
  • FE covers any device bit. PoolPost gains zr/vs, AsgPost gains al, and ArmQIAt gains ArmVs.
  • New state and alignment premises on the arms that need them: ArmVs*, FrC, XV, page alignment.
  • 67 statements are strictly stronger: extra conclusion conjuncts, or narrower write sets.
  • cdt.delete.armQIAt moved to MdbDelVsZ with premises FrC and ArmVsZ. Its only user is updated. No alias is kept, because the old form cannot be proved without those premises.
  • DecArmKK3 moved unchanged to S1aHiK.

Verification

Final gate on this exact commit 967b763bf, private lake, tree hash checked per file:

An independent review asked for documentation and docstring fixes. Those are included, and a re-check approved them.

🤖 Generated with Claude Code

…ins from boot with the kernel-table column

The AArch64 P1 S1A line: the R2 reachable-VSpace invariant, the R3 ASID/pool
columns and the B2 decode step, completed after the losfair#146 snapshot.

- syscall.decode_invocation.s1aStepR2K: one decode_invocation step on every
  DecArmS1aH arm re-establishes S1aR2, S1aKtUt and the kernel-table level
  column S1aHiK. No per-step typing input remains: the former HiDelTy witness
  (full typing of every HighVSpace root) is false on reachable states after
  delete_asid_pool / unmap / retype, and is replaced by the reachability-
  guarded HiDelTyR, a projection of R2.
- BootWit.w0_s1aStepEntryK / w1K_s1aStepEntryK: the step's entry facts at boot.
- README and DESIGN section 9 list the covered and uncovered AArch64 arms and
  the step's outer entry inputs.

Statements merged in losfair#146 changed with the line's later generations (FinKZ
widened over Pt, decode-state parameter sd / FrCw write sets, FE over any
device bit, PoolPost/AsgPost fields); cdt.delete.armQIAt moved to MdbDelVsZ
with the FrC / ArmVsZ premises, DecArmKK3 moved unchanged to S1aHiK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@losfair
losfair merged commit 03ec12c into losfair:main Dec 3, 2026
1 check failed
losfair pushed a commit that referenced this pull request Dec 4, 2026
…-decode kernel functions (#152)

Extends #151's s1aStepR2K:

- syscall.decode_invocation.s1aStepR2All: the S1a step (S1aR2, S1aKtUt,
  S1aHiK) over every AArch64 decode arm (DecArmS1aAll), adding the rejected
  and unknown-label arms, TCB WriteFPU / SetTimer / BindNotification / Resume /
  Write/CopyRegisters, CNode CancelBadgedSends, SchedContext Bind / YieldTo,
  SchedControl ConfigureFlags and Reply. Frame DeriveSubframe stays open
  (FrObj exact size, SysL.sub_false).
- Boot: SymL at w0/w1 and DelIn at w0/w1 under a new [P] BootCanon (boot
  objects in the kernel window, witness bootCanon_ex), so w1K_bundleOf is
  unconditional.
- Non-decode kernel functions: faults and timeouts, budget checks, yield,
  receive, interrupts and VCPU exits, reply_error / reply_success, the MCS
  preemption point, each re-establishing the S1a step.
- S1aStepEnt / s1aStepEntAll: the entry-invariant fields in P1 terms on the
  fixed-heap arms (Retype and MakePool-create open).

Entry wrappers are composed at the entry level. Every statement already on
main is unchanged.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants