Commit Graph

2355 Commits

Author SHA1 Message Date
Gerwin Klein 89b746ee06 aarch64 ainvs: minor progress in ArchAcc
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein 86c497a144 aarch64 ainvs: prove all easy sorries in ArchKHeap
The remaining interesting lemma (which is not proved) is
vs_lookup_non_PageTablePTE which needed two statement adjustments, one
to adjust the ptes_of update (certain that this is correct), and one to
add a new precondition valid_vspace_objs (speculative, but hopefully
enough to solve the lemma).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein 30ba342a20 aarch64 ainvs: basic storePTE/ptes_of lemmas
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein d314fc7c77 aarch64 ainvs: vspace_objs_of instead of aobjs_of
- use vspace_objs_of instead of aobjs_of where possible to reduce
  scope and make lifting rules stronger
- prove remaining lifting rules in ArchKHeap_AI

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein da6f0c2d13 aarch64 ainvs: vspace_objs_of lifting rules
- provides case split rules for vspace_objs_of lifting

- proves the provable vspace_objs_of/vspace_obj_pred lifting rules. The
  other lifting rules will need rephrasing for AARCH64 since
  vspace_objs_of does not cover all arch objects.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Gerwin Klein f2b53b6bf0 aarch64 ainvs: vspace_obs_of and vspace_obj_pred
