Commit Graph

2355 Commits

Author SHA1 Message Date
Gerwin Klein 9ef097e85f aarch64 ainvs/cleanup: prefer invariant syntax
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 05838c4855 aarch64 ainvs: progress in ArchFinalise_AI
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 46adec77fd aarch64 ainvs: ArchIpc_AI sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 52fcfa5f06 aarch64 ainvs: ArchTcb_AI sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein ba8f8a6be3 aarch64 ainvs: ArchVSpaceEntries_AI sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 3f4f36e05a aarch64 ainvs: ArchEmptyFail_AI sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 009fa075d5 aarch64 ainvs: ArchInterrupt_AI sorry-free
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Gerwin Klein 74c525ffcc aarch64 ainvs: asid_map sorries in ArchFinalise
Close some of the more hairy asid_map-related sorries in
ArchFinalise_AI.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski 29a997e0fe riscv64+aarch64 ainvs: remove two unused lemmas
set_asid_pool_empty and delete_asid_empty_table_pt aren't used on
RISCV64 (despite being proved and declared [wp]). Hopefully these won't
be needed on AARCH64.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski 5040547836 aarch64 ainvs: progress on ArchFinalise_AI
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski 8544186298 aarch64 ainvs: ArchSchedule_AI and ArchUntyped_AI sorry-free
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski 013c4442de aarch64 ainvs: ArchDetype_AI sorry-free
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski da9939a3be ainvs: add valid_obj_arch_valid_obj
On HYP platforms with projections it's sometimes useful to be able to
grab the `arch_valid_obj` formulation for specific arch types like page
tables before the simplifier breaks them apart for you.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski 6b4f875e9e ainvs: LevityCatch: add ranD
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski 828a410137 aarch64 ainvs: ArchRetype_AI sorry-free
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski 9dfc4c9c5b ainvs: assume invs for valid_vspace_objs in locale
For AARCH64 showing that valid_vspace_objs is preserved over a retype
operation via the retype_region_proofs_invs locale, it is not sufficient
to only know valid_vspace_objs. Since this locale already assumes invs,
use invs, which implies the other requirements for AARCH64.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-09 08:26:44 +11:00
Rafal Kolanski 2909c56924 arm+arm-hyp crefine: indent pass over Fastpath_Equiv
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski 536eec39e4 proof: update copyrights for monadic_rewrite improvements
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski 60b3573d46 proof: improve monadic_rewrite usage based on new tactics
Deploy monadic_rewrite tactics, misc improvements.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski 7c127a65cd proof: apply monadic_rewrite updates (except Fastpath_Equiv in CRefine)
Adapt to changes from previous commit, mostly renames.

Fastpath_Equiv needs more work, pending tactical improvements.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski 94f21c8d09 crefine: minor improvements to IsolatedThreadAction
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski d55a65e96b proof: apply monadic_rewrite renames
renamed:
* `monadic_rewrite_refl3` -> `monadic_rewrite_pre_imp_refl`
* `monadic_rewrite_symb_exec2` -> `monadic_rewrite_symb_exec_drop`

removed:
* `monadic_rewrite_refl2`: use `monadic_rewrite_is_refl[OF ext]` instead
* `monadic_rewrite_bind2`: use `monadic_rewrite_bind_l` instead
* `monadic_rewrite_bind_alt`: use `monadic_rewrite_bind_l` instead

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski 04552f487a arm+arm-hyp crefine: clear warnings from Fastpath_Equiv
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski 82056c9746 proof: apply monadic_rewrite renames
Previous commit renamed the following:
* `monadic_rewrite_imp` -> `monadic_rewrite_guard_imp`
* `monadic_rewrite_weaken` -> `monadic_rewrite_weaken_flags`
* `monadic_rewrite_weaken2` -> `monadic_rewrite_weaken_flags'`

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski 10a814ed67 crefine: use modern datatype tech for tcb_state_regs
Using named constructor arguments added to the datatype package allows
removal of the old way of writing them out explicitly.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Rafal Kolanski f31f689609 drefine: remove unused monadic_rewrite proofs
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-11-02 05:05:44 +11:00
Gerwin Klein ce8646b0f3 aarch64 ainvs: close last sorries in ArchVSpace
This commit weakens some assumptions in previous ArchAcc lemmas and
strengthens some requirements we make on later decode lemmas, hopefully
in a still provable way.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein baf24f80aa aarch64 ainvs: ArchVSpace progress
Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein 3ec0f7dd34 aarch64 ainvs: ArchVSpace progress
Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Rafal Kolanski f182e61664 aarch64 ainvs: tweak proof of asid_high_low_inj
Generalise concept of proving word equality by splitting two words at
bit n and comparing the parts.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein f684d517e1 aarch64 ainvs: ArchVSpace progress
Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein 773f7d52f1 aarch64 ainvs: consolidate arch do_machine_op
Clean up and consolidate further do_machine_op lemmas on AARCH64.
Includes enabling some crunches and lemmas that were blocked on
do_machine_op.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein 96c934f6a5 ainvs: consolidate do_machine_op lemmas in KHeap
Clean up KHeap_AI. It turns out that almost all do_machine_op lemmas
proved here are crunchable, so move them all into on place.

