Commit Graph

614 Commits

Author SHA1 Message Date
Japheth Lim e38bcf6bd2 x64 CRefine: proof repairs after wp changes 2018-07-05 16:23:15 +10:00
Japheth Lim 42ad2cbad9 x64 CRefine: more update for C-parser change to avoid complex call lvals (JIRA VER-881)
Also completes some Ipc_C proofs that were blocked by the C-parser problem.
2018-07-05 16:23:15 +10:00
Michael Sproul 87f6ad3f6c x64: crefine: prove unmapPage_ccorres
This required the addition of a new assumption in Machine_C about
invalidateTranslationSingleASID
2018-07-05 16:23:15 +10:00
Gerwin Klein 0a6a028a80 crefine x64: Refine_C sorried 2018-07-05 16:23:15 +10:00
Gerwin Klein 1e73cba198 x64 crefine: remove ADT_C sorries up to missing arch defs 2018-07-05 16:23:14 +10:00
Gerwin Klein 06d9ff7853 x64 crefine: ADT_C sorried, Init_C added 2018-07-05 16:23:14 +10:00
Gerwin Klein 82474647a3 x64 crefine: FPU updates 2018-07-05 16:23:14 +10:00
Japheth Lim 3fb9903ea1 x64: crefine: update for C-parser change to avoid complex call lvals (JIRA VER-881) 2018-07-05 16:23:14 +10:00
Michael Sproul 81fca9ab65 x64: crefine: clear some sorries from VSpace_C 2018-07-05 16:23:14 +10:00
Michael Sproul c2797809ec x64: crefine: fix confused deputy problem when setting priorities 2018-07-05 16:23:14 +10:00
Michael Sproul 88f5f072b1 x64: crefine: Genericise deletion actions that occur after empty_slot
Based on Joel's changes for ARM_HYP
2018-07-05 16:23:14 +10:00
Matthew Brecknell 511d2e3693 x64: update proofs for new ccorres_rewrite 2018-07-05 16:23:14 +10:00
Matthew Brecknell 10c6a46405 x64: update proofs for msgLabelBits 2018-07-05 16:23:14 +10:00
Joel Beeren 4666cf43ba x64: crefine: cleared some sorries in Ipc_C
Cleared all bitfield sorries as well as remnant sorries from previous
spec changes. Only sorries remaining require spec changes
(msgLabelBits, VER-910) or C/c-parser changes (VER-881).
2018-07-05 16:23:14 +10:00
Joel Beeren 9141e3c1c2 x64: crefine: move lemma from Tcb_C to SR_lemmas_C, and more canonical_address lemmas to SR_Lemmas 2018-07-05 16:23:14 +10:00
Matthew Brecknell bcac2c8492 x64: clear some sorry proofs from CSpace_C
Also update some Haskell and abstract specs relating to IO ports.
2018-07-05 16:23:14 +10:00
Joel Beeren b072714ca1 x64: crefine: move pspace_canonical' lemmas to refine 2018-07-05 16:23:14 +10:00
Joel Beeren 5d425337d2 x64: crefine: cleared sorries in Tcb_C 2018-07-05 16:23:14 +10:00
Joel Beeren 74a4be7a74 x64: crefine: cleared non sign extend sorries in Tcb_C 2018-07-05 16:23:14 +10:00
Rafal Kolanski 022f6a5981 x64 crefine: update existing proofs for pspace_canonical'
The logic roughly follows what happens in Refine, but gets woven into
ccorres proofs making this non-obvious.
Similar breakage will become evident once more sorries are cleared
around retyping/deleting.
2018-07-05 16:23:14 +10:00
Rafal Kolanski 334949125c x64 crefine: update or sorry broken proofs up to Syscall_C 2018-07-05 16:23:14 +10:00
Rafal Kolanski 569abcff5a x64 crefine: add Syscall_C to Refine_C for testing 2018-07-05 16:23:14 +10:00
Rafal Kolanski 53553ea260 x64 crefine: update scheduler bitmap lemmas
Applied the changes from invert-fastpath on ARM_HYP to available X64
files, updated relevant proofs to 64-bit, reduced IpcCancel sorries to
sign_extend only, reduced Schedule to one sorry.
2018-07-05 16:23:14 +10:00
Gerwin Klein e94d70f42c x64: crefine: remove 3 sorries in Retype_C
(added 3 more)
2018-07-05 16:23:14 +10:00
Gerwin Klein 5ef384cf07 x64 crefine: Detype_C sorry-free 2018-07-05 16:23:14 +10:00
Joel Beeren c858e6b75b x64: crefine: cleared sorry in checkCapAt_ccorres 2018-07-05 16:23:14 +10:00
Joel Beeren 812828fd35 x64: crefine: initial, broken commit of ADT_C 2018-07-05 16:23:14 +10:00
Joel Beeren dbf763ad01 x64: crefine: cleared sorries in SyscallArgs_C 2018-07-05 16:23:14 +10:00
Joel Beeren 710090f8e7 x64: crefine: cleared sorries in CSpace_RAB_C 2018-07-05 16:23:14 +10:00
Joel Beeren 25abf2b929 x64: crefine: onle Arch_decodeIRQControlInvocation_ccorres remains in Interrupt_C 2018-07-05 16:23:14 +10:00
Joel Beeren 88b2d4988d x64: crefine: added Syscall_C 2018-07-05 16:23:14 +10:00
Joel Beeren 94a1215405 x64: crefine: added Arch_C 2018-07-05 16:23:14 +10:00
Joel Beeren daaeed46aa x64: crefine: added Invoke_C 2018-07-05 16:23:14 +10:00
Joel Beeren abda36a8f7 x64: crefine: added Recycle_C 2018-07-05 16:23:14 +10:00
Joel Beeren d27f7c9f60 x64: crefine: added Retype_C 2018-07-05 16:23:14 +10:00
Joel Beeren ff95aec20f x64: crefine: added Interrupt_C 2018-07-05 16:23:14 +10:00
Joel Beeren 1fc3536aff x64: crefine: added Schedule_C 2018-07-05 16:23:14 +10:00
Joel Beeren 5ccbe6061d x64: crefine: added Tcb_C 2018-07-05 16:23:14 +10:00
Joel Beeren 1079673d34 x64: crefine: adjust value_abbreviation in Delete_C 2018-07-05 16:23:14 +10:00
Joel Beeren fa38926ac3 x64: crefine: update for isabelle-2017 2018-07-05 16:23:14 +10:00
Joel Beeren c9633be900 x64: crefine: added Delete_C 2018-07-05 16:23:14 +10:00
Joel Beeren 05ace54dd4 x64: crefine: update sorries for C changes
changes include:
    * zombie bit numbers changing
    * object sizes abstracted
