Commit Graph

758 Commits

Author SHA1 Message Date
Gerwin Klein 223b41dbfa riscv ainvs: -2 sorries in ArchRetype_AI 2019-07-31 16:55:31 +10:00
Gerwin Klein f774c6cc27 riscv ainvs: ArchVSpaceEntries_AI sorry-free 2019-07-31 16:55:31 +10:00
Rafal Kolanski 05b547c8bf riscv ainvs: change pte to store ppn instead of address
We preserve the functionality of pte_info by converting the ppn to an address.
2019-07-31 16:55:31 +10:00
Rafal Kolanski 745b7d1863 riscv ainvs: update comment for vs_lookup_InvalidPTE proof 2019-07-31 16:55:31 +10:00
Gerwin Klein 73aa8c85e4 ainvs: adjust to new None_upd_eq[simp] context 2019-07-31 16:55:31 +10:00
Gerwin Klein 4112cae517 riscv ainvs: remove last numerical mentions of asid_high/low bits 2019-07-31 16:55:31 +10:00
Rafal Kolanski 47d8c75e76 riscv ainvs: reduce sorries in ArchAcc_AI 2019-07-31 16:55:31 +10:00
Rafal Kolanski 4e0bdf6572 riscv ainvs: reduce sorries in ArchCSpace_AI 2019-07-31 16:55:31 +10:00
Rafal Kolanski 4c190598bc riscv ainvs: change valid_vs_lookup to use asid directly
(since we always look up from ASID level)
2019-07-31 16:55:31 +10:00
Gerwin Klein 08a4b74d5a riscv ainvs: strength kernel mapping invs; close sorries in ArchAInvsPre
Kernel mapping invariants enriched to show that:
 - global tables never permit user rights
 - global top-level table has no user mappings
2019-07-31 16:55:31 +10:00
Gerwin Klein 80bbd083af riscv ainvs/cleanup: lemma moves 2019-07-31 16:55:31 +10:00
Gerwin Klein 9e83803199 riscv ainvs: close last sorry in ArchDetype_AI 2019-07-31 16:55:31 +10:00
Gerwin Klein f0d4054ec0 riscv ainvs: strengthen pt_lookup_target_pt_upd_eq; add _eqI version
(to be used in ArchDetype_AI)
2019-07-31 16:55:31 +10:00
Gerwin Klein c9399f56da riscv ainvs: proved valid_arch_state_detype 2019-07-31 16:55:31 +10:00
Gerwin Klein 254670fb54 riscv ainvs: reduce sorries in ArchDetype_AI 2019-07-31 16:55:31 +10:00
Gerwin Klein ed5b72b72a riscv ainvs: ArchCNodeInv_AI sorry-free; valid_asid_pool_caps tweak
Tweaked valid_asid_pool_caps again to be more careful about which ASIDs
are required in the caps. The previous version was too strong.
2019-07-31 16:55:31 +10:00
Gerwin Klein f39db91457 riscv ainvs: -2 sorries in ArchCNodeInv_AI
(mostly cleared by previous is_nondevice_page_cap_simps addition)
2019-07-31 16:55:31 +10:00
Gerwin Klein f2f9c68fc4 riscv ainvs: -1 sorry in ArchCNodeInv_AI; is_nondevice_page_cap_simps 2019-07-31 16:55:31 +10:00
Gerwin Klein c44392fd89 riscv ainvs: ArchTCB_AI sorry-free 2019-07-31 16:55:31 +10:00
Gerwin Klein 8725351ccc riscv ainvs: ArchCSpaceInv_AI sorry-free; fix replaceable_final_arch_cap 2019-07-31 16:55:31 +10:00
Gerwin Klein 4754ebbf7e riscv ainvs: fewer sorries in ArchCSpaceInvPre_AI; adjusted invariants
1 sorry left, which should disappear after sync with work in ArchAcc_AI.

Strengthened valid_asid_pool_caps invariant to same phrasing as valid_vs_lookup
to get uniform preconditions for set_cap.

Strengthened reachable_target to actually cover all reachable targets of a
lookup (incl ASIDPools).
2019-07-31 16:55:31 +10:00
Gerwin Klein 956255809e riscv ainvs: sync ArchKernelInit_AI with invariant changes 2019-07-31 16:55:31 +10:00
Gerwin Klein f2ed0a5944 riscv ainvs: tweak valid_uses invariant to solve sorry in ArchAInvsPre
We previously had the user region from 0 to user_vtop, which does not
necessarily include all canonical addresses in the low range. However, even if
users are not able to map anything above user_vtop, they can still access a
virtual address > user_vtop, and our invariants cover this case. (Either the
address will simply not be mapped or it will be a lookup into the kernel part
of the vspace, i.e. a page fault for the user).