Shows the relationship between vspace_obs_of and vspace_obj_pred.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-10-20 17:51:27 +11:00
Corey Lewis 59529d4522 infoflow: update for changed corres split rules
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-10-20 08:59:52 +11:00
Corey Lewis a52c73ad0b crefine: update for changed corres split rules
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-10-20 08:59:52 +11:00
Corey Lewis c51d812de7 riscv refine: update for changed corres split rules
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-10-20 08:59:52 +11:00
Corey Lewis b614d7ec9c arm-hyp refine: update for changed corres split rules
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-10-20 08:59:52 +11:00
Corey Lewis e23c379720 x64 refine: update for changed corres split rules
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-10-20 08:59:52 +11:00
Corey Lewis 7289575cc7 arm refine: update for changed corres split rules
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-10-20 08:59:52 +11:00
Corey Lewis f9295d6a97 drefine: update for changed corres split rules
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-10-20 08:59:52 +11:00
Corey Lewis 73a52be413 proof: change more simple corres split cases
perl -0777 -pi -e "s/corres_split_nor([\w'-]*) *\[ *OF +_ +([^_][\w'-]+) +([\w'-]+)/corres_split_nor\1\[OF \2 _ \3/g" **/*.thy
perl -0777 -pi -e 's/corres_split_nor([\w]?) *\[ *OF +_ +(?!_)/corres_split_nor\1\[OF /g' **/*.thy
perl -0777 -pi -e 's/corres_split_eqr([\w]?) *\[ *OF +_ +(?!_)/corres_split_eqr\1\[OF /g' **/*.thy
perl -0777 -pi -e 's/corres_split_mapr([\w]?) *\[ *OF +_ +(?!_)/corres_split_mapr\1\[OF /g' **/*.thy
perl -0777 -pi -e 's/corres_split_noop_rhs([\w]?) *\[ *OF +_ +(?!_)/corres_split_noop_rhs\1\[OF /g' **/*.thy
perl -0777 -pi -e 's/corres_split_dc([\w]?) *\[ *OF +_ +(?!_)/corres_split_dc\1\[OF /g' **/*.thy
perl -0777 -pi -e 's/corres_split_handle([\w]?) *\[ *OF +_ +(?!_)/corres_split_handle\1\[OF /g' **/*.thy
perl -0777 -pi -e 's/corres_split_catch([\w]?) *\[ *OF +_ +(?!_)/corres_split_catch\1\[OF /g' **/*.thy
perl -0777 -pi -e "s/corres_split_eqr(\w?) *\[ *OF +([^\W_][\w'-]+) +([^\W_][\w'-]*)/corres_split_eqr\1\[OF \3 \2/g" **/*.thy
perl -0777 -pi -e 's/corres_split_nor(\w?) *(.*)\)\n\s*prefer +2/corres_split_nor\1\2\)/g' **/*.thy

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-10-20 08:59:52 +11:00
Corey Lewis 8ffdb5eb76 proof: change simple corres_splitEE cases
perl -0777 -pi -e 's/corres_splitEE *\[ *OF +_ +([^_]\w+) +(\w+)/corres_splitEE[OF \1 _ \2/g' **/*.thy
perl -0777 -pi -e 's/corres_splitEE *\[ *OF +_ +(?!_)/corres_splitEE[OF /g' **/*.thy
perl -0777 -pi -e 's/corres_splitEE *\[ *OF +([^_]\w+) +([^_]\w+)/corres_splitEE[OF \2 \1/g' **/*.thy
perl -0777 -pi -e 's/corres_splitEE *(.*)\)\n\s*prefer +2/corres_splitEE\1\)/g' **/*.thy

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-10-20 08:59:52 +11:00
Corey Lewis f4e9295424 proof: change simple corres_split_deprecated cases
perl -0777 -pi -e 's/corres_split_deprecated *\[ *OF +_ +([^_].*)\)\n\s*prefer 2/corres_split[OF \1\)/g' **/*.thy
perl -0777 -pi -e 's/corres_split_deprecated *\[ *OF +_ +(?!_)/corres_split[OF /g' **/*.thy
perl -0777 -pi -e 's/corres_split_deprecated *\[ *OF +([^_]\w+) +([^_]\w+) +(.*)\)\n\s*prefer +2/corres_split[OF \2 \1 \3\)/g' **/*.thy
perl -0777 -pi -e 's/corres_split_deprecated *\[ *OF +([^_]\w+) +([^_]\w+)/corres_split[OF \2 \1/g' **/*.thy
perl -0777 -pi -e 's/corres_split_deprecated *(.*)\)\n\s*prefer +2/corres_split\1\)/g' **/*.thy

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-10-20 08:59:52 +11:00
Corey Lewis 6d37587b0b proof: rename corres_split' to corres_underlying_split
sed -E -i "s/\bcorres_split'\b/corres_underlying_split/g" proof/**/*.thy

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-10-20 08:59:52 +11:00
Corey Lewis 17ed8b9f25 proof: rename corres_underlying_split to corres_split_forwards
sed -E -i "s/\bcorres_underlying_split\b/corres_split_forwards'/g" proof/**/*.thy

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-10-20 08:59:52 +11:00
Corey Lewis 2cf7c367f2 arm-hyp crefine: simplify getActiveIRQ_ccorres
This rewrites the extraction function to a simpler form, which is
consistent with how the lemma is written on the other architectures.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-10-20 08:59:52 +11:00
Gerwin Klein ba033cc300 riscv haskell+proofs: fix PageTablePTE encoding
According to the RISC-V spec, PageTablePTEs must have the access,
dirty, and user bits set to 0. This means that

- there is no user attribute that can be set on PageTablePTEs
  (removed from Haskell spec)
- the encoding for PageTablePTEs in C must have 0 in these fields
  instead of 1.

