HolBA is a library based on the HOL4 theorem prover that provides tools for analysis and formal proofs of properties of programs in binary format that use the ARMv8, RISC-V and Cortex-M0 instruction sets.
Applications of HolBA include automated verification of contracts for ARMv8 and RISC-V binaries, as well as verification of execution time bounds for Cortex-M0, all based on the corresponding formal ISA specification in the L3 language. HolBA analyses use an intermediate language called BIR that abstracts from many ISA details. See the publications for more technical details and examples of binary analyses for specific ISAs.
HolBA is built using the Holmake tool bundled with HOL4.
trindemossen-2.If you already have HOL4 installed and Holmake in your path,
you can do the following to build the whole library, excluding examples:
git clone https://github.com/kth-step/HolBA.git
cd HolBA
Holmake
To build examples, you need to set the path to the Z3
binary and then run Holmake in the examples directory:
export HOL4_Z3_EXECUTABLE=/path/to/z3
cd examples
Holmake
For convenience, HolBA provides some scripts to bootstrap an environment with HOL4 and Z3 from a bash shell.
git clone https://github.com/kth-step/HolBA.git
cd HolBA
# This sets up all dependencies in this HolBA
# directory (${HOLBA_DIR}/opt). It downloads and
# builds polyml and HOL4 for example.
./scripts/setup/install_all.sh
# In order to create a configuration file with
# the directories for the installed tools,
# execute the following line
./configure.sh
# For convenience and indepence of make, this command
# augments the environment with ${HOLBA_*} variables
# as well as the ${PATH} variable. Now calls to Holmake
# use the installed instance of HOL4 in the opt directory.
# Furthermore, some tools require these variables to
# run properly. It has to be run for each new shell.
source env.sh
# This builds the whole library, excluding examples
${HOLBA_HOLMAKE}
# This builds the examples
cd examples
${HOLBA_HOLMAKE}
doc: Documentation about HolBA and BIRexamples: Applications of HolBA
arm8: Examples of specifying and verifying ARMv8 programs, including automation of contract proofs using symbolic executionarm_cm0: Examples of specifying and verifying Cortex-M0 programs, including automation of execution time bound proofs using symbolic executionbir: Examples of using the intermediate BIR language for specification and verificationriscv: Examples of specifying and verifying RISC-V programs, including automation of contract proofs using symbolic executionscripts: CI and installation scriptssrc: Library sources
extra: General theories and librariesshared: Libraries shared between tools
convs: conversion tacticsl3-machine-code: extensions to L3 models from HOL4 examplessmt: custom interfaces to SMT solvers via SMTLIB (currently Z3)sml-simplejson: JSON parsertheory: Domain-specific theories
bir: Core BIR languagebir-support: Extensions and supporting theories for BIRmodels: Additional machine modelsprogram_logic: Abstract Hoare-style logic for unstructured codetools: Theories for the tool libraries in src/toolstools: Domain-specific libraries
backlifter: Utilities for obtaining ISA-level contracts from BIR contractscfg: Control flow graph utilitiescomp: Composition of contractscompute: Utilities for using cv_compute in HOL4exec: Concrete executionlifter: Translation from binary ISA code to BIRpass: Passification utilityscamv: Abstract side channel model validation frameworksymbexec: Symbolic execution of BIRwp: Weakest precondition propagationtools/backlifter:
tools/cfg:
tools/comp:
tools/exec:
tools/lifter:
tools/pass:
tools/scamv:
tools/symbexec:
tools/wp:
To depend on HolBA in a project based on HOL4, we recommend setting up your project
to build using Holmake, and then adding references in your Holmakefile to
the directories where the modules from HolBA that you use reside in, relative to
the variable HOLBADIR.
For example, if you depend on modules in the src/theory/bir and
src/theory/bir-support directories, your Holmakefile may be as follows:
INCLUDES = $(HOLBADIR)/src/theory/bir $(HOLBADIR)/src/theory/bir-support
all: $(DEFAULT_TARGETS)
.PHONY: all
To then build your project, you can export the path to your copy of the HolBA repository
and run Holmake in the directory with your Holmakefile, which will recursively
build all required theories:
export HOLBADIR=/path/to/holba
Holmake
Please report any bug or feature request in the issue tracker.
Contributions such as new features and bugfixes are welcome as pull requests, but be sure to read the contribution guide before submitting them.
Standard ML
98.6%
HolBA is a library based on the HOL4 theorem prover that provides tools for analysis and formal proofs of properties of programs in binary format that use the ARMv8, RISC-V and Cortex-M0 instruction sets.
Applications of HolBA include automated verification of contracts for ARMv8 and RISC-V binaries, as well as verification of execution time bounds for Cortex-M0, all based on the corresponding formal ISA specification in the L3 language. HolBA analyses use an intermediate language called BIR that abstracts from many ISA details. See the publications for more technical details and examples of binary analyses for specific ISAs.
HolBA is built using the Holmake tool bundled with HOL4.
trindemossen-2.If you already have HOL4 installed and Holmake in your path,
you can do the following to build the whole library, excluding examples:
git clone https://github.com/kth-step/HolBA.git
cd HolBA
Holmake
To build examples, you need to set the path to the Z3
binary and then run Holmake in the examples directory:
export HOL4_Z3_EXECUTABLE=/path/to/z3
cd examples
Holmake
For convenience, HolBA provides some scripts to bootstrap an environment with HOL4 and Z3 from a bash shell.
git clone https://github.com/kth-step/HolBA.git
cd HolBA
# This sets up all dependencies in this HolBA
# directory (${HOLBA_DIR}/opt). It downloads and
# builds polyml and HOL4 for example.
./scripts/setup/install_all.sh
# In order to create a configuration file with
# the directories for the installed tools,
# execute the following line
./configure.sh
# For convenience and indepence of make, this command
# augments the environment with ${HOLBA_*} variables
# as well as the ${PATH} variable. Now calls to Holmake
# use the installed instance of HOL4 in the opt directory.
# Furthermore, some tools require these variables to
# run properly. It has to be run for each new shell.
source env.sh
# This builds the whole library, excluding examples
${HOLBA_HOLMAKE}
# This builds the examples
cd examples
${HOLBA_HOLMAKE}
doc: Documentation about HolBA and BIRexamples: Applications of HolBA
arm8: Examples of specifying and verifying ARMv8 programs, including automation of contract proofs using symbolic executionarm_cm0: Examples of specifying and verifying Cortex-M0 programs, including automation of execution time bound proofs using symbolic executionbir: Examples of using the intermediate BIR language for specification and verificationriscv: Examples of specifying and verifying RISC-V programs, including automation of contract proofs using symbolic executionscripts: CI and installation scriptssrc: Library sources
extra: General theories and librariesshared: Libraries shared between tools
convs: conversion tacticsl3-machine-code: extensions to L3 models from HOL4 examplessmt: custom interfaces to SMT solvers via SMTLIB (currently Z3)sml-simplejson: JSON parsertheory: Domain-specific theories
bir: Core BIR languagebir-support: Extensions and supporting theories for BIRmodels: Additional machine modelsprogram_logic: Abstract Hoare-style logic for unstructured codetools: Theories for the tool libraries in src/toolstools: Domain-specific libraries
backlifter: Utilities for obtaining ISA-level contracts from BIR contractscfg: Control flow graph utilitiescomp: Composition of contractscompute: Utilities for using cv_compute in HOL4exec: Concrete executionlifter: Translation from binary ISA code to BIRpass: Passification utilityscamv: Abstract side channel model validation frameworksymbexec: Symbolic execution of BIRwp: Weakest precondition propagationtools/backlifter:
tools/cfg:
tools/comp:
tools/exec:
tools/lifter:
tools/pass:
tools/scamv:
tools/symbexec:
tools/wp:
To depend on HolBA in a project based on HOL4, we recommend setting up your project
to build using Holmake, and then adding references in your Holmakefile to
the directories where the modules from HolBA that you use reside in, relative to
the variable HOLBADIR.
For example, if you depend on modules in the src/theory/bir and
src/theory/bir-support directories, your Holmakefile may be as follows:
INCLUDES = $(HOLBADIR)/src/theory/bir $(HOLBADIR)/src/theory/bir-support
all: $(DEFAULT_TARGETS)
.PHONY: all
To then build your project, you can export the path to your copy of the HolBA repository
and run Holmake in the directory with your Holmakefile, which will recursively
build all required theories:
export HOLBADIR=/path/to/holba
Holmake
Please report any bug or feature request in the issue tracker.
Contributions such as new features and bugfixes are welcome as pull requests, but be sure to read the contribution guide before submitting them.
Standard ML
98.6%