2018-07-05 16:23:14 +10:00
Joel Beeren b5d5b973f6 x64: crefine: added Ipc_C 2018-07-05 16:23:14 +10:00
Joel Beeren 24bc43a65a x64: crefine: added IsolatedThreadAction.thy 2018-07-05 16:23:14 +10:00
Joel Beeren f4e33ad6c6 x64: crefine: minor tweaks in VSpace_C 2018-07-05 16:23:14 +10:00
Joel Beeren 4668abb6b7 x64: crefine: added Finalise_C 2018-07-05 16:23:14 +10:00
Joel Beeren bb4cdf564b x64: crefine: added Detype_C 2018-07-05 16:23:14 +10:00
Joel Beeren 0bad4a3918 x64: crefine: add CSpace_All.thy 2018-07-05 16:23:14 +10:00
Joel Beeren 767b2612be x64: crefine: added IpcCancel_C 2018-07-05 16:23:14 +10:00
Joel Beeren a07380a7fc x64: crefine: added SyscallArgs_C 2018-07-05 16:23:14 +10:00
Joel Beeren 3a9818b070 x64: crefine: added CSpace_RAB_C.thy 2018-07-05 16:23:14 +10:00
Joel Beeren 3c3ce87df0 x64: crefine: added DetWP.thy 2018-07-05 16:23:14 +10:00
Joel Beeren 5982952444 x64: crefine: added StoreWord_C 2018-07-05 16:23:14 +10:00
Joel Beeren c69b10e2d4 x64: crefine: VSpace_C sorried
There are probably lots of lemmas missing but this will allow people to
move forward beyond VSpace_C to other files.