See PR seL4/seL4#880 for discussion and corresponding C changes.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-07-18 10:40:17 +10:00
Ryan Barry 800f3daecd x64 ainvs+refine+crefine: update proofs
Signed-off-by: Ryan Barry <ryan.barry@proofcraft.systems>
2022-06-17 15:32:16 +10:00
Ryan Barry ac6cf91606 arm_hyp refine+crefine: update proofs
Signed-off-by: Ryan Barry <ryan.barry@proofcraft.systems>
2022-06-17 15:32:16 +10:00
Ryan Barry 7aaaabf15b riscv refine+crefine+access+infoflow: update proofs
Signed-off-by: Ryan Barry <ryan.barry@proofcraft.systems>
2022-06-17 15:32:16 +10:00
Ryan Barry 23b6184766 dspec+drefine+infoflow: update misc. proofs
Signed-off-by: Ryan Barry <ryan.barry@proofcraft.systems>
2022-06-17 15:32:16 +10:00
Ryan Barry 9bf8cf35bb refine+crefine: update refinement proofs
Co-authored-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
Signed-off-by: Ryan Barry <ryan.barry@proofcraft.systems>
2022-06-17 15:32:16 +10:00
Rafal Kolanski 02a9ecaf00 proof: remove generic monadic_rewrite lemmas
Lemmas not relying on any specifications or more local concepts will be
moved into MonadicRewrite.thy

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-06-09 08:56:37 +10:00
Rafal Kolanski 6c2e8fc4eb arm-hyp+aarch64: update for stage 1 translation changes
C code changed to drop stage 1 translation from constructing VM fault
messages when in a hypervisor context.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-06-06 10:11:40 +10:00
Rafal Kolanski f04a6319cc arm-hyp: rename addressTranslateS1CPR
renamed to: addressTranslateS1

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-06-06 10:11:40 +10:00
Rafal Kolanski fe3a4a2287 aarch64 ainvs: clean up after Machine_AI overhaul
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Rafal Kolanski 6f757d901b aarch64 ainvs: overhaul Machine_AI
Handle abstract machine ops in large crunch passes.
Clean up some proofs, standardise others, and rearrange into topical
areas.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein 420937301d aarch64 ainvs: vspace_obj_pred_aobjs lifting rule
- the lifting rule now needs an additional vcpus_of assumption
- this makes the rule not applicable any more for the proof of other
  lifting rules that are for vspace objs only; these will now need
  different proofs
- add FIXME suggestion for equivalence of projection and vspace_obj_pred

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein 7a8461d286 aarch64 ainvs: define vspace_objs_of projection
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Rafal Kolanski 997883e364 aarch64 ainvs: adapt hyp lemmas/consts from ARM_HYP
This is a rough pass over all the vcpu|vppi|vgic items found in ARM_HYP
abstract invariants. Broken items and issues tagged with FIXMEs,
lemmas sorried when possible.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Rafal Kolanski 3f85320012 aarch64 ainvs: hyp pass over ArchKHeap_AI
Some definitions needed to change to take VCPUs into account, breaking
some lifting lemmas that assumed vspace objects and arch objects were
the same thing. FIXMEs added.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Rafal Kolanski a38a4a6411 aarch64 ainvs: update valid_vso_at to exclude VCPUs
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Rafal Kolanski 99fb0e728e aarch64 ainvs: add hyp machine op crunches to Machine_AI
This indicates potential for using `crunches` to shorten many of the
empty_fail, no_fail and no_irq proofs for most machine ops.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein 74c1d392bc aarch64 ainvs: add asid_map sorries
Add statements about vmid/asid load, store, and invalidate.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein 1dd1f54f6b aarch64 ainvs: finish vspace lemma statement pass
The statements of all VSpace-related lemmas are now in as good a state
as we can predict without proving them.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein f2a2676154 aarch64 ainvs: ArchVSpace_AI statements
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein efa83df0f4 aarch64 ainvs: ArchCSpaceInvPre_AI statements
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein 1edf35a287 aarch64 aspec+ainvs: make pt_walk_is_aligned true
On RISCV64, we had the nice property that pt_walk can only produce
aligned addresses. This alignment is important for further address
computation.

It turns out that the same is true on AARCH64, because the bottom 12
bits of page table addresses are not stored in PTEs. PagePTEs can only
point to normal page tables, so there is not variation in the size of
the alignment.

This commit uses a similar encoding to RISCV64 to achieve this pt_walk
property without using an additional invariant.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein d4107e1c7c aarch64 ainvs: ArchAcc_AI statements
some follow-on effects from the removal of dmo_read_stval_inv which had
become too generic.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein e415720f5b aarch64 ainvs: lemma statements for ArchKHeap_AI
With updated statements some of the old proofs work again.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein 47b90f0d64 aarch64 ainvs: new definitions for ArchADT_AI
adjusting to arm_us_global_vspace and ptes by levels.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein c6c22e90c5 aarch64 ainvs: use projections for cur_vcpu
This makes a few lifting rules much simpler and eliminates the need for
lifting completely in some circumstances.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein a5590d7f29 aarch64 ainvs: quick_and_dirty on for development
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein 98bb90e0c3 Makefiles: remove unused report-regression target
This target was used in the regression test setup before this repo
switched to `run_tests` and has been unused for some time.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Rafal Kolanski 22b944f4cb aarch64 ainvs: bare minimum triage and sorrying
Starting point for AArch64 abstract invariant proofs.

