Commit Graph

2355 Commits

Author SHA1 Message Date
Ryan Barry 87c3045bec infoflow: replace valid_ko_at_arch with valid_arch_state
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry 8124b326b4 infoflow+crefine: refine arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry 86dd6562e0 infoflow: general cleanup
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry 78d18866d8 infoflow: Noninterference arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry 37087707c3 infoflow: ADT arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry 3fc7df1f3e infoflow: UserOp arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry da14669b3f infoflow: Scheduler arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry 5eb64d0b30 infoflow+access: Syscall arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry de08455f9c infoflow: PasUpdates arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry 6f1e7bf075 infoflow: Tcb arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry 586e325624 infoflow: Decode arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry 13198e2352 infoflow: Ipc arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry fd449bffed infoflow: Interrupt arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry 430ee11f14 infoflow: Finalise arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry 14ed187315 infoflow: Arch arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry 80f3db0a8d infoflow: Retype arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry 255c211864 infoflow+access: CNode arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry 40ad622d17 infoflow: FinalCaps arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry 0dabccc41f infoflow: InfoFlow arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry 392845f94c infoflow: IRQMasks arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry 5cbe8af843 proof/ROOT infoflow arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Ryan Barry 295019f713 ainvs: requalify for infoflow
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-10-05 08:46:11 +11:00
Gerwin Klein 8730572756 crefine: remove Arch_finaliseInterrupt
The PR seL4/seL4#473 removes Arch_finaliseInterrupt; this commit
updates the C proofs accordingly.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-10-01 15:19:07 +10:00
Gerwin Klein b914029a43 ainvs+crefine: remove redundant lemmas
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Gerwin Klein 941601ef56 risv crefine: remove duplicate lemma
(has already been moved to Word_Lib)

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Gerwin Klein 6cc2692faf isabelle-2021 riscv: update CRefine
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Gerwin Klein 73cfa8765c isabelle-2021 x64: update CRefine
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Rafal Kolanski 83a297312d isabelle-2021: arm-hyp crefine update
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Gerwin Klein 492c236121 isabelle-2021 riscv: update Refine
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Rafal Kolanski 860a26880f isabelle-2021: x64 refine update
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Rafal Kolanski fb93de1444 isabelle-2021: arm-hyp refine update
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Gerwin Klein a41eee7154 isabelle-2021 riscv: update Access
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Gerwin Klein 9355a059f6 isabelle-2021: update InfoFlowC
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Gerwin Klein 0758ff13c1 isabelle-2021 arm: update SimplExportAndRefine
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Gerwin Klein 34873cdd4a isabelle-2021 arm: update CRefine
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Rafal Kolanski 2b3dd18cc8 isabelle-2021: riscv ainvs update
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Rafal Kolanski 11fac22447 isabelle-2021: x64 ainvs update
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Rafal Kolanski a3dbee3e72 isabelle-2021: arm-hyp ainvs update
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Gerwin Klein 43e558cd9b isabelle-2021 arm : update Refine
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-09-30 16:53:17 +10:00
Gerwin Klein 239037906e isabelle-2021: update InfoFlow
Signed-off-by: Gerwin Klein <kleing@unsw.edu.au>
2021-09-30 16:53:17 +10:00
Gerwin Klein b5f320ece4 isabelle-2021: update DSpecProofs
Signed-off-by: Gerwin Klein <kleing@unsw.edu.au>
2021-09-30 16:53:17 +10:00
Gerwin Klein 6f72b06db3 isabelle-2021: update DPolicy
Signed-off-by: Gerwin Klein <kleing@unsw.edu.au>
2021-09-30 16:53:17 +10:00
Gerwin Klein b3968b268c isabelle-2021: update Bisim
Signed-off-by: Gerwin Klein <kleing@unsw.edu.au>
2021-09-30 16:53:17 +10:00
Gerwin Klein ce9f9ffe60 isabelle-2021: update DRefine
Signed-off-by: Gerwin Klein <kleing@unsw.edu.au>
2021-09-30 16:53:17 +10:00
Gerwin Klein 7edf5a6b37 isabelle-2021: update Access control
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2021-09-30 16:53:17 +10:00
Gerwin Klein 993eb87a4b isabelle-2021 arm: AInvs update
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2021-09-30 16:53:17 +10:00
Gerwin Klein 4afa4734a5 word_lib: remove unused theories
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2021-09-30 16:53:17 +10:00
Florian Haftmann d61cffcf61 isabelle-2021: adjusted to new naming convention
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2021-09-30 16:53:17 +10:00
Florian Haftmann ea9a25950d isabelle-2021: ad-hoc adjustions to preview
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2021-09-30 16:53:17 +10:00
Gerwin Klein 81b95eb6bf READMEs: fix publication links
PDFs and abstracts have moved to trustworthy.systems/

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-25 11:22:05 +10:00
Gerwin Klein b64bd15816 cleanup: fix indent and warnings
This fixes up some atrocious indentation and removes some warnings for
duplicate rules etc.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-16 16:47:10 +10:00
Gerwin Klein 5d895508a2 arm: fix Machine_C assumptions
Some of the assumptions in Machine_C were about C functions that do not
exist (any more, presumably after some change in C). This means these
names were free variables and the rules could in theory be applied to
any function, potentially causing unsoundness. Luckily, we were
disciplined enough in the proofs not to have done that. The proofs with
the names fixed go through unchanged.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-16 16:47:10 +10:00
Gerwin Klein 6fd6d6bd48 arm/arm-hyp: proof updates for Arm cache fix
This commit updates the proofs for seL4/seL4#485, which fixes
the security and correctness bug seL4/seL4#481. The bug was that
caches are not sufficiently flushed in retype for frames that can
be mapped uncached later.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-16 16:47:10 +10:00
Miki Tanaka 7648bf01e1 arm/arm_hyp/x64/riscv refine: add a method for setter valid_idle' rules
- in VSpace_R
- the same method added to each arch; would be good to unify via
  arch split in the future