Many sorries are dependent on C changes still in the pipeline
2018-07-05 16:23:14 +10:00
Joel Beeren 3fb61f92a6 x64: crefine: interim commit of VSpace_C 2018-07-05 16:23:14 +10:00
Joel Beeren 55b5f165b7 x64: crefine: added getFaultAddr_ccorres to machine assumptions 2018-07-05 16:23:14 +10:00
Joel Beeren 72b1edaf96 x64: crefine: add CSpace_C to Refine_C for regression testing 2018-07-05 16:23:14 +10:00
Joel Beeren bf25de6b5b x64: crefine: added CSpace_C with sorries 2018-07-05 16:23:14 +10:00
Joel Beeren 5909835331 x64: crefine: adjust cl_valid_cap for irq_handler caps 2018-07-05 16:23:14 +10:00
Joel Beeren 0326c2a956 x64: crefine: add frame_cap condition to cl_valid_cap
On x64, there are only 3 possible page sizes, so it is no longer
possible to deduce that a page size is well-formed from just the
bitfield struct (previously there were 4 page sizes for a 2-bit field).
2018-07-05 16:23:14 +10:00
Joel Beeren 1069cb70f2 x64: crefine: fix default case in vmrights_to_H 2018-07-05 16:23:14 +10:00
Joel Beeren f24785cb8b x64: crefine: add neglected IOPortCap case to a few lemmas 2018-07-05 16:23:14 +10:00
Joel Beeren c80d51bf2a x64: crefine: added Machine_C 2018-07-05 16:23:14 +10:00
Joel Beeren a5aae07229 x64 crefine: added CSpaceAcc_C 2018-07-05 16:23:14 +10:00
Corey Lewis c71fa27e14 Whitespace and typos 2018-07-03 13:42:23 +10:00
Corey Lewis 571ef6d0ca crefine+drefine+access+infoflow: update proofs for SetTLSBase (VER-807) 2018-07-03 13:42:22 +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 5cff1d47ac crefine: fix finaliseCap proof for 1ul shift change 2018-04-27 07:12:09 +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
Thibaut Perami 4c7ca8c076 arm+arm_hyp crefine: Split TLB functions to local and local+remote functions 2018-04-19 11:12:27 +10:00
Gerwin Klein cf601cb3c6 refine+crefine: update proofs for range check change 2018-04-11 08:05:46 +10:00
Rafal Kolanski 31290e2d92 arm-hyp crefine: update proofs for ARMv7 refactor 2018-04-06 14:24:47 +10:00
Corey Lewis 2d0baab462 Proof update for crunch changes 2018-04-04 14:13:55 +10:00
Gerwin Klein 9b0441e288 arm + arm_hyp: crefine for ctcb_offset C AUXUPD 2018-03-26 14:37:22 +11:00
Gerwin Klein 62bee91f12 cspec/crefine: make ctcb_offset available to AUXUPD 2018-03-26 14:37:22 +11:00
Thomas Sewell 0f38e20094 Many proof repairs. 2018-03-16 14:57:51 +11:00
Japheth Lim bea2e09c04 crefine: further update for C-parser change to avoid complex call lvals (JIRA VER-881) 2018-03-14 17:58:43 +11:00
Gerwin Klein 44bd2788cd arm-hyp crefine: proof update for user_context refactor 2018-03-08 18:41:28 +11:00
Gerwin Klein 4eb4ddf53f ARM crefine: proof update for user_context refactor 2018-03-08 18:41:28 +11:00
Gerwin Klein 21bbc51d9b x64 crefine: proof update for user_context refactor 2018-03-08 18:41:28 +11:00
Japheth Lim d7ec3eb986 crefine: update for C-parser change to avoid complex call lvals (JIRA VER-881) 2018-02-28 11:22:53 +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
Matthew Brecknell 6e74fa1ae3 arm/arm-hyp crefine: update proofs for new ccorres_rewrite 2018-02-18 13:05:41 +11:00
Joel Beeren 3d225cde69 VER-910: add msgLabelBits to haskell
message_info structs have 20 bit labels. On 32-bit systems, the label
does not need to be masked as there are no extra padding bits in the
struct, but this is not true for 64-bit systems. As a result, the
haskell needs to mask msgLabelBits (=20) when extracting the label in
messageInfoFromWord.
2018-02-07 10:36:59 +11:00
Matthew Fernandez d675e253ba fix broken README links 2018-01-29 13:24:35 +11:00
Matthew Brecknell eabbd86327 x64: remove references to x64KSCurrentCR3, following Meltdown mitigation
Changes to the C kernel to mitigate the Meltdown vulnerability have
removed x64KSCurrentCR3, and replaced it with other state. As a
temporary fix, this commit removes references to x64KSCurrentCR3 from
the C state relation to keep existing proofs working.