In most cases, commented out or sorried what doesn't work. In some
cases, had to tweak definitions to get through. Marked all
problem/failure areas with FIXME AARCH64.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein 42919b2543 aarch64 ainvs: adjust copyright order
Order should be most recent first.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Rafal Kolanski ebe0359868 aarch64 ainvs: copy missing files from RISCV64
No modifications made. Use this commit to refer to what initial sorrying
run modified from standard.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein 30f50d5506 aarch64 aspec+ainvs: declare level_type a coercion
This means Isabelle will automatically insert `level_type` when it
finds a term of type `vm_level` but expects one of type `pt_type`.
This only works when the context is unambiguous, but it does make quite
a few terms shorter.

This is input-only, `level_type` will still show up in output.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein 02a33f5636 aarch64 ainvs: type change of ptTranslationBits
All instances of "bool" for page table types should now be eliminated.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein e28bf2d681 aarch64 aspec+ainvs: introduce pt types
Replaces bool with a dedicated type for page table types. This should
generalise nicely to more different levels and removes the slightly
confusing occurrence of bool.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein 6c229d7b0d aarch64 ainvs: use machine_word for table indices
This replaces 'a word for indices with machine_word. Since we can't use
a specific word length for a generic table index (because different
tables can have different index types), we don't win much by using 'a
word, but we do lose something: we must instantiate 'a when we use the
term, which means we need to decide at that point which type of table
we are talking about. This forces early case distinctions in proofs.

Using machine_word allows us to delay committing to a particular table
type and instead write a generic condition on the width of the index.

We are using machine_word instead of nat or a different specific word
length, because the index into the table is a slice of either an
obj_ref (in ptes_of) or a vref (when we do page table walks), both of
which are compatible with machine_word.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Gerwin Klein 8e92e1f702 aarch64 ainvs: adjustments for separate pte levels
With separate pte levels the proofs become simpler and shorter, but
some of the statements longer.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-06-03 09:36:43 +10:00
Corey Lewis 1a5ec996d7 proof: change crunch no_irq to prefix naming
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-05-31 11:34:29 +10:00
Corey Lewis ff975b47df lib+proof: change crunch no_fail to prefix naming
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-05-31 11:34:29 +10:00
Corey Lewis 66eda2a4d2 lib: add a crunch option for naming schemes
Some properties that crunch can be used for have different legacy naming
schemes. This commit makes it possible for different instances of crunch
to be configured for either prefix or suffix naming.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-05-31 11:34:29 +10:00
Corey Lewis 2baed2455c riscv ainvs: cleanup separate attribute declaration
It is possible to do this with one line now that crunch does not produce
duplicate attribute warnings.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-05-30 21:57:57 +10:00
Corey Lewis 4674b5ce1d squash: update other crunch instances
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2022-05-27 15:43:37 +10:00
Rafal Kolanski 9d404be331 crefine: split fastpath, rearrange Refine-based theory imports
Several parts of CRefine did not or should not depend on anything
C-related, but the import hierarchy (and theory content) did not reflect
this. Namely:
* Move_C and ArchMove_C were intended to hold items that could be moved
  to Refine yet used `kernel_m` locale and imported the C spec.
* IsolatedThreadAction indicates how to rearrange statements in the
  design spec and has nothing to do with the C spec or framework.
* Fastpath_C contained the design spec of the fastpath, the design spec
  rewrite proofs, and the C refinement. Having to rebuild nearly all of
  CRefine to work on rewrite proofs wasted time.

In the new import hierarchy:
* Move_C imports only Refine; ArchMove_C builds on Move_C
* IsolatedThreadAction imports only ArchMove_C
* The fastpath proofs are split into the spec definition (Fastpath_Defs)
  and rewrite proofs (Fastpath_Equiv), which don't depend on anything
  C-related, with their C refinement remaining in Fastpath_C.

