Skip to content
You are reading the documentation of the development version (main branch): it may describe changes that are not released yet. Current documentation: 2026.10. Other versions: 2026.09 (extended documentation), 2026.09 (as released)

Log and Output Reference

This document explains how to read the live progress output and log files produced by ALVIE/Sancus learning (learn.exe) and comparison (fa.exe) phases.

During learning, ALVIE/Sancus prints a compact progress stream to stdout. Each character or bracketed token represents one interaction with the Sancus simulator. The stream is structured as repeated units of the form:

.[INPUT][OUTPUT].[INPUT][OUTPUT]...

A newline is printed each time the current hypothesis is promoted to the oracle for an equivalence check.

SymbolMeaning
. (yellow)SUL reset — the simulator was reset and a new run begins

Input Symbols (inside [...], before the output)

Section titled “Input Symbols (inside [...], before the output)”

Inputs are colour-coded by actor:

Yellow — no meaningful input

SymbolSourceMeaning
_—INoInput — empty/null input step

Blue — attacker actions

SymbolSourceMeaning
IAttackerCJmpIn — attacker jumps into the enclave
CAttackerCCreateEncl — attacker creates/enables an enclave
TAttackerCTimerEnable — attacker enables the hardware timer
SCAttackerCStartCounting — attacker starts the timer counter
NAttackerCInst NOP — attacker issues a no-op instruction
DAttackerCInst DINT — attacker disables interrupts
MAttackerCInst MOV — attacker issues a move instruction
AAttackerCInst ADD — attacker issues an add instruction
=AttackerCInst CMP — attacker issues a compare instruction
JMPAttackerCInst JMP — attacker issues an unconditional branch
JNZAttackerCInst JNZ — attacker issues a jump-if-not-zero
JZAttackerCInst JZ — attacker issues a jump-if-zero
PAttackerCInst PUSH — attacker pushes onto the stack
IfZAttackerCIfZ — attacker issues a conditional (if-zero) block
• (red)AttackerCRst — attacker triggers a reset unconditionally
Z (red)AttackerCRstNZ — attacker triggers a reset if not zero

Magenta — reti

SymbolSourceMeaning
R (magenta)AttackerCReti — attacker returns from interrupt

Green — enclave actions

SymbolSourceMeaning
NEnclaveCInst NOP
DEnclaveCInst DINT
UEnclaveCUbr — unconditional branch (exit the enclave)
MEnclaveCInst MOV
AEnclaveCInst ADD
=EnclaveCInst CMP
JMPEnclaveCInst JMP
JNZEnclaveCInst JNZ
JZEnclaveCInst JZ
PEnclaveCInst PUSH
BIfZEnclaveCBalancedIfZ — balanced conditional branch
IfZEnclaveCIfZ — conditional block
• (green)EnclaveCRst — enclave triggers a reset

Note: The same letter can appear in both blue (attacker) and green (enclave). Colour distinguishes the actor.


Output Symbols (inside [...], after the input)

Section titled “Output Symbols (inside [...], after the input)”

Output symbols follow the input within the same bracket and describe what the simulator observed. They are colour-coded by category:

Yellow — anomalous/illegal

SymbolMeaning
† (yellow)OIllegal — input not permitted at this point; the step is ignored
? (yellow)OUnsupported — action is not representable (e.g. unsupported mode transition)

Red — fatal/irrecoverable

SymbolMeaning
• (bold red)OReset — the processor reset; the run is terminated and re-initialised
∞ (bold red)OMaybeDiverge — simulation diverged (infinite loop detected)

Blue — attacker-driven transitions

SymbolMeaning
i (bold blue)OJmpIn — the processor entered the enclave (PM mode)
s (bold blue)OSilent — action completed silently (no observable effect on the enclave boundary)

Green — enclave-driven transitions

SymbolMeaning
o (bold green)OJmpOut — the enclave exited normally (returned to UM)
t (bold green)OTime — a timed observation (records cycle count k, register r4, memory, timer)

Magenta — interrupt-related

SymbolMeaning
r (bold magenta)OReti — processor returned from interrupt routine
th (bold magenta)OTime_Handle — timed observation followed by an interrupt being handled
oh (bold magenta)OJmpOut_Handle — enclave exit followed by an interrupt being handled

Each line of the learning log is one round of exploration. Example (colours stripped):

.[SC t][C t]

Decoded:

  • . — reset
  • [SC — input: attacker CStartCounting; t] — output: OTime (timed observation, success)
  • [C — input: attacker CCreateEncl; t] — output: OTime