For x64 verification, this ultimately needs to be replaced with a
relation on the new state that has been added, and the specs updated
accordingly.
2018-01-22 16:28:33 +11:00
Michael Sproul 995b88cefa SELFOUR-707: schedule highest priority thread on setPriority 2018-01-19 16:08:11 +11:00
Matthew Brecknell 2f540e802c add constant definitions for bounds on untyped object sizes 2017-12-18 12:58:27 +11:00
Joel Beeren af2b7c7792 VER-825: Change representation of SchedulerAction_ChooseNewThread from ~0 to 1
This change was a result of the constant "(tcb_t*)~0" being defined as
0x00000000FFFFFFFF on x86-64 (0 is implicitly a 32-bit integer) rather
than 0xFFFFFFFFFFFFFFFF as expected.
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
Matthew Brecknell a2dd6d1777 autocorres-crefine: update CRefine proofs for AutoCorres 2017-11-22 15:37:36 +11:00
Matthew Brecknell 079d5dec23 autocorres-crefine: make AutoCorres tools available in CRefine 2017-11-22 12:18:16 +11:00
Matthew Brecknell 40f83c5637 autocorres-crefine: add tools for moving between ccorres and corres
This commit adds a method `ac_init`, which converts a ccorres goal into
a corres goal. It also adds an attribute `ac`, which converts a ccorres
fact into a corres fact, in a form suitable for solving goals produced
by `ac_init`.
2017-11-22 10:59:57 +11:00
Matthew Brecknell bd44bab6c6 autocorres-crefine: update for Isabelle2016-1 2017-11-22 10:59:57 +11:00
Matthew Brecknell f66d6278b2 Isabelle2017: update CRefine (X64) 2017-10-30 12:23:26 +11:00
Matthew Brecknell 78341b24ef Isabelle2017: update CRefine (ARM_HYP) for RC0 2017-10-30 12:23:26 +11:00
Alejandro Gomez-Londono 7da301cfc3 Isabelle2017: update CRefine (ARM) for RC0 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
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 c93ed2e629 x64: crefine: add TcbAcc_C to Refine_C for testing 2017-09-26 11:27:33 +10:00
Joel Beeren 1d103daf46 x64: crefine: add TcbAcc_C 2017-09-26 11:27:33 +10:00
Joel Beeren 87e169a78f x64: crefine: adjust register_from_H to use 32 word as per C code 2017-09-21 16:05:35 +10:00
Matthew Brecknell 3744c71a48 crefine autocorres: update c-kernel import paths for new kernel build system 2017-09-21 13:23:38 +10:00
Adrian Danis 8273ca818d cspec: Remove redundancy in build rules and theory files for c-kernel builds
Removes files that were duplicated in cspec/$L4V_ARCH directories to exist directly in
the cspec directory and contain $L4V_ARCH switches where needed. This allows for a single
Makefile for building the C kernel and the KernelInc_C theory, which is different between
architectures, to still exist per L4V_ARCH.