- also includes some style cleanup

Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2021-07-24 12:09:57 +10:00
Miki Tanaka 99223bdb7e riscv crefine: proof fix for idle_tcb'/valid_idle' change
Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2021-07-24 12:09:57 +10:00
Miki Tanaka bfef8d9601 arm InfoFlowC: proof fix for removing magic number cleanup etc
Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2021-07-24 12:09:57 +10:00
Miki Tanaka ff755a945d x64 crefine: fixes for idle_tcb'/valid_idle' change
Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2021-07-24 12:09:57 +10:00
Miki Tanaka fe2329dbb9 arm_hyp crefine: fixes for idle_tcb'/valid_idle' change
Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2021-07-24 12:09:57 +10:00
Mitchell Buckley 376cc707b6 crefine ARM: fixup for recent cleanup
Signed-off-by: Mitchell Buckley <Mitchell.Buckley@data61.csiro.au>
2021-07-24 12:09:57 +10:00
Miki Tanaka 09434ab8ff x64 refine: define valid_idle' directly, without using itcb
Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2021-07-24 12:09:57 +10:00
Miki Tanaka 4da06d81ad armhyp refine: define valid_idle' directly, without using itcb
- this introduces idle_tcb' which is defined directly using tcb fields
- backport from MCS ARM Refine

Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2021-07-24 12:09:57 +10:00
Miki Tanaka d054484474 arm refine: define valid_idle' directly, without using itcb
- introduces idle_tcb' defined using tcb fields
- backport from MCS

Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2021-07-24 12:09:57 +10:00
Miki Tanaka de7c2f7605 riscv refine: define valid_idle' directly, without using itcb
- this introduces idle_tcb' which is defined directly using tcb fields
- backport from MCS ARM Refine

Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2021-07-24 12:09:57 +10:00
Miki Tanaka 4ecf7755f3 arm refine: remove magic numbers from valid_irq_node' and global_refs'
Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2021-07-24 12:09:57 +10:00
Ryan Barry a99a2bf739 various: resolve some existing fixmes
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-07-22 10:44:43 +10:00
Ryan Barry 0d53d6909f lib+ainvs+access+refine: resolve most of the new fixmes
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-07-22 10:44:43 +10:00
Ryan Barry 2c03d8cd27 infoflow: misc fixes
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-07-22 10:44:43 +10:00
Ryan Barry 1fbe4895ed access: update ARM proofs
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-07-22 10:44:43 +10:00
Ryan Barry cb9249cb4a riscv access: add ExampleSystem
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-07-22 10:44:43 +10:00
Ryan Barry 9f85f6c2d2 riscv access: add proofs for ADT_AC
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-07-22 10:44:43 +10:00
Ryan Barry b61aaa7ce6 riscv access: add proofs for Syscall_AC
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-07-22 10:44:43 +10:00
Ryan Barry 638bc490d2 riscv access: add proofs for DomainSepInv
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-07-22 10:44:43 +10:00
Ryan Barry c3a88fa901 riscv access: add proofs for Ipc_AC
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-07-22 10:44:43 +10:00
Ryan Barry 1bf9139886 riscv access: add proofs for Tcb_AC
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-07-22 10:44:43 +10:00
Ryan Barry 5ea4d2b6ba riscv access: add proofs for Interrupt_AC
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-07-22 10:44:43 +10:00
Ryan Barry a485d26f23 riscv access: add proofs for Finalise_AC
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-07-22 10:44:43 +10:00
Ryan Barry ed8971a269 riscv access: add proofs for Arch_AC
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-07-22 10:44:43 +10:00
Ryan Barry cc5014240d riscv ainvs+access: add proofs for Retype_AC
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-07-22 10:44:43 +10:00
Ryan Barry 9478264f19 riscv access: add proofs for CNode_AC
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-07-22 10:44:43 +10:00
Ryan Barry 52abdf42de riscv access: add proofs for Access_AC
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-07-22 10:44:43 +10:00
Ryan Barry 16e9242665 riscv access: specify riscv access control
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-07-22 10:44:43 +10:00
Mitchell Buckley 2cf89e20c8 Cleanup some FIXMEs in AInvs and related sessions
Mostly moving lemmas up into various lemma bucket theories. Also:
* replace cte_wp_at_eqD with cte_wp_at_norm (equal lemmas)
* pd_shifting_gen generalise pd_shifting' in 2 architectures
* remove some redundant crunch lemmas

Signed-off-by: Mitchell Buckley <Mitchell.Buckley@data61.csiro.au>
2021-07-16 14:13:07 +10:00
Corey Lewis 284ef78ae9 lib: support crunching lifted monadic functions
This also changes crunch to collect preconditions one at a time.

Signed-off-by: Corey Lewis <Corey.Lewis@data61.csiro.au>
2021-07-12 15:09:50 +10:00
Mitchell Buckley 184bdfb954 refine: fix regression caused by bad theory import
Importing Init_R into ADT_H was causing EmptyFail_H to fail. Since
no other theories actually depend on Init_R we can instead include
it in the Refine session directly.