A line ending with a newline (no more tokens) means the hypothesis was submitted to the equivalence oracle. If a counterexample is found, exploration resumes on the next line.


The t, i, o, r, th, oh outputs carry an internal payload (not shown in the stream but recorded in the model) consisting of:

FieldDescription
kCycle count for this step (instruction timing)
gieGlobal interrupt enable flag (true/false)
reg_valValue of register r4 (lower 3 bits)
umem_valValue of unprotected memory cell
timerA_counterHardware timer counter value
modeCPU mode at end of step: PM (protected) or UM (unprotected)

These values are what distinguish states in the learned Mealy machine and ultimately reveal whether the attacker can extract the secret.


Learning ends when the selected equivalence oracle accepts the current hypothesis or reaches its configured limit. ALVIE/Sancus writes the model to the .dot result file when learning completes. No explicit “done” message appears in the stream; check the process status and expected output file.

With --info, learn.exe also logs the progress of the equivalence oracle. The PAC oracle writes one line at the start of each round, for example:

learn.exe: [INFO] [53.2s] (PAC) equivalence query #17: hypothesis with 40 states, 1639 samples to draw (so far: 88 samples, 9593 output queries, 9681 resets, 9643 SUL steps, 70001 dry steps)

The time in brackets is measured from the start of the learner. A hypothesis that keeps growing from round to round, with no sign of stopping, is the first thing to check when a run does not finish.

For each counterexample, the oracle writes its inputs, the two outputs that differ (from the system and from the hypothesis), and the inputs again as an S-expression that exec.exe --sexp-input can replay.

With --report (always passed by the experiment wrappers), learn.exe ends by printing one line of comma-separated statistics on stderr, for example:

pac, 1, 0.010000, 0.010000, 500, 0.050000, 12049, 10764, 80881, 10212, 18, 4.912357, 10.952036, 10310

The fields are: oracle, PAC bound, epsilon, delta, step limit, reset probability, SUL resets, simulated SUL steps, SUL steps answered from the observation tree, output queries, equivalence queries, mean and variance of the length of the equivalence-query samples, and learning time in milliseconds (setup excluded).


The fa.exe binary compares pairs of learned models (secret=0 vs secret=1) and reports how many distinguishing traces (FA violations) it found. It prints the report only when --debug is set.

=== Results: found N FA violations. See <path>_int.dot for details.
PartMeaning
NNumber of distinct witness traces found where the two models behave differently
_int.dotThe counterexample graph for the interrupt-enabled models
  • N = 0: The comparison found no distinguishing trace in the selected learned models and configuration. This is no finding under that threat model, not a universal proof that Sancus is secure.
  • N > 0: The comparison found distinguishing traces in the selected learned models and configuration. Inspect and validate the corresponding witness before treating it as an implementation-level attack.

counterexamples/<namespace>/<attack>/<commit>-<attack>_int.dot is a Graphviz LTS (Labelled Transition System) graph where:

  • Each node represents a step in the distinguishing scenario.
  • Each edge is labelled with the input taken at that step.
  • Two branches diverge at the point where the two models produce different outputs, making them distinguishable.

Convert to PDF for inspection:

Terminal window
dot -Tpdf counterexamples/b6-sim/b6/d54f031-b6_int.dot -o attack_b6.pdf

Log files mirror the terminal stream and are written per experiment.

logs/<namespace>/learn-<name>.log — full learning progress for one model.

  • Contains the same symbol stream as the terminal output.
  • Ends with the learning statistics line, including the learning time.
  • Use cat or a terminal that handles ANSI escape codes to read with colours; use sed 's/\x1B\[[0-9;]*m//g' to strip them.

logs/<namespace>/compare-<commit>-<attack>.log — output of fa.exe for one model pair.

  • Contains the final === Results: found N FA violations line and debug information when --debug was passed. check_one.sh and check_all.sh pass --debug; check_example.sh does not, so its log has no count.

RESETS / SEPARATORS
. yellow SUL reset (new run starts)
INPUTS (before output in [...])
_ yellow No input
I blue JmpIn (attacker jumps into enclave)
C blue CreateEncl
SC blue StartCounting
T blue TimerEnable
= blue/green CMP instruction
U green Ubr (enclave unconditional branch / exit)
R magenta Reti
OUTPUTS (after input in [...])
† yellow Illegal (step rejected)
? yellow Unsupported
• red Reset
∞ red Diverge (infinite loop)
i blue JmpIn observed
s blue Silent
t green Timed observation (normal step)
o green JmpOut (enclave exited)
r magenta Reti observed
th magenta Timed + interrupt handled
oh magenta JmpOut + interrupt handled