Skip to content
You are reading the documentation of ALVIE 2026.09 (as released). Current documentation: 2026.10. Other versions: development version, 2026.09 (extended documentation)

Reproducing the Simulation Experiments

In this guide, we build ALVIE/Sancus, run its checked-in example, and then reproduce an attack experiment. We assume that the repository root is the current directory and that sancus-core-gap is checked out there.

The Dockerfile is the reference environment, so it is the shortest path to a reproducible setup. With Docker installed, we build and start it with:

Terminal window
docker build -t alvie .
docker run --rm -it alvie

The Dockerfile installs mCRL2 from its Ubuntu PPA on amd64 and builds it from source on arm64, so the default build works natively on both architectures. We specify --platform only when intentionally cross-building for another architecture. For a native setup, we need OCaml 4.13.1, Dune, the MSP430 toolchain, Verilator, Python 3 with Verilog_VCD, mCRL2, and the Sancus simulator checkout.

For either setup, we verify the OCaml build before running an experiment:

Terminal window
cd alvie/code
dune build
cd ../..

We begin with the checked-in example, which learns models for secret 0 and secret 1 at the final Sancus commit, both with and without interrupt handling:

Terminal window
rm -rf results/example counterexamples/example logs/example tmp/example
./learn_example.sh
./check_example.sh

The learned models are in results/example/, while the witness graph is in counterexamples/example/. We can list the exact output filenames with:

Terminal window
find results/example counterexamples/example -name '*.dot' -print

To inspect the witness visually, render it with Graphviz:

Terminal window
dot -Tpdf counterexamples/example/bf89c0b-attacker_int.dot -o example.pdf

The example test suite also runs independently:

Terminal window
cd alvie/code
dune exec tt_attack -- test --color=never

For an attack experiment, we use a distinct namespace so that its models, logs, and temporary files remain together. The third argument selects that namespace; when it does not name a directory under spec-lib/, the wrapper reads the root specifications. B6 is a practical first experiment:

Terminal window
./learn_one.sh d54f031 b6 b6-sim
./check_one.sh b6 b6-sim

The standard fixing commits are:

AttackFixing commit
B1e8cf011
B23170d5d
B36475709
B43636536
B6d54f031
B7264f135
B8, B9no special fixing commit

For B8 and B9:

Terminal window
./learn_one_nospecial.sh b8 b8-sim
./check_one.sh b8 b8-sim

Each standard ALVIE/Sancus attack run learns four models per relevant commit: secret 0 and secret 1, with interrupts enabled and disabled. The comparison uses all four models and writes a witness graph under counterexamples/<namespace>/<attack>/. Learning time varies substantially with the machine and specification, so we keep the generated namespace when comparing runs.

Terminal window
./learn_all.sh all-sim
./check_all.sh all-sim

The learning wrapper launches simulator jobs in parallel. We use a machine with enough memory and disk space for the temporary VCD and program files.

spec-lib/fast/ contains deliberately smaller attacker and enclave specifications. We pass fast as the namespace to select them:

Terminal window
./learn_one.sh d54f031 b6 fast

Fast specifications are useful for development and timing experiments, but they are not equivalent to the complete attacker profiles.

When we need to learn a single model rather than use the wrappers, we run learn.exe directly from alvie/code:

Terminal window
dune exec bin/learn.exe -- \
--att-spec ../../spec-lib/b6.atdl \
--encl-spec ../../spec-lib/enclave-complete.etdl \
--res /tmp/alvie-b6-s0.dot \
--tmpdir /tmp/alvie-b6 \
--sancus ../../sancus-core-gap \
--commit ef753b6 \
--secret 0 \
--oracle pac

We compare four models with:

Terminal window
dune exec bin/fa.exe -- \
--m1-int /tmp/model-0-int.dot \
--m2-int /tmp/model-1-int.dot \
--m1-nint /tmp/model-0-nint.dot \
--m2-nint /tmp/model-1-nint.dot \
--tmpdir /tmp/alvie-fa \
--witness-file-basename /tmp/alvie-witness

This writes /tmp/alvie-witness_int.dot. A nonzero violation count means the comparison found distinguishing traces under the learned models and selected threat model.

  • results/<namespace>/: learned .dot Mealy machines.
  • counterexamples/<namespace>/: comparison witness graphs.
  • logs/<namespace>/: stdout/stderr captured by the wrappers.
  • tmp/<namespace>/: generated assembly, binaries, simulator files, and VCDs.

The model filename contains the Sancus commit, attacker and enclave names, secret, PAC parameters, and either int or nint.