Signed-off-by: Mitchell Buckley <mitchell.alan.buckley@gmail.com>
2021-06-27 10:13:01 +10:00
Mitchell Buckley ee3b84fb57 refine: Give a trivial member of the abstract-haskell state relation
Describe an extremely simple abstract kernel state, and haskell state
that obey the state relation. These states are `zeroed` in the sense
that they have empty heaps, and default values of 0, False, None, []
and similar in all fields.

These states do not satisfy invs or invs', and this is not as strong
a result as showing that kernel initial states satisfy the state
relation, but it is a good sanity check on the relation itself.

Signed-off-by: Mitchell Buckley <mitchell.buckley@data61.csiro.au>
2021-06-26 10:58:14 +10:00
Matthew Brecknell fd01872121 always use `addrFromKPPtr` for kernel addresses
This verifies a C kernel patch (seL4/seL4#409) which consolidates
translation between virtual and physical addresses, and makes it
consistent across architectures. In particular, we always use
`addrFromKPPtr`, even on architectures that don't use a distinct region
to map the kernel ELF. This will facilitate future improvements which
move the ELF mapping into a distinct virtual address region.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2021-06-25 16:31:22 +10:00
Ryan Barry 8dd93a52a0 infoflow+dpolicy+cdl-refine: misc fixes
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-06-21 20:10:32 +10:00
Ryan Barry c2939c771a access: move ExampleSystem
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-06-21 20:10:32 +10:00
Ryan Barry bcba6594e4 aspec+access: ADT_AC arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-06-21 20:10:32 +10:00
Ryan Barry f75f26ff0d aspec+access: Syscall_AC arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-06-21 20:10:32 +10:00
Ryan Barry c36d6e367d access: DomainSepInv arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-06-21 20:10:32 +10:00
Ryan Barry 9d543d29c1 access: Ipc_AC arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-06-21 20:10:32 +10:00
Ryan Barry 0026b0dd34 access: Tcb_AC arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-06-21 20:10:32 +10:00
Ryan Barry 79799754f0 access: Interrupt_AC arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-06-21 20:10:32 +10:00
Ryan Barry 2f6bdeb14e access: Finalise_AC arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-06-21 20:10:32 +10:00
Ryan Barry 6f2f9774f1 access: Arch_AC arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-06-21 20:10:32 +10:00
Ryan Barry 0f611fa0a4 access: Retype_AC arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-06-21 20:10:32 +10:00
Ryan Barry 4429a6bda4 access: CNode_AC arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-06-21 20:10:32 +10:00
Ryan Barry 9863065915 aspec+access: Access arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-06-21 20:10:32 +10:00
Ryan Barry ea73ffe26b proof/ROOT: access control arch split
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-06-21 20:10:32 +10:00
Ryan Barry a9c757ceb2 access: replace magic numbers
Signed-off-by: Ryan Barry <ryan.barry@unsw.edu.au>
2021-06-21 20:10:32 +10:00
Mitchell Buckley e54e04c9d3 infoflow: Standardise corres lemmas to match refine
Signed-off-by: Mitchell Buckley <mitchell.alan.buckley@gmail.com>
Co-authored-by: Victor Phan <Victor.Phan@data61.csiro.au>
2021-06-21 10:30:04 +10:00
Mitchell Buckley 7180ee4e70 refine: Standardise names of some corres lemmas
Ideally all corres lemmas of the form
`corres rrel P P' my_abstract_function myHaskellFunction`
should be named `myHaskellFunction_corres`.

This commit renames over 200 lemmas to match this style.

Signed-off-by: Mitchell Buckley <mitchell.alan.buckley@gmail.com>
Co-authored-by: Victor Phan <Victor.Phan@data61.csiro.au>
2021-06-21 10:30:04 +10:00
Matthew Brecknell 73649d2ce4 arm crefine: fix `decodeARMMMUInvocation` branch hint
A previous update to C code added a disjunct to an `if` condition
outside the existing `unlikely` branch hint. This commit is the proof
update for a C patch that extends the branch hint to the full `if`
condition.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2021-05-20 11:52:45 +10:00
Mitchell Buckley 51ac27ad10 Some improvement to rec_del_termination
* Add comments into proof.
* Unwind some automation to clarify how each subgoal is resolved.
* Remove some "in monad" lemmas about `premption_point`.

Signed-off-by: Mitchell Buckley <Mitchell.Buckley@data61.csiro.au>
2021-05-13 09:52:43 +10:00
Gerwin Klein c0fe17e785 Remove remaining tab characters in .thy files
Closes VER-748

Signed-off-by: Gerwin Klein <kleing@unsw.edu.au>
2021-04-21 13:30:13 +10:00
Matthew Brecknell d020be3b89
riscv: fix CLZ and CTZ for riscv32 builds (#257)
This commit verifies seL4 PR [#325][], which fixes the riscv32 build
broken by seL4 commit [9ec5df5f][].

[#325]: https://github.com/seL4/seL4/pull/325
[9ec5df5]: https://github.com/seL4/seL4/commit/9ec5df5f

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2021-03-30 13:17:41 +11:00
Mitchell Buckley 6386f753fa riscv: use `uint8_t` for `register_t`
`register_t` only needs to be able to index into the TCB user context
array, which has 35 entries on RISC-V. Therefore `uint8_t` is
sufficient.

Using the smallest possible type for `register_t` helps with binary
verification. This shrinks static read-only data, which in turn reduces
the complexity of binary verification proof search.

This commit verifies the corresponding C kernel patch.

Co-authored-by: Zoltan Kocsis <Zoltan.Kocsis@data61.csiro.au>
Signed-off-by: Mitchell Buckley <Mitchell.Buckley@data61.csiro.au>
Signed-off-by: Zoltan Kocsis <Zoltan.Kocsis@data61.csiro.au>
2021-03-24 08:47:19 +11:00
Matthew Brecknell 4278e99aa4 riscv crefine: generalise and move some lemmas
Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2021-03-23 22:40:46 +11:00
Mitchell Buckley 9cea8ed18b riscv SEAR: arch-split SEAR for clz and ctz
Signed-off-by: Mitchell Buckley <mitchell.buckley@data61.csiro.au>
2021-03-23 22:40:46 +11:00
Mitchell Buckley f96f7763fd riscv CRefine: complete proofs for ctz and clz
Signed-off-by: Mitchell Buckley <mitchell.buckley@data61.csiro.au>
2021-03-23 22:40:46 +11:00
Matthew Brecknell 27d6b4f8f4 riscv crefine: setup proofs for clz and ctz
Progress towards verification of new and more efficient implementations
of library functions to could leading and trailing zeros.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2021-03-23 22:40:46 +11:00
Matthew Brecknell f902cf7e38 riscv crefine: remove `DONT_TRANSLATE` on inlined function `read_sip`
The binary verification tools perform inlining of C specifications, to
simulate inlining that has been performed in the binary. This means that
`DONT_TRANSLATE` and `inline` are incompatible, since the binary
verification tools require C specifications for any functions that have
been inlined in the binary.

This `DONT_TRANSLATE` annotation was added with a `MODIFIES` annotation
for the proof of `resetUntypedCap_ccorres`. That proof has been reworked
so that it no longer requires the `MODIFIES` annotation in the C.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2021-03-19 13:01:44 +11:00
Matthew Brecknell cd6cce2b6f clib: remove unused `csymbr_legacy` method
Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2021-03-19 13:01:44 +11:00
Matthew Brecknell 76ec8dfc47 crefine: remove all uses of `csymbr_legacy`
When exception-aware lifting was enabled in `csymbr`, a small number of
existing proofs were broken. The `csymbr_legacy` method was added to
preserve the old behaviour of `csymbr` for those proofs.

This commit updates those proofs to use the new `csymbr` behaviour.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2021-03-19 13:01:44 +11:00
Matthew Brecknell 6d5391cf4b crefine: remove large structs passed by value
The RISC-V calling convention specifies that when a C function takes an
argument by value, the binary function should take the argument by
reference, if the value is larger than 2 pointer words.

For binary verification, we avoid implementing this aspect of the RISC-V
calling convention, by eliminating all such function arguments for
functions which are not inlined. This commit includes the proof updates
corresponding to the kernel source update, which is in the seL4
repository.

This includes arguments of types `slot_range_t` and `extra_caps_t`.

`slot_range_t` is only used in two functions, so for those cases, we
unpack the arguments, and remove the type altogether.

`extra_caps_t` is used extensively in invocation decoding, and also in
inter-process communication. Since extra caps are already stored in a
global variable `current_extra_caps`, we remove the function argument,
and use the global variable instead. However, this adds significant
difficulty to the proofs, because the variable lifting performed by
`cinit` worked for the function argument, but not for the global
variable. We have therefore recently improved the `cinit` automation to
support this change to the kernel.

Even though this change was for the benefit of RISC-V binary
verification, we update all architectures for consistency.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2021-03-19 13:01:44 +11:00
Matthew Brecknell 337c0d62ea crefine: generalise `ccorres_tmp_lift2`
Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2021-03-19 13:01:44 +11:00
Matthew Brecknell 1dfd9d48dd clib: keep preconditions for lifted globals in `cinit`
The previous implementation of `cinit` discarded C preconditions used
for variable lifting. This is usually appropriate for local variables
and function arguments. However, when using the new `cinit` to lift
global variables, the respective preconditions sometimes need to be kept
for the last subgoal.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2021-03-19 13:01:44 +11:00
Matthew Brecknell e72bb9976e crefine: enable exception-aware lifting for csymbr
The new variable lifting behaviour that was recently added to the
`cinit`, `clift` and `ctac` commands is now also added to `csymbr`.
This means `csymbr` variable lifting is now sensitive to exceptional
control flow.

Since this breaks some existing proofs, we add a new `csymbr_legacy`
command with the old behaviour, and use it where necessary.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2021-03-19 13:01:44 +11:00
Matthew Brecknell 62f5fa0c4f clib: document some predicates used in `ceqv` and related automation
Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2021-03-19 13:01:44 +11:00
Matthew Brecknell 9fda5fc5f5 clib: respect exceptional control flow in `cinit` variable lifting
`cinit` and related methods are able to automatically abstract accesses
of Simpl state variables to Isabelle variables, provided they can prove
that the Simpl variable has not been modified up to the point it is
accessed. However, previously, the automation was unaware of exceptional
control flow. This limits the effectiveness of variable lifting in
situations like the following:

    // `var` has not yet been modified.
    if (condition) {
        var = new_value;
        // Here, `var` has been modified.
        return;
    }
    // Has `var` been modified before the following access?
    do_something(var);

Prior to this commit, the answer would be "yes": `cinit` would conclude
that `var` has been modified prior to the access for `do_something`, so
the variable access would not be abstracted.

With this commit, the answer is "no": `cinit` recognises the `return` in
the `if` block, and can abstract the variable access for `do_something`.

The new automation is enabled for `cinit`, `clift` and `ctac`. It is
currently disabled for `csymbr`, since the new behaviour breaks some
existing proofs.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2021-03-19 13:01:44 +11:00
Matthew Brecknell d8240dbbda clib: add support for lifting global variables in `cinit`
The `cinit` and `clift` methods already provided a way to abstract
accesses to specified local variables to Isabelle variables that do not
depend on the state, provided that the procedure does not write to those
variables. The proof methods included automation of proofs that the
values of variables being abstracted remain constant throughout the
procedure.

This commit adds support for abstracting accesses to *global* variables.
The additional challenge here is that calls to other procedures might
modify global variables. We use the `modifies` facts produced by the C
parser to determine (and prove) when variables of interest are preserved
across procedure calls.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2021-03-19 13:01:44 +11:00
Corey Lewis dd07ffd197 refine: move invariant field update lemmas
Signed-off-by: Corey Lewis <Corey.Lewis@data61.csiro.au>
2021-03-11 10:42:49 +11:00
Corey Lewis 5323aad95a refine: remove duplicated lemmas
Signed-off-by: Corey Lewis <Corey.Lewis@data61.csiro.au>
2021-03-11 10:42:49 +11:00
Gerwin Klein bf5b97500a trivial: fix links to papers
The TS website has settled on no `.pml` postfix

Signed-off-by: Gerwin Klein <kleing@unsw.edu.au>
2021-03-02 11:44:22 +11:00
Corey Lewis 008969fc02 lib proof: reorder the assumptions of corres_split
Currently this just modifies the rule but not any of the proofs that use
it. The old version is kept for now but should be removed once all of
the proofs are updated.

Signed-off-by: Corey Lewis <Corey.Lewis@data61.csiro.au>
2021-02-19 11:37:12 +11:00
Miki Tanaka e019b90d8a ainvs cleanup: requalify some arch lemmas proved in ArchRetype_AI
Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2021-01-19 12:53:38 +11:00
Gerwin Klein 752014b466
ainvs: reduce Finalise interface (#179)
* ainvs: reduce Finalise interface

The lemma finalise_cap_replaceable is only used in arch proofs,
so it doesn't need to be in the interface locale to generic proofs.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-12-23 09:19:53 +11:00
Gerwin Klein 8f992b2350 arm_hyp: proof updates for seL4 commit 93ab2543d9d8
The seL4 commit factors out special treatment of specific VCPU
registers, and this commit updates the ARM_HYP proofs accordingly.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-12-19 21:08:30 +11:00
Gerwin Klein 3cc7a1c6b7 arm-hyp: proof updates for seL4 c381c7e14c
seL4 commit c381c7e14c changes cache flushing behaviour for the
verified ARM_HYP configuration. This commit adjusts accordingly.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-12-09 19:46:02 +11:00
Gerwin Klein 83cbc07cd8 crefine: proof update for seL4 7cc50c3039
The corresponding seL4 patch removes an unused line in
invokeUntyped_Retype

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-11-30 16:22:31 +11:00
Matthew Brecknell ca9df38137 regression: increase CRefine timeout
CRefine takes longer with Isabelle2020, so this gives more headroom.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2020-11-26 00:31:04 +11:00
Gerwin Klein ba38ae33ab update publications links
The links to nicta.com.au have stopped working, so the publication links
now point to the TS publication pages.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-11-23 17:06:46 +11:00
Rafal Kolanski 7d998ac2ba arm+arm-hyp crefine: update for platform constant changes
Signed-off-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2020-11-16 16:52:40 +11:00
Rafal Kolanski 6a587f7c20 x64: update for platform constant changes
Signed-off-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2020-11-16 16:52:40 +11:00
Rafal Kolanski 0df39b8ed5 riscv: update for platform constant changes
Signed-off-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2020-11-16 16:52:40 +11:00
Rafal Kolanski 9ed45e17bd arm+arm-hyp: kernelBase and physMappingOffset renames
This brings the naming convention closer to the other architectures,
closer to the Haskell, and closer to the constant renames that happened
in C. It is, however, quite an invasive change.

kernelBase_addr -> pptrBase
kernelBase -> pptrBase
physMappingOffset -> ptrBaseOffset

Signed-off-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2020-11-16 16:52:40 +11:00
Gerwin Klein 6700d97b7f asmrefine: SimplExportOnly renamed
The SimplExportOnly session is now just SimplExport.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-11-09 21:07:44 +11:00
Corey Lewis 7baa19495f spec proof: resolve_address_bits'.simps[simp del]
Remove resolve_address_bits'.simps from the simp set at the definition
site, instead of in the middle of the proofs.

Signed-off-by: Corey Lewis <Corey.Lewis@data61.csiro.au>
2020-11-09 17:18:41 +11:00
Gerwin Klein a45adef66a all: remove theory import path references
In Isabelle2020, when isabelle jedit is started without a session
context, e.g. `isabelle jedit -l ASpec`, theory imports with path
references cause the isabelle process to hang.

Since sessions now declare directories, Isabelle can find those files
without path reference and we therefore remove all such path references
from import statements. With this, `jedit` and `build` should work with
and without explicit session context as before.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-11-02 10:16:17 +10:00
Gerwin Klein b5e7fa4e45 Makefiles: factor out ASpec doc file generation
Make these a separate target so that other sessions that depend on
ASpec can kick off generation of these files (necessary because some
are mentioned in spec/ROOT, and the session structure will fail if they
don't exist).

This is only relevant in a fresh check-out when you've never built
ASpec, but in test environments this can happen if only specific
sessions are tested.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-28 14:06:36 +10:00
Gerwin Klein 65275fed6c update links in README files
Some of linked theory files have moved to different directories.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein ad2e73ce4d infoflow: update InfoFlowC session for Isabelle2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein f0ffe07888 tests: increase timeout for Refine
The Refine session sometimes reaches over 4 CPU hours on X64.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein 9fcb919879 x64 crefine: update for Isabelle2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein f45f587536 x64 refine: update to Isabelle2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein c591c45a7b x64 ainvs: update to Isabelle2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein 2c2b7c4256 riscv crefine: update to Isabelle2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein 300d62e6b3 riscv refine: update to Isabelle2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein a8f3f660e4 fixup arm-hyp refine: isa2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein eb2de99511 arm-hyp crefine: update to Isabelle2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein 41d1473216 riscv ainvs: isabelle2020 update
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein fb8a1aaf38 arm_hyp ainvs: Isabelle2020 update
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein f9527fb9ce arm refine: repair EmptyFail_R for Isabelle2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein 99d3cd9926 SimplExport: export and import are in different dirs
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein 36d5bfdb1c arm_hyp refine: Isabelle2020 update
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein e2e580664a infoflow: update InfoFlowC to Isabelle2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein 21933f899a simplexport: build SimplExportAndRefine on CSpec
It looks like generated files are missing if built on SimplExport direclty.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein 875c313e71 arm crefine: Isabelle2020 update
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein b976bc8972 crefine: enable intermediate CRefine session for Isabelle2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein 68b71f99b5 crefine: session structure update for Isabelle2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein 6719ec050b arm orphanage: Isabelle2020 update
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein bbacd7079f proof/ROOT: more Isabelle2020 session structure
SimplExportAndRefine is now split into two steps;
AutoCorresTest moved to its own directory.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein 9514b9f5e5 crefine: lib is a session dir for CBaseRefine
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein 66b2774155 arm refine: Isabelle2020 update
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein cf8e90c2ce drefine: Isabelle2020 update
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein ce4a6e2051 infoflow: Isabelle2020 update
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein c798c20d52 access: Isabelle2020 update
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein 913026178a bisim: Isabelle2020 update
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein 4c3bbfb059 refine: session directories for Isabelle2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein 7d24031854 arm ainvs: Isabelle2020 update
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein a5545cc040 ROOT: make SepTacticsExamples part of DSpecProofs
Not really worth the trouble of an own session directory.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein 1f9cbd6a38 capDL-api: proof updates for Isabelle2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein fb5a6a67a5 SepDSpec: new syntax for syntax specs in Isabelle2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein cf7ce9598a ainvs: session update for Isabelle2020
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein 2e8cf15b2d lib + proof: Isabelle2020 Method.NO_CONTEXT_TACTIC rename
Method.NO_CONTEXT_TACTIC -> NO_CONTEXT_TACTIC

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Gerwin Klein e7fb36b7e2 ROOT files: file reorg for new ROOT requirements
Isabelle2020 requires each session to declare it own set of directories that
may not overlap with other session's directories. This commit reorganises
files to comply with that requirement.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-10-27 15:52:31 +10:00
Miki Tanaka 0b9c186eb0 armhyp/x64/riscv64 refine: remove interrupt/irq from p_monad
- fix armhyp/x64/riscv64 Refine for the above change

Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2020-10-25 13:15:00 +11:00
Miki Tanaka b4893afd0b drefine, infoflow: remove interrupt/irq from p_monad
- fix DRefine, InfoFlow, InfoFlowC for the above change

Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2020-10-25 13:15:00 +11:00
Miki Tanaka 0359fb1da0 arm refine: remove interrupt/irq from p_monad
- fix ARM refine proofs for the above change
- use dc instead of intr

Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2020-10-25 13:15:00 +11:00
Miki Tanaka caf09bd3db aspec+ainvs: remove interrupt/irq from p_monad
- preemption in C is not associated to an irq
- updating aspec to reflect this so that we can have irq-independent
  preemptions (needed in MCS)

- proof fix for the above: remove intr

Signed-off-by: Miki Tanaka <miki.tanaka@data61.csiro.au>
2020-10-25 13:15:00 +11:00
Gerwin Klein 5cb5efbb97 tests: give more time to AInvs session
The github CI runners are low on memory and might just get
through with a bit more time for ARM_HYP.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-09-10 16:09:38 +08:00
Matthew Brecknell 0ba5b52d59 asmrefine: add `heap_update` identity rule
This allows SimplExportAndRefine to handle some new heap update patterns
arising in MCS.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2020-09-07 14:10:04 +10:00
Edward Pierzchalski 0bea82f481 asmrefine: skip `init_freemem`
`init_freemem` isn't verified (and therefore is low-priority for
translation validation). It also takes several hours to show refinement,
much longer than any other function. Until we need to validate it, we
should skip it to improve regression times.

Signed-off-by: Edward Pierzchalski <ed.pierzchalski@data61.csiro.au>
2020-09-04 22:07:17 +10:00
Edward Pierzchalski 074689730f asmrefine: add timeouts for debugging
Also cleans up some of the debug config setup and makes result reporting
more useful.

Signed-off-by: Edward Pierzchalski <ed.pierzchalski@data61.csiro.au>
2020-09-04 22:07:17 +10:00
Matthew Brecknell b77f83c57b riscv: rename sbadaddr -> stval
Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2020-08-26 15:24:06 +10:00
Matthew Brecknell ea1be49908 crefine: make C state relation non-empty
We believe this commit fixes the issue described in the previous commit.
It also reverts that commit, since the proofs that the C state relation
is empty no longer work.

As the previous commit demonstrated, it is important to demonstrate the
non-triviality of properties. In this case, we should exhibit a witness
of the non-emptiness of the C state relation. We have not yet done that.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2020-08-19 16:15:05 +10:00
Matthew Brecknell 0f0cfc9dc8 crefine: prove that the C state relation is empty
As currently defined, the C state relation is empty, and consequently,
`ccorres` is trivially true for any pair of functions. This means that,
in a very technical sense, our C refinement proofs are meaningless.

The state relation is empty because several conjuncts in
`cstate_relation` form a contradiction:
- Two conjuncts claim that `intStateIRQNode_array_Ptr` points to a heap
  object within the set of addresses `kernel_data_refs`.
- Another implies that all heap objects are within `domain`.
- Another claims that `kernel_data_refs = -domain`, forming the
  contradiction.

This commit proves the contradiction, and also proves that `ccorres` is
trivially true for any pair of functions.

Fortunately, we never made any essential use of this contradiction, and
so the issue can be fixed fairly easily. The issue seems to have arisen
out of a conflation of two different concepts:
- `kernel_data_refs` is introduced in the intermediate specification,
  and is intended to be the set of addresses containing global heap
  objects that are not covered by capabilities.
- `domain` was introduced for binary verification, and was intended to
  be the set of all addresses that may be used for heap objects.

The easiest fix seems to be to expand the meaning of `kernel_data_refs`
to include all addresses that are not covered by capabilities. If we
assert that `kernel_data_refs = -domain`, then this does not allow for
heap objects that are not covered by capabilities. If instead, we make a
weaker assertion that `-domain <= kernel_data_refs`, we can have heap
objects that are not covered by capabilities, such as the one pointed to
by `intStateIRQNode_array_Ptr`.

This fix will be performed in a subsequent commit.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2020-08-19 16:15:05 +10:00
Gerwin Klein b0d01265ef trivial: fix broken links
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-08-10 15:48:34 +08:00
Matthew Brecknell d5170f121c regression: explain why `CKernel` depends on `design-spec`
The reason `CKernel` depends on `design-spec` is quite obscure, so we
add a comment to relevant `Makefile`s to help us avoid wasting time
trying to remove the dependency.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2020-08-10 13:45:35 +10:00
Gerwin Klein 4782dc369b
lib/riscv refine: move lemma (#33)
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-08-10 09:14:27 +08:00
Matthew Brecknell 9e685553d2 risc-v simpl-export: ignore `arch_init_freemem`
A new version of `arch_init_freemem` for RISC-V introduces some heap
access patterns which are not well supported by SimplExportAndRefine.
`arch_init_freemem` is already ignored by `graph-refine`, because it is
inlined into `init_freemem`, which contains complex loops. Therefore, we
don't lose anything by ignoring it in SimplExportAndRefine. Although the
problem only manifests on RISC-V, we ignore it on all platforms.

Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
2020-07-22 17:13:34 +10:00
Gerwin Klein b356f65969 lib: in_case and find_case methods
We already have find_goal, but the interface is a bit too unwieldy to
casually use frequently. This commit introduces (or moves from RISCV)
two methods on top of find_goal:

 - `in_case x`: asserts the goal has an assumption `?t = x`
 - `find_case x`: finds a goal such that `in_case x`

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-07-13 11:59:43 +08:00
Gerwin Klein c3f3656942 refine + crefine: proof updates for haskell datatype selectors
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-07-09 10:06:31 +08:00
Gerwin Klein f0b1c4a044 refine: proof fixes for cong rule tweak
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-07-08 20:18:31 +08:00
Gerwin Klein 479f98de67 arm_hyp refine: add an Orphanage place holder
This makes sure Isabelle doesn't complain about a missing dependency in
the ROOT file when ARM_HYP is selected. The complaint only shows up in
jedit, and doesn't stop anything, but it's still nicer without.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-07-02 11:30:56 +08:00
Gerwin Klein 24b119f338 crefine + infoflowc: adjust proofs for new Haskell assertion
The new kernelExitAssertions need to be threaded through the fastpath
and integrated in the right place in the theorems about callKernel.

In InfoFlowC we have yet another refinement framework, and we're taking apart
callKernel to isolate the `schedule` call which is significant in the
infoflow proof and needs the new assertion inserted as wel. After some force
applied, this does work as well.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-07-02 11:30:56 +08:00
Gerwin Klein 5ee37bd11e refine: replace DomainTime_R by assertion
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-07-02 11:30:56 +08:00
Gerwin Klein 1fd4e7fda6 tests: remove artificial dependency CBaseRefine->AInvs
This dependency made sense on smaller test rigs in the past to avoid building
CRefine when AInvs fails, but removing the dependency opens a faster path
from scratch to CRefine for checking seL4 C code changes.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-16 14:18:53 +08:00
Gerwin Klein 30b43f0af1 riscv crefine: defer parameter name FIXMEs
see also VER-1289

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:11 +08:00
Gerwin Klein d5f0b452ee riscv crefine: defer FIXME
See VER-1288. This is an optimisation that should be
added at a later point.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:11 +08:00
Gerwin Klein c14b2bb69a riscv crefine: resolve FIXME
the definition of objBits is in Haskell, so has to use pteBits instead of
pte_bits (not in scope)

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:11 +08:00
Gerwin Klein 65ae80c5ad riscv crefine: downgrade FIXME to more permanent comment
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:11 +08:00
Rafal Kolanski 4515e1e78e crefine: remove ccorres_from_vcg_throws_nofail
(now present in lib)

Signed-off-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2020-06-08 20:41:11 +08:00
Rafal Kolanski 99d241d031 riscv: clear out most crefine FIXMEs
Perform moves, remove lemmas placed in lib, etc.

Signed-off-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2020-06-08 20:41:11 +08:00
Gerwin Klein e7f6e97c6b cleanup: remove stray diagnostic commands and comments
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 81117dc587 riscv cleanup: remove stray diagnostic commands
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 9a51fc110c riscv crefine: rename isBlocked to isStopped
This brings the proof in sync with seL4 d5d54a0d5596e7a708

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein c3ef1c509e arm-hyp refine: fix PageTableDuplicates
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 35d513c0e4 arm crefine: proof updates for new arch split functions
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 232b23e314 x64 crefine: proof updates for new arch split functions
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein d567d52b17 arm_hyp crefine: proof updates for new arch split functions
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 2488eb3703 drefine: make new arch function available
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Victor Phan 34e58376a3 arm refine: update for interrupt functions arch split
Signed-off-by: Victor Phan <Victor.Phan@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 13b009a238 access: make new arch definition available to access control proofs
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 9bf346481e x64 refine: proof updates for new arch split functions
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 26a49fcbde arm_hyp refine: proof updates for new arch split functions
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 3927f7ec42 x64 ainvs: proof updates for new arch split functions
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 7bc58d2638 bisim: proof updates for new arch split function
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 78d158ec6e arm_hyp ainvs: proof fixes for new arch split
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Victor Phan c297e93154 arm ainvs: update for invoke_irq_handler arch split
Signed-off-by: Victor Phan <Victor.Phan@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 9ddc7c93c2 riscv crefine: cleared last sorry
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 10457db1b5 riscv orphanage: adapt to new arch split function
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 62e52c84cb riscv refine: adapt to new arch split function
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 2fc5c5cc17 riscv ainvs: proof updates for new arch split functions
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein bce372b4fb ainvs: proof updates for new arch split functions
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 2e2d4c279d riscv crefine: clear last sorry in Interrupt_C
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 0bdec8a194 riscv refine: adjust proofs to new invokeIRQHandler
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Victor Phan a33df75acb riscv ainvs: update for invokeIRQHandler arch split spec change
Add appropriate lemmas for machine op plic_complete_claim.

Signed-off-by: Victor Phan <Victor.Phan@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Rafal Kolanski 877c667877 riscv crefine: Arch_C sorry-free
Completed decodeRISCVFrameInvocation_ccorres, synced with C changes and
cleaned up a little.

Signed-off-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Rafal Kolanski 06d6620340 riscv haskell: update vmRightsToBits
This was incorrect, but unused in the proofs. Once used, the numbers
turned out to be unrelated to the C.

Signed-off-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein b7e9f610d9 riscv crefine: prove decodeRISCVMMUInvocation_ccorres
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein bf753fc564 riscv crefine: clear last sorry in Finalise_C
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 8e60a9af3e riscv refine: prove new lookupPTFromLevel assertion
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Rafal Kolanski e8f9a341d8 riscv crefine: clear 3 sorries from Arch_C
Notably, decodeRISCVPageTableInvocation_ccorres is done.

Signed-off-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 75e82bc006 riscv crefine: prove Arch_decodeIRQControlInvocation_ccorres
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein d8b64d4eb2 riscv crefine: prove decodeIRQControlInvocation_ccorres
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein d7fb06cac1 riscv crefine: prove Arch_finaliseCap_ccorres
Also modifies cap_to_H_PTCap to include capPTMappedAddress

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein aadf599ae5 riscv crefine: remove 1 sorry from Interrupt_C
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein b17b03befc riscv crefine: clear remaining sorry in Ipc_C
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein e8ad7ddb72 riscv crefine: clear last sorry in Delete_C
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein 4bc86adab1 riscv crefine: clear final sorry in Arch_C
This includes a slight tweak to the state relation for global PTs.

Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Gerwin Klein fe21162804 riscv crefine: clear all sorries in VSpace_C
Signed-off-by: Gerwin Klein <gerwin.klein@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Rafal Kolanski 6eff34f312 riscv crefine: restrict abstract pools in casid_pool_relation
Since on RISCV64 we do not have restrictions on arch objects in
valid_obj', for the state relation to form a function from abstract to
concrete, we need to restrict the domains of the abstract asid pools.
Further we also need to ensure ASID 0 is not used in any of them, as
that is a sentinel value for "no ASID".

This is analogous to the restriction placed by valid_obj' on ASIDs on
X64, except occurring in the state relation rather than an invariant.

Signed-off-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Rafal Kolanski 0a397f626e riscv crefine: reduce sorries in ADT_C
Signed-off-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Rafal Kolanski 5f1fd9aa64 riscv crefine: clear sorries from Refine_C
Signed-off-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Rafal Kolanski 2eeaae4017 riscv crefine: fix fault_to_H for VMFault
Arguments were backwards for some reason.

Signed-off-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Rafal Kolanski 39be004a1a riscv crefine: sorry Refine_C
No examination of failing proofs this time. All CRefine files are now
present and accounted for.

Signed-off-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Rafal Kolanski 4bae495aa4 riscv crefine: sorried, very preliminary ADT_C
Broken bits blindly sorried or commented out with FIXME RISCV.
carch_state_to_H is currently wrong as valid_arch_state' is
insufficient to accurately describe global page tables.

Signed-off-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2020-06-08 20:41:10 +08:00
Rafal Kolanski 3775796809 riscv crefine: Init_C
Signed-off-by: Rafal Kolanski <rafal.kolanski@data61.csiro.au>
2020-06-08 20:41:10 +08:00