This commit introduces canonical_user as the largest canonical address in the
low range of canonical addresses, which is the range reserved for users.
2019-07-31 16:55:31 +10:00
Gerwin Klein bee9099ae6 riscv ainvs: implement arch ADT interface; reduce ArchAInvsPre sorries
The remaining 3 sorries in ArchAInvsPre need small invariant changes.
2019-07-31 16:55:31 +10:00
Gerwin Klein 65cc19c172 lib: move up library lemmas from RISCV64 and X64 2019-07-31 16:55:31 +10:00
Gerwin Klein 3cc2aa477e riscv ainvs: ArchKHeap_AI sorry-free
Weakened assumptions of lifting lemma in ArchInvariants_AI for the proofs in
ArchKHeap_AI to go through.
2019-07-31 16:55:31 +10:00
Gerwin Klein 3a5cc87d67 ainvs: allow multiple assumptions in use of lifting rule 2019-07-31 16:55:31 +10:00
Gerwin Klein fdc14273a8 riscv ainvs: ArchDetSchedSchedule_AI sorry-free 2019-07-31 16:55:31 +10:00
Gerwin Klein 557803c8c4 riscv ainvs: ArchTcbAcc sorry-free
(proof from X64)
2019-07-31 16:55:31 +10:00
Gerwin Klein b8ed8a6115 riscv ainvs: ArchSchedule sorry-free 2019-07-31 16:55:31 +10:00
Gerwin Klein b99de6bee7 riscv ainvs: clear sorry in ArchIpc_AI 2019-07-31 16:55:31 +10:00
Gerwin Klein eb15e6a350 riscv ainvs: clear sorries related to decoding 2019-07-31 16:55:31 +10:00
Gerwin Klein 0154a8bb77 riscv ainvs: clear sorries related to handle_vm_fault 2019-07-31 16:55:31 +10:00
Gerwin Klein c7d055eaa8 riscv ainvs: clear sorries related to user_vtop adjustment 2019-07-31 16:55:31 +10:00
Gerwin Klein 0dad1f53ab riscv ainvs: remove warnings for pt_slot_offset_id
(now in simpset)
2019-07-31 16:55:31 +10:00
Gerwin Klein 87afc177f1 riscv ainvs: strengthen valid_uses for C sync; prove it consistent
C now has a user_vtop different from pptr_base, so valid_uses needed updating,
and since the intervals don't fully join up any more, also strengthening of the
user and kernel window properties.

To make sure this is all still consistent, there is now an example state in
ArchKernelInit_AI that is shown to satisfy these conditions.
2019-07-31 16:55:31 +10:00
Gerwin Klein 9187c7d826 riscv ainvs: remove sorries caused by SELFOUR-1955
Currently this is a workaround, because the defect still exists, but if the
fix is done right, none of these proofs should have to change.
2019-07-31 16:55:31 +10:00
Rafal Kolanski 3f32b21d3c riscv ainvs: add valid_global_tables to valid_arch_state
Previously valid_global_tables was nor deriveable from invs.
The best place I could think to put it is inside valid_arch_state.

This made a mess of some valid_arch_state_lift-related lemmas and
trivial valid_arch_state preservation in two cases, but seems a decent
tradeoff.
2019-07-31 16:55:31 +10:00
Rafal Kolanski 762c3f1eea riscv ainvs: progress on ArchAcc_AI
set_pt_caps_of_state
store_pte_valid_objs
set_pt_equal_kernel_mappings
2019-07-31 16:55:31 +10:00
Rafal Kolanski 07f10f986e riscv ainvs: convert valid_global_tables to _2 style 2019-07-31 16:55:31 +10:00
Rafal Kolanski ab23a6bd45 riscv ainvs: preservation of valid_global_tables over set_pt 2019-07-31 16:55:31 +10:00
Rafal Kolanski 4319e81887 riscv ainvs: tweak global mapping invariants, port lookups to projections
Main change is valid_global_tables, which was previously insufficient
for preservation proofs over set_pt.
2019-07-31 16:55:31 +10:00
Gerwin Klein 014f351265 riscv ainvs: global crunch ignore for recursive pt_lookup_from_level 2019-07-31 16:55:31 +10:00
Gerwin Klein 46d1ba3cc4 riscv ainvs: remove ARM ref 2019-07-31 16:55:31 +10:00
Gerwin Klein da26a83c18 riscv ainvs: finished sorrying AInvs 2019-07-31 16:55:31 +10:00
Gerwin Klein 06672e9724 riscv ainvs: sorried up to end AInvs 2019-07-31 16:55:31 +10:00
Gerwin Klein 78b1d07bb9 riscv ainvs: sorries for ArchADT, ArchUntyped, ArchArch 2019-07-31 16:55:31 +10:00
Gerwin Klein a37d867e66 riscv aspec: abbreviations for asid_table & pt table base + index
(moved from riscv ainvs)
2019-07-31 16:55:31 +10:00
Gerwin Klein bdd9a3f1ea riscv ainvs: introduce second_level_tables as interface concept 2019-07-31 16:55:31 +10:00
Gerwin Klein f9e6607ea3 ainvs: sync ARM/ARM_HYP/X64 with lemmas that are now arch dependent 2019-07-31 16:55:31 +10:00
Gerwin Klein b147fe7d9d riscv ainvs: sorried ArchDetype_AI 2019-07-31 16:55:31 +10:00
Gerwin Klein 4eba33e349 ainvs: move unique_table_refs into arch 2019-07-31 16:55:31 +10:00
Gerwin Klein 2eb3cd3917 riscv ainvs: sorried ArchTcb, ArchEmptyFail, ArchCNodeInv, ArchBCorres2 2019-07-31 16:55:31 +10:00
Gerwin Klein 749546cf6e riscv ainvs: sorried ArchIpc_AI and ArchInterrupt_AI 2019-07-31 16:55:31 +10:00
Gerwin Klein d23772ce64 riscv ainvs: sorried ArchFinalise_AI 2019-07-31 16:55:31 +10:00
Gerwin Klein cf1c3b898c riscv ainvs: sorry ArchIpcCancel, ArchRetype, and ArchSchedule 2019-07-31 16:55:31 +10:00
Gerwin Klein 5321c8f340 ainvs: move Retype_AI lemma to arch for RISC-V 2019-07-31 16:55:31 +10:00
Gerwin Klein 5315a4f030 riscv ainvs: sorried ArchVSpace_AI 2019-07-31 16:55:31 +10:00
Gerwin Klein 585989948a riscv ainvs: two more lemma statements for store_pte_*_map 2019-07-31 16:55:31 +10:00
Rafal Kolanski d91c83f3a6 riscv aspec+ainvs: rename lookup_pt_* to pt_lookup_* to resemble vs_lookup_*
More consistent naming, easier to remember.
2019-07-31 16:55:31 +10:00
Rafal Kolanski 2dd69a1b7e riscv ainvs: progress on set_pt_valid_global_vspace_mappings
Removed a number of previous dependencies that are now irrelevant.
2019-07-31 16:55:31 +10:00
Rafal Kolanski e60ee77c86 riscv ainvs: introduce lookup_pt_target, reformulate valid_global_tables
- translate_address now uses lookup_pt_target
- valid_global_tables now resolves from riscv_global_pt instead of all
  ASIDs
