Intel x86-64 Model
A static Intel-syntax listing of one function. Every path is checked, with data flow along the path and conditional jumps as guards.
saple analyze listing.txt --arch x86-64 --pattern-set=v0.6SAPLE models a system as process equations over shared state, written in its language SPL, and checks its properties and patterns with symbolic execution and an SMT solver.
Download the latest release
// Every coin should buy one pass.
type Gate = { LOCKED, UNLOCKED } ;
schema Turnstile {
attributes {
gate : Gate = LOCKED ;
coins : Int = 0 ;
passes : Int = 0 ;
}
}
transition coin() { guard: coins < 2 ;
effect: coins += 1 ; gate := UNLOCKED ; }
transition push() { guard: gate == UNLOCKED ;
effect: passes += 1 ; gate := LOCKED ; }
agent Controller() {
attributes { }
process {
Locked = [coins < 2] coin() . Unlocked
+ [coins == 2] done ;
Unlocked = push() . Locked
+ coin() . Unlocked ;
}
}
system Entrance {
schema: Turnstile ;
agents { Controller() ; }
properties { noLostCoin : coins <= passes + 1 ; }
}
noLostCoin
Trace coin → coin
1 finding(s): 1. [PROPERTY] HIGH — Property 'noLostCoin' violated Property: noLostCoin Trace: coin → coin
A real terminal recording of the released saple v0.3.0 binary, running both front ends exactly as their docs show. First the Intel x86-64 Model on a CWE-190 listing, then the AArch64 Model on a recorded run.
saple translate …/imul32_overflow_before_malloc.txt --arch x86-64 -o imul.spl, saple analyze imul.spl --pattern-set=v0.6. AArch64: saple translate …/chain_190_122.json --arch aarch64 -o chain.spl, saple analyze chain.spl --pattern-file patterns/aarch64-trace-v0.1.spl.
GIF version
An SPL model is a handful of declarations. SAPLE walks the agents' process equations over the shared state and reports every property that fails and every pattern that matches.
schemaschema Turnstile { attributes { coins : Int = 0 ; } }transitiontransition coin() { guard: coins < 2 ; effect: coins += 1 ; }agent., choice +, parallel ||, guards and recursion.
Unlocked = push() . Locked + coin() . Unlocked ;systemproperties { noLostCoin : coins <= passes + 1 ; }patternpattern dataRace {
signature { cpuWriteShared(core1, val1) . cpuWriteShared(core2, val2) . done }
constraints { core1 != core2 }
severity: CRITICAL ;
}Each front end turns machine code into an SPL model on bit-vector semantics, then matches the pattern libraries in patterns/ against it.
A static Intel-syntax listing of one function. Every path is checked, with data flow along the path and conditional jumps as guards.
saple analyze listing.txt --arch x86-64 --pattern-set=v0.6A trace-v1 recording of one run. Each pattern match is graded VERIFIED, OBSERVED, UNKNOWN or REFUTED.
saple translate run.json --arch aarch64 -o run.spl
saple analyze run.spl --pattern-file patterns/aarch64-trace-v0.1.splEach example is a complete, commented SPL file in examples/ with a walkthrough of what SAPLE reports.
Five philosophers, five forks; deadlock freedom, mutual exclusion and progress as properties.
WalkthroughFour cores sharing a line under MESI; the dataRace pattern matches.
Ten nodes take turns as validator; the block counter must never go negative.
WalkthroughPrebuilt binaries for Windows, macOS and Linux. The example models live in the repository.