This only proves lemmas originally already in KHeap_AI. It would likely
make sense to collect general do_machine_op lemmas from other places
in AInvs here as well.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein 5dfa1066ef ainvs: do not ignore maskInterrupt for crunch
It was likely a mistake from the beginning to single out this machine
op for crunch ignore here.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein 940a829321 aarch64 ainvs: prove find_free_vmid_invs
Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein 7d2af74b22 aarch64 ainvs: use vmid_for_asid as asid_map
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein b8d23e9b79 aarch64 ainvs: clear sorries up to ArchVSpace_AI
Includes some progress inside ArchVSpace_AI as well.

Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein 6beac003cd aarch64 ainvs: introduce asid_table update locale
Introduce a locale similar to Arch_pspace_update_eq, but where also
`asid_table s` is preserved. This preserves most vspace predicates and
is much more widely applicable than the existing locale in the
hierarchy that demands all of `arch_state s` to be preserved.

Since this only makes sense for Arch functions, there is no generic
version of this locale and instantiation happens only in ArchBits_AI,
not in Invariants_AI.

Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein eb093957eb aarch64 ainvs: close last sorry in ArchAcc_AI
- reduce assumptions of some of the no-loop helper lemmas
- factor out common reasoning for vs_lookup_table/pt_walk stitching
- close last sorry

Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein 6116655954 aarch64 ainvs: set_asid_pool unmap+vmid lemmas
- includes cur_vcpu lemmas for set_asid_pool and store_pte that were
  masked by the missing vmid_inv results.

- vmid_inv lemmas for the case where an entire asid pool entry is being
  removed. In this case, the vmid entry will already have been reset.

- set_asid_pool unmap lemmas reformulated from map/set restriction to
  single entry unmap, because the vmid lemmas don't make sense for sets.
  The set version was only ever used for single entries anyway, so had
  unnecessary generality.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein cd304e704d aarch64 ainvs: make store_pte_not_ao non-wp
The rule applies to anything that has `aobjs_of` in the abbreviation
stack, e.g. including asid_pools_of and vcpus_of, and is therefore too
eager for `[wp]`.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein 2be2760b64 aarch64 ainvs: abbreviation for asid construction
The pattern `(ucast high << asid_low_bits) || ucast low` occurs in
a few places in the proofs and `asid_of high low` is easier to read.

For example, it makes obvious that
`asid_low_bits_of (asid_of hi_bits lo_bits) = lo_bits`
should be a simp rule.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein 03ecc6d9fc aarch64 ainvs: make vmid_for_asid real projection
- project out the parts of the state that are needed
  (asid_pools_of and asid_table) to remove need for lifting rules
- fix argument order (state first)

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein 8a4d17d703 aarch64 ainvs: reduce sorries in ArchAcc_AI
Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein 595acd2abf riscv ainvs: fix proof indent in ArchAcc_AI
Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein 050dc0af7d aarch64 ainvs: reduce sorries in ArchAcc_AI
Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein de8ebe7219 aarch64 ainvs: reduce sorries in ArchAcc_AI
Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein 06ef438713 aarch64 ainvs: reduce sorries in ArchAcc_AI
Two key lemmas are vs_lookup_slot_unique_level and store_pte_valid_objs.
The latter needs the new concept of of valid_mapping_insert to preserve
valid_pt_range (which is part of valid_obj).

Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein 37962b303d aarch64 ainvs: prove the no-loops property
This is a bit more involved than on RISCV64, but with treating
max_pt_level separately from the rest, most of the argument can be
recovered.

Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein c1718b29eb aarch64 ainvs: prove vs_lookup_non_PageTablePTE
This includes a few hopefully useful lemmas about page table type
uniqueness.

Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00