2019-07-31 16:55:31 +10:00
Gerwin Klein 2f9e070f99 riscv ainvs: more store_pte properties 2019-07-31 16:55:31 +10:00
Gerwin Klein 602dfd2317 riscv ainvs: lifting lemma for vspace_for_asid 2019-07-31 16:55:31 +10:00
Gerwin Klein 0009222876 riscv ainvs: fix lemma name in ArchCSpacePre_AI 2019-07-31 16:55:31 +10:00
Gerwin Klein d9d1e6d472 riscv ainvs: begin sorrying ArchVSpace_AI 2019-07-31 16:55:31 +10:00
Gerwin Klein 4c6b8c4dcd riscv ainvs: sorried ArchInterruptAcc_AI 2019-07-31 16:55:31 +10:00
Gerwin Klein a9d866c870 riscv ainvs: add saturated version of vs_lookup_pages_arch_update for simp 2019-07-31 16:55:31 +10:00
Gerwin Klein 8f119cbfec riscv ainvs: sorried ArchTcbAcc_AI 2019-07-31 16:55:31 +10:00
Gerwin Klein d0a5262b04 riscv ainvs: restore complex form if interface lemma
(The simpler form breaks the generic proofs that expect the more complex statement)
2019-07-31 16:55:31 +10:00
Gerwin Klein eb7adb182a riscv ainvs: sorried ArchCSpacePre_AI and ArchCSpace_AI 2019-07-31 16:55:31 +10:00
Gerwin Klein a2a5163712 ainvs: make another lemma arch specific (unique_table_refs again) 2019-07-31 16:55:31 +10:00
Gerwin Klein bd88d2906b riscv ainvs: sorried ArchCSpaceInv_AI 2019-07-31 16:55:31 +10:00
Gerwin Klein 63a49d469d riscv ainvs: provide arch_cap_simps and enriched cap_simps 2019-07-31 16:55:31 +10:00
Gerwin Klein 4fd8eba182 riscv ainvs: make unique_table_refs lemma arch specific
This lemma worked by (planned) accident for all architectures so far, but
the type of unique_table_refs is different on RISC-V
2019-07-31 16:55:31 +10:00
Gerwin Klein 6c540c37d8 riscv ainvs: add interfaces lemmas to ArchInvariants_AI 2019-07-31 16:55:31 +10:00
Gerwin Klein b1f444be6b riscv ainvs: sorried ArchCSpaceInvPre_AI 2019-07-31 16:55:31 +10:00
Gerwin Klein 2c2e82c94c riscv ainvs: tweak vs_cap_ref_arch to include ASIDPoolCaps
The ASIDPoolCap case is not used in the invariant definitions, but
is convenient later in the proofs.
2019-07-31 16:55:31 +10:00
Gerwin Klein 537992b41e riscv ainvs: add interface definitions; refactor invariants for clarity
All invariants that are pure interface definitions and otherwise
unused in RISC-V are now collected in a separate section to make more clear
what is used and what is not.

Added definitions for cap_asid and empty_table, which turns out is needed in
its complex form, because it is used in generic theorems. The simple form lives
on as empty_pt.
2019-07-31 16:55:31 +10:00
Gerwin Klein a4bbab0985 riscv ainvs: sorried ArchAcc_AI
co-authored-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2019-07-31 16:55:26 +10:00
Gerwin Klein 5d6fd554f2 riscv ainvs: tweak valid_vs_lookup invariant
Mask out bottom bits of asid and vref in the cap; otherwise this
invariant would demand many caps for the same vspace object, one for
each combination of bottom "junk" bits.

co-authored-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2019-07-31 16:26:36 +10:00
Gerwin Klein 0fcc2c8a6f riscv ainvs: factor out has_kernel_mappings for use in preconditions later 2019-07-31 16:26:36 +10:00
Gerwin Klein 3be3a8ea8a riscv ainvs: global pts must point to page tables 2019-07-31 16:26:36 +10:00
Gerwin Klein 12d4439ddb ainvs: make some KHeap lemmas arch specific
These lemmas have different statements in RISC-V
2019-07-31 16:26:36 +10:00
Gerwin Klein c2e95e53c9 riscv ainvs: eta expand def for later unfolding 2019-07-31 16:26:36 +10:00
Rafal Kolanski bea2739ff2 riscv ainvs: a few more lifting lemmas in ArchKHeap_AI 2019-07-31 16:26:36 +10:00
Gerwin Klein 3c64ec187a riscv ainvs: proof progress: invalidating pte mappings
co-authored-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2019-07-31 16:26:36 +10:00
Gerwin Klein b6301ba636 riscv ainvs: initial invariant setup for RISC-V and initial proofs
co-authored-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2019-07-31 16:26:36 +10:00
Gerwin Klein 78e57e2d90 ainvs: add a type projection
currently only used in RISC-V, but should replace typ_at (or make typ_at an abbreviation for it) over time.
2019-07-31 14:13:56 +10:00
Gerwin Klein f59639342c ainvs: changes to generic invariants to accomodate RISC-V
These changes are mostly removing declarations and lemmas, making them
architecture specific.
2019-07-31 14:13:56 +10:00
Amirreza Zarrabi ac886401d7 ainvs: add support to thread id registers 2019-06-28 11:34:13 +10:00
Gerwin Klein c34840d09b global: isabelle update_cartouches 2019-06-14 11:41:21 +10:00
Michael McInerney 3300e119be ainvs: minor update for Isabelle2019 not included in previous commit 2019-06-13 16:22:33 +10:00
Michael McInerney 26fdedad4d ainvs, spec: changes to remove errors for Isabelle 2019 update 2019-06-13 16:22:33 +10:00
Michael McInerney 4463e9750e SELFOUR-1198: update proofs for correct restart PC
Fixes a case where a thread can go from Running->Inactive->Restart and
use a restart PC that is out of date. An out of date restart PC occurs
when a thread was transitioned to running after being in a blocked
state, but was never scheduled and so did not execute the traps code
that updates the restart PC.