While it is possible to separate out the fastpath definitions and rewire
proofs into a separate image or even move them to Refine, development
experience indicates keeping them alongside their C refinement remains
more convenient for the proof engineer involved.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-05-13 20:02:57 +10:00
Corey Lewis d7867393f0 crefine: remove duplicate lemmas from CLevityCatch
Signed-off-by: Corey Lewis <corey.lewis@unsw.edu.au>
2022-05-11 10:54:33 +10:00
Corey Lewis 6f13828560 crefine: remove duplicate lemma
The lemma map_to_ko_atI2 was exactly the same as map_to_ko_atI.

Signed-off-by: Corey Lewis <corey.lewis@unsw.edu.au>
2022-05-10 08:01:10 +10:00
Gerwin Klein 81857be49e aarch64 ainvs: prefer projections where possible
Use projections also for VCPU side conditions.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Gerwin Klein ece07e6991 aarch64 ainvs: consolidate bit0/bit1 lemmas
Put all lemmas for vm_level from the bit1/bit0 classes into one place
so we can later assign these automatically.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Gerwin Klein db70e3ea75 aarch64 aspec+ainvs: symbolic vs_index_len
Making vs_index_len a sybmolic value instead of a plain number means we
have to unfold config_ARM_PA_SIZE_BITS_40 less often (instead, we need
to consider both cases, which forces us to stay generic).

This also makes sure the type vs_index_len is always distinct from
pt_index_len (even if the sizes are the same), which was only
guaranteed in one of the two configurations before.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Gerwin Klein a997a65464 aarch64: generic proof for vs_root_pt_idx_distinct
The previous proof inadvertently relied on the fact that
config_ARM_PA_SIZE_BITS_40 is not configured and solved the lemma
trivially instead of really proving that case.

This is only relevant for the config_ARM_PA_SIZE_BITS_40 configuration,
which is not the current verification target, but it is nicer to stay
generic in config_ARM_PA_SIZE_BITS_40 as far as we can.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Gerwin Klein 1a3cac0a5d aarch64 ainvs: close sorries in ArchInvariants_AI
This means that the invariants are strong enough to support all of the
basic properties of page table walks and vspace address arithmetic.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Gerwin Klein d7b2098095 aarch64 ainvs: introduce invalid_mapping_slots
In some AArch64 configurations, some slots in the top-level table are
not accessible, because the IPA space size is smaller than the number
of bits the page tables can translate. invalid_mapping_slots indicates
which slots have to remain set to InvalidPTE in those tables.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Michael McInerney b84b6c3abe aarch64 ainvs: reduce sorries in ArchInvariants_AI
Signed-off-by: Michael McInerney <m.mcinerney@unsw.edu.au>
2022-05-05 09:17:25 +10:00
Gerwin Klein 502c143f05 aarch64 ainvs: ArchInvariant_AI proof progress
- update lemma statements to include pspace_distinct where needed,
  and adjust for multiple PT sizes.

- update most proofs accordingly, leave the rest sorried.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Gerwin Klein 1e0c99e774 aarch64 ainvs: strengthen level invariants
- introduce max_page_level to express that PagePTEs can only occur
  on levels 0-2 (regardless of PA/IPA space size)
- PageTablePTEs must always point to normal tables (can't point back
  to the top)
- PageTables at max_pt_level must be VSRootPTs

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Gerwin Klein 3f00c71a77 aarch64 ainvs: relationship between ptes_of and pts_of
This is a bit more complex than before. The general approach is to do
lemmas per level first, then combine them in the map union of pte_of.

For ptes_of_Some, with pspace_distinct, we get the expected two cases.
Without pspace_distinct we need in the second case a condition that the
first case doesn't apply (they are only mutually exclusive when
pspace_distinct holds).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Gerwin Klein 9ac8e43b7e aarch64 ainvs: prove sync for level_pte_of/pt_of
Confirms that the two concepts line up as intended.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Gerwin Klein f26a37cef7 aarch64 ainvs: resolve AInvs formulation FIXMEs
- void type is not used in AArch64
- remove duplication of level_of_vmsize
- state equivalence lemma
- unified formulation of valid_vspace_obj turned out to be usable so far
- confirmed that no further vmid properties are needed (in addition to
  inverse)