As the build location of the C kernel, and the resulting kernel_all.c_pp artifact, is
moved this change needs to be reflected in all the theory files that refer to it.
2017-09-21 13:23:04 +10:00
Gerwin Klein 00bff34f07 arm-hyp crefine: bitfield generator proof updates 2017-09-20 22:03:04 +10:00
Gerwin Klein 564359b13e arm crefine: proof updates for bitfield generator changes
The name mangling of "v" changes in a few places, and mask_def is
occasionally needed where it wasn't before.
2017-09-20 22:03:04 +10:00
Joel Beeren 15076ecda6 x64 crefine: adjust Refine_C to also use PSpace_C for testing 2017-09-19 12:34:35 +10:00
Joel Beeren ec5716d04b x64 crefine: added PSpace_C 2017-09-19 12:22:13 +10:00
Joel Beeren 4d47d6540a x64 crefine: added Ctac_lemmas_C 2017-09-19 12:21:58 +10: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
Joel Beeren 7c54fc69dd x64: change Refine_C to point to TcbQueue_C for regression testing 2017-09-14 14:51:58 +10:00
Joel Beeren ae707eb153 x64: crefine: added TcbQueue_C 2017-09-14 14:51:58 +10:00
Joel Beeren 1160bb053c x64: crefine: SR_Lemmas_C first attempt 2017-09-14 14:50:14 +10:00
Joel Beeren 0c117b7738 x64: crefine: StateRelation_C first attempt 2017-09-14 14:50:14 +10:00
Joel Beeren 7bbf6be54f x64: crefine: Added Wellformed_C
Currently one sorried lemma due to inconsistencies in maxDomain
definition, which needs follow up with the kernel team.
2017-09-14 14:50:14 +10:00
Joel Beeren d0782b89f8 x64: crefine: added CLevityCatch 2017-09-14 14:50:14 +10:00
Joel Beeren 15704dbc08 x64: crefine: add Move_C 2017-09-14 14:50:14 +10:00
Joel Beeren 92f5d14c0b x64: crefine: add Include_C 2017-09-13 16:44:53 +10:00
Joel Beeren 8032234af9 crefine: integrate all architectures 2017-08-09 17:02:50 +10:00
Matthew Brecknell 3871575834 x64: add crefine stubs to keep theory_imports happy 2017-08-09 17:02:49 +10:00
Matthew Brecknell e66b3f44d0 trivial: remove a tab character 2017-07-31 11:05:44 +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 5a82068c34 crefine: resolve a small issue in design spec coming from haskell translator inflexibility
- a case-statement in decodeARMMMUInvocation has an if-statement with a conjunction of three conditions, but they are translated in different orders between arm and arm-hyp and currently the crefine proofs depend on those orders.
- this fix is not a fundumental solution, but, given how reliable the haskell translator is, not sure how much effort we should be putting in here
2017-07-03 10:31: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
Matthew Brecknell 2f4b822da9 x64: configure arch-specific array types 2017-06-22 17:24:53 +10:00
Joel Beeren 392d055e99 SELFOUR-748: rename tlb invalidation functions 2017-06-20 14:05:45 +10:00
Alejandro Gomez-Londono d44ab4082a arm crefine: Refactors createMappingEntries_valid_pde_slots'2 due to new definitions 2017-06-19 14:32:45 +10:00
Alejandro Gomez-Londono 1950b051a5 arm crefine: Refactors Arch_finaliseCap_ccorres for new if-body 2017-06-19 14:32:45 +10:00
Alejandro Gomez-Londono 284cb43f7b arm crefine: Updates clearMemory_setObject_PTE_ccorres to use pteBits 2017-06-19 14:32:45 +10:00
Alejandro Gomez-Londono 4c1d294a75 arm crefine: Updates {getActiveIRQ,isIRQPending}_ccorres with new argument 2017-06-19 14:32:45 +10:00
Alejandro Gomez-Londono 17776ce6d3 arm crefine: Refactors proofs for new definitions (pteBits, pdeBits, etc) 2017-06-19 14:32:45 +10:00
Pang Luo a4e9ffa403 arm-hyp: refactor tpidrurwRegister and fix corresponding proofs
See VER-717
2017-06-19 14:32:43 +10:00
Joel Beeren 1f4b9e686a arm-hyp: rename archTCBSanitise, arch_tcb_sanitise_condition, Arch_hasVCPU to be more appropriate 2017-06-19 14:32:43 +10:00
Gerwin Klein 8076ba136a arm-hyp crefine: adjust Syscall_C for wpsimp getting further 2017-06-19 14:32:43 +10:00
Rafal Kolanski 1869bfd574 arm-hyp crefine: vgicMaintenance ccorres; CRefine sorry-free 2017-06-19 14:32:43 +10:00
Miki Tanaka 6176e4ab60 arm-hyp crefine: Ipc_C sorry-free 2017-06-19 14:32:42 +10:00
Rafal Kolanski af1b6d50e7 arm-hyp crefine: Fastpath_C sorry-free 2017-06-19 14:32:42 +10:00
Rafal Kolanski a559cca656 arm-hyp crefine: weaken preconditions on vcpu_switch
Requiring MDB validity (contained in valid_pspace') was too strong for
fastpath proofs.
2017-06-19 14:32:42 +10:00
Rafal Kolanski 1adc307094 arm-hyp crefine: remove unused lemma with conflicting name 2017-06-19 14:32:42 +10:00
Rafal Kolanski 705b86f25b arm-hyp crefine: fix monadic rewrite proof in Ipc_C 2017-06-19 14:32:42 +10:00
Rafal Kolanski a0cb855dc9 arm-hyp crefine: VSpace_C sorry-free, vcpu_(save|restore)_ccorres done 2017-06-19 14:32:42 +10:00
Matthew Brecknell f29099d490 arm-hyp crefine: prove ccorres for vcpu_init during VCPU retype 2017-06-19 14:32:42 +10:00
Gerwin Klein 242296a350 arm-hyp crefine: Arch_C sorry-free 2017-06-19 14:32:42 +10:00
Alejandro Gomez-Londono 396039a730 arm-hyp crefine: fixes get_gic_vcpu_ctrl_lr machine op + others
* others: fix arg name in get_gic_vcpu_ctrl_eisr0
    get_gic_vcpu_ctrl_eisr1 and get_gic_vcpu_ctrl_misr
2017-06-19 14:32:42 +10:00
Rafal Kolanski f24fe6ac7d arm-hyp crefine: remove references to FIXME in Arch_C
Specs got updated, FIXME lemmas removed, but the references were not
updated until now.
2017-06-19 14:32:42 +10:00
Gerwin Klein a36043fec1 arm-hyp crefine: update IsolatedThreadActions for vcpuSave change 2017-06-19 14:32:41 +10:00
Miki Tanaka 08bd86042a arm-hyp crefine: reflect spec changes for makeVIRQ and decodeVCPUInjectIRQ 2017-06-19 14:32:41 +10:00
Rafal Kolanski 2ed26c2c00 arm-hyp crefine: finish proof of invokeVCPUInjectIRQ_ccorres
Possible now that virq_t is storable.
2017-06-19 14:32:41 +10:00
Rafal Kolanski 1d72a3e389 arm-hyp crefine: put virq_C in twoToSix_packed class
Somewhere automation has failed, resulting in virq_C not being in a size
class, hence arrays not being in packed_type. Therefore typ_heap_simps
would not work since strictly speaking there was no indication the
object could be stored in memory.

This caused hours of suffering for all concerned.
2017-06-19 14:32:40 +10:00
Rafal Kolanski 6266d327f8 arm-hyp: isolate evil vgicLR update cmap_relation lemma
see: vcpu_vgic_lr_update_cmap_relation

This is hard, might take a while.
2017-06-19 14:32:40 +10:00
Rafal Kolanski a4b8684232 arm-hyp crefine: virq_virq_pending_EN_new_spec (incl 1 sorry)
makeVIRQ is sadly wrong, new spec is sorried, waiting for upstream
update to conform
2017-06-19 14:32:40 +10:00
Rafal Kolanski db2e052295 arm-hyp crefine: (invoke|decode)VCPUInjectIRQ_ccorres (incl. 3 sorries)
Sorried:
  - definition waiting on upstream change (decodeVCPUInjectIRQ_def)
  - hard word proof in progress
  - stuckage on typ_heap_simps not firing
2017-06-19 14:32:40 +10:00
Rafal Kolanski d4edba3e07 arm-hyp crefine: setMR_as_setRegister_ccorres
usually when we call setMR directly, we mean to only set one,
which will fit in actual registers
2017-06-19 14:32:40 +10:00
Rafal Kolanski ef93982d2f arm-hyp crefine: convenience lemmas and augmentations
- add proper ccorres_pre_gets_armKSGICVCPUNumListRegs_ksArchState
  - many of the other ccorres_pre_gets* lemmas are TOO WEAK to use safely!
- shiftr_and_eq_shiftl (proof by Matthew Brecknell)
2017-06-19 14:32:40 +10:00
Rafal Kolanski a5c9384df5 clib: ccorres_grab_asm
like ccorres_gen_asm, but when your last conjunct is K (...)
2017-06-19 14:32:40 +10:00
Joel Beeren 7969414919 arm-hyp crefine: fix some sorries in Ipc_C, fixed proofs broken by sanitiseRegister change 2017-06-19 14:32:40 +10:00
Gerwin Klein e33d4d3145 arm-hyp crefine: widen VSpace_C sorry for spec changes 2017-06-19 14:32:40 +10:00
Gerwin Klein 3a7d75e554 arm-hyp crefine: adapt to spec changes 2017-06-19 14:32:40 +10:00
Gerwin Klein 35a24ecf4e arm-hyp crefine: repair setVMRoot lemma
Only the 2 loop sorries now left in VSpace_C
2017-06-19 14:32:39 +10:00
Gerwin Klein 1cb83b6351 arm-hyp crefine: close 1 sorry in VSpace_C 2017-06-19 14:32:39 +10:00
Gerwin Klein 85efb9d922 arm-hyp crefine: update state relation for new vgic fault message 2017-06-19 14:32:39 +10:00
Gerwin Klein c63ba94746 arm-hyp crefine: close 1 sorry in VSpace_C 2017-06-19 14:32:39 +10:00
Miki Tanaka 11d7a7ab62 arm-hyp crefine: change names of vcpu ccorres rules, vpcuDisable_ccorres -> vcpu_disable_ccorres, etc.
similarly for vcpu_save, vcpu_enable, and vcpu_restore
2017-06-19 14:32:39 +10:00
Miki Tanaka 082295491e arm-hyp crefine: vcpu_disable_ccorres done 2017-06-19 14:32:39 +10:00
Alejandro Gomez-Londono 57c20b69b4 arm-hyp crefine: Finalise_C sorry free 2017-06-19 14:32:39 +10:00
Joel Beeren e1c3e764f8 arm-hyp crefine: narrowed down sorries in Ipc_C to specific subgoals 2017-06-19 14:32:39 +10:00
Joel Beeren 220fa70586 arm-hyp crefine: cleared sorries in Tcb_C 2017-06-19 14:32:38 +10:00
Joel Beeren 0c40f5bbb6 arm-hyp crefine: cleared 3 sorries in Tcb_C 2017-06-19 14:32:38 +10:00
Rafal Kolanski 87ac6d5508 arm-hyp crefine: decodeVCPUSetTCB_ccorres
+ perform
2017-06-19 14:32:38 +10:00
Gerwin Klein 2d4f1158cd arm-hyp crefine: reduce Retype_C to 1 sorry 2017-06-19 14:32:38 +10:00
Gerwin Klein f27921bccb arm-hyp crefine: Schedule_C sorry-free 2017-06-19 14:32:38 +10:00
Gerwin Klein c81c652f00 arm-hyp crefine: (minor) reduce Syscall to vgicMaintenance sorry 2017-06-19 14:32:38 +10:00
Rafal Kolanski 7769026872 arm-hyp crefine: decodeVCPUWriteReg_ccorres
+ perform
2017-06-19 14:32:38 +10:00
Gerwin Klein b82014766a arm-hyp refine: fix resolveVAddr breakage 2017-06-19 14:32:38 +10:00
Gerwin Klein 0afd65ea55 arm-hyp crefine: close resolveVAddr sorry 2017-06-19 14:32:38 +10:00
Gerwin Klein 85053b2580 arm-hyp refine: new vs_valid_duplicates
The Haskell invariant now describes the page mappings necessary for LargePage
and SuperSection. Updates to refine/* to repair the corresponding fallout.

This commit moves some of the largePagePTEOffset et al lemmas from CRefine up
into Refine.

A small number of small but fiddly word lemmas are currently still sorried.
2017-06-19 14:32:38 +10:00
Rafal Kolanski f09ba20de5 arm-hyp crefine: decodeVCPUReadReg_ccorres
Integrated into decodeVCPUInvocation.
2017-06-19 14:32:38 +10:00
Rafal Kolanski 29b20dc71a arm-hyp crefine: add extended wp rules for readVCPUReg to Move 2017-06-19 14:32:37 +10:00
Rafal Kolanski daea169e14 arm-hyp crefine: invokeVCPUReadReg_ccorres
Significantly complicated, needing multiple updates from kernel team to get
the reply mechanism right.
2017-06-19 14:32:37 +10:00
Alejandro Gomez-Londono 11a709caa4 arm-hyp crefine: associateVCPUTCB_ccorres + dissociateVCPUTCB_ccorres + others
* sanitiseSetRegister_ccorres
  * vcpuInvalidateActive_ccorres
  * armHSCurVCPU_update_active_false_ccorres
  * + Other auxiliary lemmas
2017-06-19 14:32:37 +10:00
Rafal Kolanski daa4e579e4 arm-hyp crefine: writeVCPUReg_ccorres 2017-06-19 14:32:37 +10:00
Rafal Kolanski 2ef0ba91db arm-hyp crefine: fix arg name for vcpu reg machine ops
Was value_', should have been val_'.
2017-06-19 14:32:37 +10:00
Rafal Kolanski 25b178e4bd arm-hyp crefine: solve_rf_sr_vcpu_update method
Solves goals of the following shape (rf_sr on fields of VCPUs):
   ⟦ (σ, σ') ∈ rf_sr; ko_at' vcpu vcpuptr σ ⟧
    ⟹ (σ⦇ksPSpace := ksPSpace σ(vcpuptr ↦ KOArch (KOVCPU (f vcpu)))⦈,
       globals_update
        (t_hrs_'_update (hrs_mem_update (heap_update (Ptr &(vcpu_Ptr vcpuptr→[''some_field''])) val)))
        σ')
      ∈ rf_sr

I was not able to generalise this more. A rule would be better, but I don't
know how to bind one to the textual field lookup.

It's also slow, 10s per invocation, but at least it works.
2017-06-19 14:32:37 +10:00
Rafal Kolanski d0eedd118b arm-hyp crefine: sorry resolveVAddr_ccorres due to C changes 2017-06-19 14:32:37 +10:00
Rafal Kolanski cb06acba7b arm-hyp crefine: readVCPUReg_ccorres 2017-06-19 14:32:37 +10:00
Rafal Kolanski 57c3c70437 arm-hyp crefine: add cvcpu_relation_regs_def
expands cvcpu_relation into relations of VCPU registers
2017-06-19 14:32:37 +10:00
Rafal Kolanski cce2e0805e arm-hyp crefine: add rewrites for C versions of vcpureg comparisons
see: vcpureg_eq_use_types

Transforms (of_nat (fromEnum reg) = scast seL4_VCPUReg_SCTLR)
      into (reg = VCPURegSCTLR)
letting you do cases on reg. There are no cases for seL4_VCPUReg*.

Inspired by invocation_eq_use_types
2017-06-19 14:32:37 +10:00
Rafal Kolanski 40057dff26 arm-hyp crefine: trivial generalisation in IpcCancel_C
[] -> hs in setThreadState_ccorres
2017-06-19 14:32:37 +10:00
Miki Tanaka 903417e288 arm-hyp crefine: some progress in VSpace_C 2017-06-19 14:32:37 +10:00