This also renames relevant register names for consistency across
architectures (FaultIP and NextIP).
2019-06-13 11:43:50 +10:00
Michael McInerney 4a07af9d9d ainvs refine: update arch-split locale names
Previously, some arch-specific names were qualified with the wrong
architecture abbreviation.
2019-06-13 11:43:50 +10:00
Michael McInerney aec289ceb6 ainvs cleanup: remove unused as_user_valid_vspace_objs lemmas 2019-06-13 11:43:50 +10:00
Michael McInerney 75f1a25948 ainvs: add as_user_bind lemma 2019-06-13 11:43:50 +10:00
Victor Phan 1689dd94fe cleanup
arm ainvs: cleanup

Abbreviate Hoare triples that do not care about the return value and
whose pre and post conditions are the same.

x64 ainvs: cleanup

ainvs: cleanup

x64 ainvs: cleanup

drefine: cleanup
2019-04-18 14:32:08 +10:00
Victor Phan c9094ccbb3 ainvs: update for new definition of set_object
Added set_object_wp_strong, which infers from a given hoare triple with
command set_object that the object of same type already exists in the
heap, and hoare_set_object_weaken_pre which does the same thing, but can
be applied on top of existing lemmas about set_object.

ainvs: improve proof of set_thread_state_runnable_valid_blocked

ainvs: change return value to a more general one

in_set_object has a return value that is empty '()', but the theorem
still holds true when replaced with a generic parameter 'rv' making it
easier to use this lemma.

ainvs: trivial - updated style of proof

ainvs: strengthen set_object_idle lemma

Add conditions imposed by valid_idle into precondition.
Thank you to Matt Brecknell for the help.

ainvs: abbreviated Hoare triples and proof fix

ainvs: restated set_object_wp_strong with auxiliary lemmas

ainvs: update for new definition of set_object

ainvs: update for new definition of set_object

Move in a few set_object and set_aobject theorems from x64 theory files
as these theorems were architecture generic.

ainvs: update for new definition of set_object

ainvs: update for new definition of set_object
2019-04-18 14:32:08 +10:00
Victor Phan e9449ee263 x64 ainvs: update for new definition of set_object
Removed update_object, which does the same thing as the new version of
set_object, and replaced it with set_object.

x64 ainvs: update for new definition of set_object

Rename legacy update_object definitions to set_object definitions and
remove related lemmas (to move up into architecture generic
KHeap_AI.thy). Remove simpler_defs as the set_object definitions are now
equivalent.

x64 ainvs: move x64 specific lemma back to ArchKHeap_AI

set_aobject_valid_arch move back after confirmation with Matt Brecknell
that it is x64 specific

x64 ainvs: update for new definition of set_object

Fixed some proofs a result of removing set_arch_obj_simps from the simp
set.
2019-04-18 14:32:08 +10:00
Victor Phan 71b6cfccef arm-hyp ainvs: update for new definition of set_object 2019-04-18 14:32:08 +10:00
Victor Phan 96787bae7a arm ainvs: update for new definition of set_object 2019-04-18 14:32:08 +10:00
Michael Sproul 045683cd9c ainvs: Rights_AI theory with facts about VM rights
SysInit requires some facts about VM rights that are shared with AInvs, so this
commit introduces a new theory to contain the shared lemmas.
2019-02-19 14:24:41 +11:00
Japheth Lim 3fc4166e7e AInvs: cleaner way to express ARM page table alignment 2019-02-01 14:11:37 +11:00
Japheth Lim 016a5d33ac AInvs: adjust pointer alignment invariants for PTEs, PDEs, etc.
Addresses issue VER-1036.

Previously, there were pointer alignment invariants in valid_pte, etc.
However, these had two problems:
1. valid_pte was conditioned on the PTE being mapped, so we couldn't
   rely on PTE pointers being aligned unconditionally (see VER-1036).
2. The existing alignments were actually incorrect for large pages.
   Proofs that needed the true alignments, obtained them from other
   parts of invs (e.g. valid_objs).

This commit moves the alignment invariants to wellformed_pte, etc.
and changes them to use the correct values.
2019-02-01 14:11:37 +11:00
Thibaut Perami 86bbe323c8 access: Fix for GrantReply (SELFOUR-6)
Integrity and pasRefined are majorly changed

The main repercussions are:
 - 3 new authorities in the policy: Call, Reply, and DeleteDerived
 - The cdt and the caps state are linked in pasRefined
 - CDT parentship no longer implies control in certain cases (is_transferable)
 - CDT parentship now implies DeleteDerived
 - Introduction of cdt_change_allowed that specifies which slot your are
   allowed to modify
 - Integrity for CDT and CDT list use cdt_changes_allowed
 - Integrity for objects in now expressed as a transitive closure of
   atomic transition rules