- removed alternative version of arch_valid_obj (but remains in history)

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Gerwin Klein 00a9f40c51 aarch64 ainvs: adapt to Isabelle2021-1
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Gerwin Klein e54d98f025 aarch64 aspec+ainvs: adjust canonical_user to IPA
Since user addresses are intermediate physical addresses in hyp mode,
the concept of canonical_user is different to other architectures.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Gerwin Klein 9a0c45a7ea aarch64 ainvs: update lemmas for cur_vcpu and vmid
These are required as interface for Invariants_AI (and generally useful)

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Gerwin Klein f49386bb09 aarch64 ainvs: sorry ArchInvariants_AI
At this stage ArchInvariants_AI should process cleanly, but is still
missing some interface lemmas for Invariants_AI.

Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Rafal Kolanski 14160ded02 aarch64 ainvs: VCPU-related invariants
Referenced from ARM_HYP and updated for AARCH64, and some tuning.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Gerwin Klein 291133761f aarch64 ainvs: first draft of AArch64 invariants
This is a first draft of what we think needs to change in the
invariants to model AArch64. VCPU-related definitions are still
missing, and further tweaks are likely.

Co-authored-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Rafal Kolanski 4ba24d0445 ainvs: remove unused requalify_consts
`wellformed_vspace_obj` is not used outside Arch locale.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Gerwin Klein 229d56cb05 aarch64 ainvs: set up ArchInvariants dependencies
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Rafal Kolanski a23e792737 aarch64 ainvs: update ArchBCorres_AI
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Rafal Kolanski ceb63634da aarch64 ainvs: init up to ArchInvariants_AI
Copied from RISCV64 with minimal search/replace, added FIXMEs.
Should be enough for formulating architecture-specific invariants.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-05-05 09:17:25 +10:00
Gerwin Klein 6418bda962 aarch64/riscv/x64: remove findVSpaceForASIDAssert
findVSpaceForASIDAssert is needed for modeling the hardware ASID lookup
on ARM. None of AARCH64, RISCV64, X64 use that mechanism and the
function is unused. There are some proof about it, but those are unused
as well. This commit removes all of these.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein 954b42cdd9 refine: speed up CSpace1_R+CSpace_R proofs
Three main thrusts:
  - speed up the `updateMDB_the_lot` chain by using more targeted
    proof methods
  - drastically reduce goal size by removing unused assumptions when
    that becomes possible (this is the largest overall speed win)
  - use `subgoal` to unblock interactive proof progress

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-19 15:27:44 +10:00
Corey Lewis 0aaeb868ce ainvs: remove unused preconditions
Signed-off-by: Corey Lewis <corey.lewis@unsw.edu.au>
2022-04-13 13:44:45 +10:00
Gerwin Klein 3a0667c1f8 proof: add missing Makefile dependencies
Both AInvs and the refinement chain need the generated files necessary
for ASpec and ExecSpec. We could depend on ASpec directly, but that
would mess with Isabelle being able to schedule sessions as it wants
them.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-08 10:59:21 +10:00
Gerwin Klein 7535796778 crefine: remove useless comments
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein c953ab0396 word_lib/proofs: bundle word simp set changes
Add a bundle for global word simp set changes -- unfortunately we
can't actually do this globally, because they are mostly simp rule
removals which will be overwritten by theory merges. So this new
l4v_word_lib bundle will have to be activated/unbundled multiple times.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein b29a3433ef isabelle2021-1: remove no_take_bit
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 6650ba5ce7 isabelle2021-1 x64: CRefine
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein bbdc1e53db isabelle2021-1 riscv: InfoFlowC
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 74536cdef1 isabelle2021-1 riscv: CRefine
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein bf8431d765 isabelle2021-1 riscv: Infoflow
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 6c938f2a35 isabelle2021-1 riscv: Access
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein b864ae0159 isabelle2021-1 riscv: Refine
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 5c03381bfb isabelle2021-1 riscv: AInvs
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein cbf8ded43b isabelle2021-1 x64: Refine
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00