Commit Graph

5400 Commits

Author SHA1 Message Date
Gerwin Klein 6d7b540963
aarch64 machine+ainvs: physBase abstraction
Remove the only unfolding of Kernel_Config.physBase_def in
ArchKernelInit by removing an unused lemma. Move the remaining
unfolding in ArchAInvariants to Kernel_Config_Lemmas.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-29 11:05:26 +11:00
Corey Lewis 7514d9ee69
arm access+infoflow: physBase abstraction
The example valid state is changed to correctly use both the virtual
and physical address of the shared page, instead of just the virtual
address.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-03-29 11:05:26 +11:00
Rafal Kolanski 0fc9a0542c
arm+arm-hyp machine+ainvs+refine+crefine: physBase abstraction
physBase is reduced to be unfolded only in Arch_Kernel_Config_Lemmas.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-03-29 11:05:25 +11:00
Corey Lewis 75db914627
word_lib: new lemmas about mask, AND, and shift
Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-03-29 11:05:25 +11:00
Rafal Kolanski 9288b78694
machine+aspec: add Arch_Kernel_Config_Lemmas
While having a single Kernel_Config_Lemmas was fine for constraining the
number of domains, it does not work for constraining architecture-specific
configuration options/values.

Add an (empty for now) Arch_Kernel_Config_Lemmas theory to every architecture
that imports the generic Kernel_Config_Lemmas. Change all imports of
Kernel_Config_Lemmas to import Arch_Kernel_Config_Lemmas instead.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-03-29 10:04:47 +11:00
Michael McInerney 27d838af86 lib+proof: rename bind_assoc_reverse to bind_assoc_return_reverse
This also improves the style of this lemma

Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-27 10:34:03 +10:30
Michael McInerney 3981e9a60e lib+ainvs: make monadic_rewrite available in AInvs session
This also reduces the imports of MonadicRewrite

Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-21 18:22:34 +10:30
Gerwin Klein e6b080ac38
tests: add kernel-config session (#614)
Make the C kernel config extraction visible as a separate test session
in run_tests so that run_tests can do concurrency control for it.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-21 13:50:37 +11:00
Michael McInerney 96e6e6a983 lib: add empty_fail_ifME and empty_fail_notM
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-21 10:45:28 +10:30
Michael McInerney fa9373674c lib: some corres rules for monadic combinators
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-21 10:45:28 +10:30
Michael McInerney adc7499aea lib: add ifME_liftE
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-21 10:45:28 +10:30
Gerwin Klein f4a9758d8b lib: add ifME
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-21 10:45:28 +10:30
Michael McInerney f74d42f745 lib: add ifM_throwError_returnOk
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-21 10:45:28 +10:30
Michael McInerney dc27565fbb lib: add notM and notM_wp
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-21 10:45:28 +10:30
Michael McInerney 1c0ceba850 lib: several lemmas involving exs_valid and the reader monad
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-20 18:55:49 +10:30
Rafal Kolanski d5fa6043cb proof: update (non-x64) for physBase-dependent defs
Co-authored-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-03-20 09:34:42 +11:00
Rafal Kolanski 317164b3b7 machine: prepare Platform for physBase definition
physBase is now a generated definition on all arches except X64, with
the expectation that this value can change (for static multikernel systems).
All definitions that depend on physBase in C must therefore adapt to
depend on the physBase constant instead of its unfolded value.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-03-20 09:34:42 +11:00
Rafal Kolanski ccce2b8071 arm+arm_hyp machine: update pptrBase comment
Update to match C, the old version was very confusing.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-03-20 09:34:42 +11:00
Matthew Brecknell 59dd0452fe ci: Fix broken external workflow
A previous commit added a new job which depended on a job that didn't
exist. We rename the `all` job to `proofs` for consistency with other
workflows.

Signed-off-by: Matthew Brecknell <matt@kry10.com>
2023-03-16 14:17:05 +11:00
Gerwin Klein c762b99b3b
docs: fix typo in setup.md (#613)
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-16 14:12:04 +11:00
Michael McInerney d844d691cb lib: move bind_assoc_reverse to lib
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-10 16:53:08 +10:30
Michael McInerney 909402d887 clib: add ccorres_call_getter_setter
This rule allows us to prove correspondence in the case
where the result of a function call is assigned to a
global variable

Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-03-10 16:53:08 +10:30
Gerwin Klein 3ca3553cc6
aarch64 ainvs: avoid global [simp] for if_option_eq (#608)
Keep simp set more in line with other architectures.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-09 18:21:08 +11:00
Gerwin Klein 56c1a7ca68
aarch64 ainvs: use new if_option_eq
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-09 10:34:00 +11:00
Gerwin Klein 63ef58cbdb
lib: simp setup for If and option
Terms of the form "(if P then None else Some _) = None" and all their
combinations can be simplified automatically. For the "Some" variants
we provide a safer form, e.g.:

    ((if P then Some x else None) = Some x) = P

because

    ((if P then Some x else None) = Some y) = (P /\ x = y)

adds an equation to the goal that the simplifier will pick up. That is
often wanted, but sometimes leads to non-termination.

Even the safer form can lead to non-termination if P is an equation, so
none of these are [simp] by default.

- `if_option_eq` is the safer set
- `if_option` is the less safe set that simplifies more

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-09 10:34:00 +11:00
Gerwin Klein 126fdfef77
aarch64 haskell: eliminate isValidNativeRoot
Define isValidVTableRoot directly as on the other architectures.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-09 10:15:19 +11:00
Gerwin Klein 6461e9223c
aarch64 haskell: defer reader monad FIXMEs to MCS
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-09 10:15:19 +11:00
Gerwin Klein f543ad0642
haskell: move countTrailingZeros to Data.Word_Lib
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-09 10:15:18 +11:00
Gerwin Klein 4a42803c6d
cspec: make remaining relative paths absolute (#607)
Previous commit 1a7eb92111 on fixing up overlay paths in kernel.mk
missed two instances.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-09 10:14:17 +11:00
Rafal Kolanski 19a56421c6 aarch64 haskell: resolve FIXMEs in Hardware
* getHSR confirmed unusued
* setHCR confirmed used on C side for hyp
* addressTranslateS1 was merged into C

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-03-08 18:04:03 +11:00
Rafal Kolanski 2155afbac4 aarch64 machine: clear up some FIXMEs in Platform.thy
* explain how canonical_bit concept applies to AArch64
* use powers of 2 for kernelELFBase
* pptrBase unlikely to migrate to 0 in near future
* pptrUserTop_def' is not used on AARCH64, and should not be used as we
  try to avoid expanding config_ARM_PA_SIZE_BITS_40 whenever possible

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-03-08 18:04:03 +11:00
Gerwin Klein 9d5c8be3dc
aarch64 ainvs: convert 2 FIXMEs into longer term issues (#601)
Both of these affect other architectures and need more discussion.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-08 17:04:37 +11:00
Gerwin Klein a454a093c0
lib: connection between exs_valid and wp conjugate (#588)
Draw connection between conjugate wp in the literature and our
exs_valid definition.

Add exs_valid_alt lemma, which is one of the main rules that is
different between wp and conjugate wp (or vs and).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-08 13:02:54 +11:00
Gerwin Klein 1a7eb92111
cspec: use absolute path for overlay targets (#597)
The `export-kernel-builds.py` script expects to be able to run the
build from an arbitrary temporary directory.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-08 07:59:32 +11:00
Gerwin Klein 42c4e78e9f
cspec: provide mechanism for adding dts overlays (#591)
Add mechanism for adding overlay.dts files to the l4v build for all
architectures apart from X64 (which does not use dts files).

For example, place a file `overlays/ARM/overlay.dts` into the tree and
the build will pick it up as custom overlay file with the correct proof
session dependencies.

If no file is provided, an empty default overlay file is used.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-07 14:35:53 +11:00
Rafal Kolanski c2a9ec60a8 arm-hyp crefine: update for physBase-as-function
In order to parametrise the kernel's physical address in verification,
physBase becomes a function in C.
This updates the functional correctness proofs so that they work again.
Proper abstraction of physBase in the proof is forthcoming.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2023-03-07 00:04:38 +11:00
Gerwin Klein c072a9c531
cspec: extract physBase from C headers
Extract the numeric value PHYS_BASE_RAW from the generated header
gen_headers/plat/machine/devices_gen.h and provide it as the constant
physBase in Kernel_Config.thy.

In C this will later match up with the value returned by physBase().

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-06 11:58:08 +11:00
Matthew Brecknell f694aeb6fe ci bv: Use bv-trigger action
Use the bv-trigger action to trigger a binary verification run, rather
than a called workflow.

Signed-off-by: Matthew Brecknell <matt@kry10.com>
2023-03-05 16:09:39 +11:00
Matthew Brecknell 2bed1814aa c-kernel: Support pre-built standalone C parser
Allow more settings to be overridden when using the standalone C parser
to generate kernel.sigs in the l4v kernel make files.

This makes it easier to use a pre-built standalone C parser, say, from a
Docker image.

Signed-off-by: Matthew Brecknell <matt@kry10.com>
2023-03-04 08:38:33 +11:00
Matthew Brecknell 7225fb3989 ci: Move decompilation workflow to graph-refine repository
The decompilation process (part of binary verification) is more tightly
coupled to the graph-refine repository than l4v, so it makes more sense
to perform decompilation in graph-refine. (It was temporarily performed
here in l4v because the graph-refine branches needed some stabilisation
work.)

This also modifies proof workflows:
- All proof workflows now upload kernel build artifacts. These can be
  used as inputs to binary verification.
- Proof workflows other than the one for pull requests (proof.yml)
  automatically trigger a decompilation workflow. We can still manually
  initiate a decompilation workflow using the uploaded artifacts, but
  doint so automatically would consume too many parallel runners.

Signed-off-by: Matthew Brecknell <matt@kry10.com>
2023-03-04 08:38:33 +11:00
Matthew Brecknell 4607098ded ci: Add a script to export kernel build artifacts
This can be used by l4v proof runs in GitHub CI to save kernel build outputs
for later use by binary verification.

Signed-off-by: Matthew Brecknell <matt@kry10.com>
2023-03-04 08:38:33 +11:00
Gerwin Klein eaf735c38f
cspec: adjust Kernel_Config generation (#590)
seL4/seL4#975 slightly changed how the config headers are generated.
They now need a (short) `ninja` build step and they produce less spaces
in the header file.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-02 11:54:20 +11:00
Gerwin Klein 244e7d464f
readme: explain L4V_ARCH and spec generation (#586)
We have so far not been mentioning L4V_ARCH in the instructions and
haven't pointed out which sessions need generated input.

Add this information to the instructions.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-01 16:53:37 +11:00
Gerwin Klein aa53e9a84c
github: provide nl-unescape script to BV trigger job
Need to check out the ci-actions repo first (where the nl-unescape.sh
script is located).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-03-01 14:51:52 +11:00
Peter Chubb 5fcec5f56a
Unescape verification-manifest.xml before saving it (#583)
The current xmllint tools don't like %0A to mean newline
so are crashing.

Signed-off-by: Peter Chubb <peter.chubb@unsw.edu.au>
2023-02-22 15:32:28 +11:00
Corey Lewis a2ffb3b4f5 proof: remove is_thread_control and thread_control_target
Instead use discriminator and selector provided by the datatype
package.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-02-14 18:33:44 +11:00
Corey Lewis b825663924 aspec: name remaining ThreadControl fields
This automatically generates matching selectors.

Signed-off-by: Corey Lewis <corey.lewis@proofcraft.systems>
2023-02-14 18:33:44 +11:00
Michael McInerney cf1af81384 lib: add more rules from MCS work
Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-02-14 14:05:05 +10:30
Michael McInerney 015fe74f04 lib: add some lemmas from MCS work to OptionMonadWP.thy
This includes some style improvements, too

Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2023-02-14 11:15:32 +10:30
Gerwin Klein 81513b894f
lib: fix link in Monads README (#576)
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-02-10 09:12:34 +11:00