2018-12-10 20:01:38 +11:00
Rafal Kolanski 8d137b4e86 x64 ainvs: update for GrantReply (SELFOUR-6) 2018-12-10 20:01:38 +11:00
Rafal Kolanski 25a6d636e0 arm-hyp ainvs: cleanup: unused lemmas 2018-12-10 20:01:37 +11:00
Rafal Kolanski 1975b57c11 arm-hyp ainvs: update for GrantReply (SELFOUR-6) 2018-12-10 20:01:37 +11:00
Thibaut Perami c955ff4917 aspec + arm ainvs: Update mask_rights to mask master reply caps 2018-12-10 20:01:37 +11:00
Thibaut Perami d3548a5720 arm ainvs: Cleanup 2018-12-10 20:01:37 +11:00
Thibaut Perami 2c065aa62c arm ainvs: Add is_valid_vtable_root as vtable_slot invariant 2018-12-10 20:01:37 +11:00
Thibaut Perami 3f26cde16a arm ainvs: Update for GrantReply (SELFOUR-6) 2018-12-10 20:01:37 +11:00
Japheth Lim fd6d4b87ae refactor einvs from Refine and Access into AInvs 2018-11-20 16:34:29 +11:00
Santiago Bautista d930ef2c09 arm-hyp ainvs: prove that the vcpu of the idle thread is always None
* Context :

 We would like to prove that, for ARM_HYP architecture,
  the current vcpu is always the vcpu associated to the current thread.
 See issue https://jira.csiro.au/browse/VER-770
  and PR 291 http://bitbucket.keg.ertos.in.nicta.com.au/projects/SEL4/repos/l4v/pull-requests/291

* Intermediate step : the vcpu of the idle thread is always None

 In this commit we update the proofs of abstract invariants for
  the arm_hyp architecture, so that the new version of `valid_idle`,
  stating that the vcpu of the idle thread is always None, holds.
2018-10-31 18:04:59 +11:00
Santiago Bautista 611ec8c5e0 ainvs: changed definition of `valid_idle` + `idle_tcb_at` ; defined `valid_arch_idle` invariant
* Context :

 We would like to prove that, for ARM_HYP architecture,
 the current vcpu is always the vcpu associated to the current thread.
 See issue https://jira.csiro.au/browse/VER-770
 and PR 291 http://bitbucket.keg.ertos.in.nicta.com.au/projects/SEL4/repos/l4v/pull-requests/291

* Intermediate step : the vcpu of the idle thread is always none

 In this commit, we modify the `valid_idle` invariant so that it includes
  the fact that the vcpu of the idle thread is always None.
 This is needed for PR291 (see Context above).
  `valid_idle` beeing defined with `idle_tcb_at`,
  we changed the definition of `idle_tcb_at`
  so that it can convey information about the architecture.
 And we defined `valid_arch_idle`
  that states that the vcpu of an iarch_tcb is None.

* What changed :

 Even if these changes are only interesting for the
  abstract invariants for arm_hyp architecture
  (that are being extended),
  it implied changes to several generic and architecture-specific
  files of the astract invariants (AInvs) sessions.

