seL4 / l4v

seL4 specification and proofs
https://sel4.systems
Other
506 stars 105 forks source link
formalisation isabelle proof sel4-microkernel sel4-proofs

DOI CI Proofs Weekly Clean External

MCS:\ CI MCS Proofs

The L4.verified Proofs

This is the L4.verified git repository with formal specifications and proofs for the seL4 microkernel.

Most proofs in this repository are conducted in the interactive proof assistant Isabelle/HOL. For an introduction to Isabelle, see its official website and documentation.

Setup

This repository is meant to be used as part of a Google repo setup. Instead of cloning it directly, please follow the directions for software dependencies and Isabelle installation in the setup.md file in the docs directory.

Contributing

Contributions to this repository are welcome. Please read CONTRIBUTING.md for details.

Overview

The repository is organised as follows.

Hardware requirements

Almost all proofs in this repository should work within 4GB of RAM. Proofs involving the C refinement, will usually need the 64bit mode of polyml and about 16GB of RAM.

The proofs distribute reasonably well over multiple cores, up to about 8 cores are useful.

Running the Proofs

If Isabelle is set up correctly, a full test for the proofs in this repository for seL4 on the ARM architecture can be run with the command

L4V_ARCH=ARM ./run_tests

from the directory l4v/.

Set the environment variable L4V_ARCH to one of ARM, ARM_HYP, X64, RISCV64, or AARCH64 to get the proofs for the respective architecture. ARM has the most complete set of proofs, the other architectures tend to support only a subset of the proof sessions defined for ARM.

Not all of the proof sessions can be built directly with the isabelle build command. The seL4 proofs depend on Isabelle specifications that are generated from the C source code and Haskell model. Therefore, it is recommended to always build using the run_tests command or the supplied Makefiles, which will ensure that these generated specs are up to date.

To do this, enter one level under the l4v/ directory and run make <session-name>. For example, to build the abstract specification, do

export L4V_ARCH=ARM
cd l4v/spec
make ASpec

See the HEAPS variable in the corresponding Makefile for available targets. The sessions that directly depend on generated sources are ASpec, ExecSpec, and CKernel. These, and all sessions that depend on them, need to be run using run_tests or make.

Proof sessions that do not depend on generated inputs can be built directly with

./isabelle/bin/isabelle build -d . -v -b <session name>

from the directory l4v/. For available sessions and their dependencies, see the corresponding ROOT files in this repository. There is roughly one session corresponding to each major directory in the repository.

For interactively exploring, say the invariant proof of the abstract specification on ARM, note that in proof/ROOT the parent session for AInvs is ASpec and therefore run:

export L4V_ARCH=ARM
./run_tests ASpec
./isabelle/bin/isabelle jedit -d . -R AInvs

or, if you prefer make:

export L4V_ARCH=ARM
cd spec; make ASpec
../isabelle/bin/isabelle jedit -d . -R AInvs

in l4v/ and open one of the files in proof/invariant-abstract.