Co-authored-by : Corey Lewis <corey.lewis@data61.csiro.au>
Co-authored-by : Santiago Bautista <santiago.bautista@data61.csiro.au>
2018-10-31 18:04:59 +11:00
Gerwin Klein c53f7850d7 Base ASpec + machine on OptionMonad_ND; fix proof fallout 2018-10-25 12:54:02 +11:00
Gerwin Klein b064281eb5 ainvs: clean up and arch split BCorres
RISCV64 will need slight variations in the arch dependent proofs
2018-10-25 12:54:02 +11:00
Gerwin Klein 15bfcdd98b reduce DRefine dependencies from Refine to AInvs
This needs (and includes) some deduplication and moving of lemmas formerly in
refine.
2018-10-22 13:21:11 +11:00
Edward Pierzchalski c4dc578bc3 Fix up proofs after word lemma moves 2018-10-10 14:15:01 +11:00
Edward Pierzchalski d75740201c Remove pure word lemmas from proof/*
Removes redundant lemmas after moving them up to Word_Lib.
2018-10-10 14:15:00 +11:00
Mitchell Buckley 8173a37c2d Updated specs and proofs for SELFOUR-1491: control IRQ triggering on ARM. 2018-09-19 16:18:09 +10:00
Gerwin Klein 590b83ceb7 Isabelle2018 arm: AInvs 2018-08-20 09:06:36 +10:00
Gerwin Klein 6b9d9d24dd Isabelle2018: new "op x" syntax; now is "(x)"
(result of "isabelle update_op -m <dir>")
2018-08-20 09:06:35 +10:00
Gerwin Klein 011e08458e Isabelle2018: new comment syntax
(result of "isabelle update_comments <dirs>")
2018-08-20 09:06:35 +10:00
Gerwin Klein b5cdf4703f globally use session-qualified imports; add Lib session
Session-qualified imports will be required for Isabelle2018 and help clarify
the structure of sessions in the build tree.

This commit mainly adds a new set of sessions for lib/, including a Lib
session that includes most theories in lib/ and a few separate sessions for
parts that have dependencies beyond CParser or are separate AFP sessions.
The group "lib" collects all lib/ sessions.

As a consequence, other theories should use lib/ theories by session name,
not by path, which in turns means spec and proof sessions should also refer
to each other by session name, not path, to avoid duplicate theory errors in
theory merges later.
2018-08-20 09:06:34 +10:00
Gerwin Klein ead3e6fdc4 aspec: message_info_to_data is mostly arch independent
Factored out msg_label_bits, which is the only architecture specific part.
2018-08-06 11:22:51 +10:00
Gerwin Klein 8f1122270c aspec/ainvs: move TLS/ipc buffer FIXME to appropriate position in ADT_AI 2018-08-06 11:22:49 +10:00
Thomas Sewell 26049db669 Repair proofs for wpsimp/crunch changes.
A handle of fiddly proofs change slightly. A common offender involves
tcb_cap_cases, which should be unfolded with the ran_tcb_cap_cases
rule where possible rather than with tcb_cap_cases_def.
2018-08-03 18:25:30 +10:00
Joel Beeren 7f52da6571 x64: ainvs+refine: fix up proofs for decodeX64FrameInvocation changes 2018-07-05 16:23:15 +10:00
Joel Beeren 5ed7bb16be x64: fix up definition of performPageInvocation for unmapping pages 2018-07-05 16:23:15 +10:00
Michael Sproul b91ee8e4d0 x64: spec+ainvs+refine: add machine ops for nativeThreadUsingFPU and switchFpuOwner 2018-07-05 16:23:15 +10:00
Michael Sproul 43f482ab26 x64: ainvs: refine: changes for IRQ invocations (VER-879) 2018-07-05 16:23:15 +10:00
Michael Sproul c481c7d2df x64: set cteRightsBits to 0 (VER-930) 2018-07-05 16:23:15 +10:00
Joel Beeren 8953543843 x64: ainvs+refine: remove invalidateASIDEntry, simplify with just hwASIDInvalidate 2018-07-05 16:23:15 +10:00
Joel Beeren d4b830738f x64: ainvs: cleanup after ioportcontrol 2018-07-05 16:23:15 +10:00
Joel Beeren bdbcda7b3d x64: VER-917: ensure map type and vspace mappings are consistent 2018-07-05 16:23:15 +10:00
Matthew Brecknell f649240cde x64: CR3 and machine op updates for Meltdown 2018-07-05 16:23:15 +10:00
Matthew Brecknell a3de401c09 x64: more abstract specs and invariants for ASIDs 2018-07-05 16:23:15 +10:00
Rafal Kolanski d15b4e5cb6 x64 ainvs: preservation of canonical_address under addition 2018-07-05 16:23:14 +10:00
Corey Lewis c71fa27e14 Whitespace and typos 2018-07-03 13:42:23 +10:00
Maksym Bortin 9d315cda20 ainvs+refine: update proofs for SetTLSBase (VER-807) 2018-07-03 13:42:19 +10:00
Corey Lewis 967a091cf6 ainvs: Remove unnecessary crunches and whitespace 2018-06-27 11:48:56 +10:00
Corey Lewis 97c24b95c9 ainvs: Add itcb_arch to the itcb projection
This allows us to more easily show that arch specific tcb fields are
preserved by many functions of the spec. For ARM_HYP we add a
projection for the tcb_vcpu field.
2018-06-27 11:48:56 +10:00
Corey Lewis d77d31a77c lib: Refactor crunch so that it can be used for both the nondet monad and the trace monad 2018-06-26 14:45:28 +10:00
Rafal Kolanski 15d6b62040 arm: address setCurrentPD mismatch between abstract/haskell/C
ARM setCurrentPD was recently refactored as part of multi-VM support for
ARM_HYP. The Haskell was updated correctly, and the C was not.
Unfortunately, setCurrentPD was manually redefined in MachineOps.thy for
ARM hiding the change, making the C look correct when it wasn't.

We scrap the second definition of setCurrentPD, load it from the Haskell,
and have an abstract set_current_pd that's a bit simpler to refine down
from.

The proofs are updated for the above change and the update to the C
setCurrentPD that was breaking on KZM.
2018-06-22 11:59:30 +10:00
Rafal Kolanski 4a3d7a958c arm-hyp: update proofs for SELFOUR-584: running multiple VMs on ARM
As requested by verification, hypervisor registers are now an
enumeration-indexed array rather than individual fields. This cleans up
some of the proof. Additionally, we sweep some non-complexity under the
machine op rug: vcpu_hw_write/read_reg_ccorres is as deep as we go,
rather than specifying every operation and proving that
vcpu_hw_write seL4_VCPUReg_REG calls set_REG for every REG

I took this opportunity to clean up some arm-hyp definitions and proofs,
so some whitespace cleanup got tangled in.
2018-06-15 18:48:47 +10:00
Joel Beeren 25125763bd arm-hyp: ioportcontrol: fixes after adding IOPortControlCaps to x64 2018-04-19 05:27:06 +10:00
Joel Beeren 1634608453 arm: ioportcontrol: Fixes after adding IOPortControlCaps to x64 2018-04-19 05:27:06 +10:00
Joel Beeren f728dd25e8 x64: Add IOPortControlCaps to control IO port allocation
The previous implementation of IOPortCaps has problems with revocability
and determining parency etc. This commit adds IOPortControlCaps which
behave identically to IRQControlCaps -- invoking the IOPortControlCap
allows one to create IOPortCaps with the supplied range.

There now exist invariants to show that there is only one
IOPortControlCap and that all IOPortCaps in the system do not overlap.
Furthermore there is a global record of which IO ports have been
allocated to prevent reissuing the same ports.
2018-04-19 05:27:06 +10:00
Joel Beeren 02e5096534 x64: VER-917: correct VSpace invocations to update map_type, and add invariants to check that maptype and mapped addresses correspond for PageCaps 2018-04-19 05:27:05 +10:00
Corey Lewis 2d0baab462 Proof update for crunch changes 2018-04-04 14:13:55 +10:00
Thomas Sewell 0f38e20094 Many proof repairs. 2018-03-16 14:57:51 +11:00
Thomas Sewell 652cbb966e Initial proof updates for combinator changes. 2018-03-16 14:53:22 +11:00
Gerwin Klein 830f407d7f arm-hyp ainvs: proof update for user_context refactor 2018-03-08 18:41:28 +11:00
Gerwin Klein 8601dce656 ARM ainvs: proof update for user_context refactor 2018-03-08 18:41:28 +11:00
Gerwin Klein b29e9c9fd3 x64 ainvs: proof update for user_context refactor 2018-03-08 18:41:28 +11:00
Michael Sproul f0795805d1 SELFOUR-1016: fix confused deputy problem when setting priorities 2018-02-26 11:19:43 +11:00
Joel Beeren 4601f2a1ab Genericise deletion actions that occur after empty_slot
This patch adds a generic "post_cap_deletion" step that is called by
finalise_slot. Previous to this, the only caps which had actions
required at this stage were IRQHandlerCaps -- it was required that the
IRQ bitmap be updated after the cap itself was removed (as the
invariants state that for any existing IRQHandlerCap, the corresponding
bit in the IRQ bitmap must be set).

By genericising this, we add the capacity for new, arch-specific post
cap deletion actions to occur in the future.
2018-02-23 09:12:55 +11:00
Miki Tanaka 9fb7c5cf4d arm_hyp ainvs: fix a typo 2018-01-30 12:00:25 +11:00
Miki Tanaka 4efe5392f7 arm ainvs: fix a typo 2018-01-30 12:00:21 +11:00
Gerwin Klein 3bc1cb7f71 x64: update ainvs for asid_map removal 2018-01-11 18:48:37 +11:00
Matthew Brecknell 2f540e802c add constant definitions for bounds on untyped object sizes 2017-12-18 12:58:27 +11:00
Matthew Brecknell a1b60083e8 x64 ainvs: add some lemmas about canonical addresses 2017-12-18 12:57:55 +11:00
Miki Tanaka dcca6d496f x64 ainvs/refine: simple_ko setter/getter 2017-12-14 18:03:41 +11:00
Miki Tanaka 6eb2cb74ad arm-hyp: simple_ko setter/getter 2017-12-14 18:03:31 +11:00
Miki Tanaka b37bc04463 arm ainvs: wp rules for simple_ko setter/getter 2017-12-14 18:02:44 +11:00
Miki Tanaka 3841b6e8ba arm : add AEndpoint and ANTFN a_type simplification
in addition to the a_type ATCB simplification, the following two are now in the simpset:
  "a_type (Endpoint x) = AEndpoint"
  "a_type (Notification v) = ANTFN"
2017-12-14 07:17:27 +11:00
Joel Beeren ffc0640869 VER-853: put arch_check_irq into the Arch locale, and update x64 to match C 2017-12-13 12:13:36 +11:00
Joel Beeren b01b341b3c x64: adjust definition of Arch.switchToIdleThread (VER-848) 2017-12-13 12:13:36 +11:00
Joel Beeren a5a5edc832 VER-849: abstractly declare a threads registers have changed
This removes an ifdef present in invokeTCB_(Copy|Write)Registers, and
adds the function Arch_postModifyRegisters which does nothing on any
arch except x86-64.
2017-12-13 12:13:36 +11:00
Rafal Kolanski 2f28bfeaec x64: revise scheduler / fastpath / scheduler bitmaps (SELFOUR-242)
Apply "invert-fastpath" changes to x64 (ainvs, refine, partial crefine).
See main commit for arm for more context.
2017-11-27 22:05:46 +11:00
Rafal Kolanski 7b36283c70 arm-hyp: revise scheduler / fastpath / scheduler bitmaps (SELFOUR-242)
Apply "invert-fastpath" changes to arm-hyp (ainvs, refine, crefine).
See main commit for arm for more context.
2017-11-27 22:05:46 +11:00
Rafal Kolanski 3a22487cf3 arm: revise scheduler / fastpath / scheduler bitmaps (SELFOUR-242)
Colloquially known as "invert-fastpath".

Update verification efforts on ARM for the following seL4 changes:
- scheduling decisions done in possibleSwitchTo are moved to the
  scheduler
  - possibleSwitchTo only checks whether the candidate is valid for a
    fast switch, not its priority, accepting possible candidates
    immmediately as a switch-to scheduler action
  - the scheduler checks the candidate against the current thread and
    against the bitmaps before making a decision
  - attemptSwitchTo and switchIfRequiredTo are gone
  - scheduler is now more complicated, and numerous proofs related to it
    are rewritten from scratch
- fast path now checks ready queues via the scheduler bitmaps
- L2 scheduler bitmap order reversed for better cache locality

Many iterations between the kernel and verification teams were needed
to get this right.
2017-11-27 22:05:34 +11:00
Thomas Sewell 8753c05b20 Expand eval_bool; add a method word_eqI_solve.
A number of proofs begin with word_eqI followed by some similar steps,
suggesting a 'word_eqI_solve' proof method, which is implemented here.

Many of these steps are standard, however a tricky part is that constants of
type 'nat' which encode a particular number of bits must often be unfolded.
This was done by expanding the eval_bool machinery to add eval_int_nat, which
tries to evaluate ints and nats.

Testing eval_int_nat revealed the need to improve the code generator setup
somewhat. The Arch locale contains many of the relevant constants, and they are
given global names via requalify_const, but the code generator doesn't know
about them. Some tweaks make them available. I *think* this is safe for
arch_split, as long as the proofs that derive from them are true in each
architecture.
2017-11-01 17:30:46 +11:00
Matthew Brecknell 4f68967bfc Isabelle2017: update AInvs for RC0
* word_eqI is no longer rule_format.

  * Updated Isabelle/ML Thm.join_proofs to Thm.consolidate.

  * Updated suffix_refl to suffix_order.order.refl.

  * Removed some lines of proofs, thanks to improved simplifier.
2017-10-30 12:23:26 +11:00
Matthew Brecknell 48b3a8b4ca update object and field widths for x64, and remove some magic numbers
In X64 update the following to match the C kernel:
  - TCB size-bits (11).
  - Endpoint size-bits (4).
  - Guard bits (58).
  - Message registers.

For all architectures, replace magic numbers with defined constants in
specifications, and as far as possible in proofs:
  - tcb_bits in abstract spec.
  - tcbBlockSizeBits, cteSizeBits, ntfnSizeBits, epSizeBits in Haskell
    spec, Haskell and C refinement proofs.
2017-10-26 14:05:35 +11:00
Pang Luo 6b9912c47a manually adjust non-obvious cases of tab to space replacement 2017-10-20 14:22:36 +11:00
Matthew Brecknell 184d6b70b7 remove most tab characters 2017-10-20 14:22:36 +11:00
Thomas Sewell 2c0820c175 Improve arch-split for BCorres2_AI changes. 2017-10-10 11:02:19 +11:00
Thomas Sewell 6529c7dd42 Repair schedule_bcorres.
This was broken a long while back because arch_switch_to_idle_thread
might sometimes be skipped in the implementation if the idle thread
was previously scheduled. Putting the same behaviour in the most
abstract (unit) specification is pretty easy, and it's not clear why
it wasn't done earlier.
2017-10-10 11:02:19 +11:00
Matthew Brecknell b8fc532b4e reject all invalid IRQ inputs to IRQ control syscall
This updates the proofs for a change in the C code. The IRQ control
syscall now returns an error whenever the IRQ parameter is not a valid
IRQ value. Previously, the syscall threw away some higher-order bits
before checking for IRQ validity.

Incidentally, the C now only uses the name `irq` for variables of type
`irq_t`, and `irq_w` for variables of type `word_t`. This avoids trouble
with c-parser name mangling.
2017-10-05 07:59:02 +11:00
Joel Beeren 7e915e39bd x64: adjusted abbreviation in ArchAcc_AI to restore global name-clash counter to be consistent between architectures.
A private abbreviation in an anonymous context incidentally incremented
the global counter Variable.max_idxof which is used to avoid
name-collisions in lemmas.

For some reason (not obvious) the abbreviation in question was
incrementing the counter, and because it
was only in an X64 file, this resulted in X64 and the other
architectures getting out of sync. This was file previously, but became
a problem when processing the generic file lib/clib/Corres_C.

This commit adjusts the abbreviation to not increment the counter, and
fixes Refine and SR_lemmas_C to account for this change.
2017-09-19 12:07:02 +10:00
Miki Tanaka 71d1d4143b x64 ainvs: rename wellformed_arch_obj to arch_valid_obj 2017-08-18 10:04:01 +10:00
Miki Tanaka 55d50c7ba9 arm/arm_hyp ainvs: rename wellformed_arch_obj to arch_valid_obj 2017-08-18 09:49:11 +10:00
Miki Tanaka 07e9bfa417 remove_valid_arch_objs: updates for X64 2017-08-18 09:44:00 +10:00
Miki Tanaka 6d8e917087 Remove valid_arch_objs
now that we have valid_vspace_objs to express validiy of
vspace objects, we do not need valid_arch_objs: we have
valid_objs to state the validity of non-vspace arch objects.
2017-08-17 22:44:23 +10:00
Matthew Brecknell 8c549b6764 x64: remove all trailing whitespace 2017-08-11 14:19:39 +10:00
Joel Beeren f05bc45d59 misc: clean up before merging x64 2017-08-11 11:49:18 +10:00
Matthew Brecknell 2f70a304da ainvs: integrate all architectures 2017-08-09 16:57:39 +10:00
Matthew Brecknell 238e8b307e x64: merge master 2017-07-21 11:27:12 +10:00
Alejandro Gomez-Londono 796887d9b1 Removes all trailing whitespaces 2017-07-12 15:13:51 +10:00
Joel Beeren 81064fdb55 idle-thread-pd: run idle thread with the global PD all the time.
This avoids the multicore scenario of the idle thread running in the
address space that has been deleted by a thread running on another core.
2017-07-11 11:29:34 +10:00
Miki Tanaka 41fe1a0845 update proofs for SELFOUR-30/291 "Reschedule on self-modification"
- SELFOUR-30 Reschedule when changing own IPC buffer
Previously if you invoked the TCB of the current thread and
changed the IPC buffer frame this would not immediately take
affect, as the kernels view of the current IPC buffer is
updated in Arch_switchToThread. This change forces Arch_switchToThread
to get called, even if we would switch back to the original
thread.

- SELFOUR-291 Reschedule when changing own registers
Previously if you wrote to TCB of the current thread and
changed the TLS_BASE this would not immediately take
affect, as the kernel only updates this register in
Arch_switchToThread. This change forces Arch_switchToThread
to get called, even if we would switch back to the original
thread.
2017-06-26 15:52:35 +10:00
Joel Beeren 392d055e99 SELFOUR-748: rename tlb invalidation functions 2017-06-20 14:05:45 +10:00
Joel Beeren 7d4a7b5f64 arm ainvs: clear sorry in ArchAcc_AI 2017-06-19 14:32:44 +10:00
Alejandro Gomez-Londono fb9de60cfe arm ainvs: Update for create_mapping_entries changes 2017-06-19 14:32:44 +10:00
Miki Tanaka 93eed88af7 arm AInvs: add more valid_global_objs and valid_global_vspace_mappings lemmas (in BCorres2_AI) 2017-06-19 14:32:44 +10:00
Joel Beeren a6304f8ef7 arm ainvs: update arch stuff to match generic for top level ainvs files 2017-06-19 14:32:44 +10:00