Verified Software Toolchain (VST)

repository·master·Indexed 19 days ago

https://github.com/princetonuniversity/vst

A framework for the formal verification of software, including Verifiable C and VSTlib. It integrates with the CompCert formally verified C compiler (supporting ARM, PowerPC, RISC-V, and x86) and uses the Coq proof assistant to ensure program correctness. VSTlib provides Verified Software Units (VSUs) as standard library functions with formal specifications. The repository includes demonstrations of modular verification, abstraction, and subsumption based on the research by Beringer & Appel (FM 2019).

Tokens
13.3K
Snippets
28
Records
72
Agent score
67%

What's inside VST

  1. Overview of VST extensions for SC and RA atomics

    master

    The Verified Software Toolchain (VST) includes extensions for Sequential Consistency (SC) and Release-Acquire (RA) atomics. These extensions provide both formal Coq specifications and C interfaces for working with atomic operations.

    Core Atomics Components

    • general_atomics.v: Contains invariants, SC atomics, and definitions for logical atomicity.
    • acq_rel_atomics.v and acq_rel_SW.v: Provide axiomatic specifications for release-acquire (RA) atomics.
    • gen_atomics.h: The C header interface used to interact with these atomic operations in C code.
  2. Overview of the fastpile demonstration

    master
    The fast directory contains a demonstration of FUNSPEC_SUB and subsumption, based on the paper 'Abstraction and Subsumption in Modular Verification of C Programs' (Beringer & Appel, FM 2019). This demonstration showcases the verification of the fastpile program using Coq files that implement abstraction and subsumption techniques.
  3. Overview of ESOP'14 submission files

    master

    This directory contains the Coq files used for the 'Verified Compilation for Shared-Memory C' paper (ESOP'14). The files are organized by the sections of the paper they support:

    Section 3: Core Semantics and Memory

    • core_semantics.v: Definitions of core_semantics, cooperative core_semantics, and multistep relation lemmas.
    • mem_lemmas.v: Auxiliary definitions including mem_forward and mem_wd ("closed").

    Section 4: Forward Simulations and Compiler Correctness

    • forward_simulations.v: Logical simulations on cores. Module Forward_simulation_inj (starting at line 299) corresponds to Definition 4.1 in the paper.
    • forward_simulations_lemmas.v: Lemmas regarding the simulation definitions.
    • compiler_correctness.v: Lifts simulations to programs.
    • compcert_compiler_correctness.v: Relates compiler correctness to CompCert 2.0's memory-oblivious whole-program simulations.

    Transitivity Proof Files:

    • FiniteMaps.v: Auxiliary data structure for interpolating memories.
    • mem_interpol*.v: Interpolation lemmas (EE, EI, etc.) and constructions; all collected in mem-interpolants.v.
    • forward_simulations_trans.v: Proof of transitivity using interpolations.
    • compiler_correctness_trans.v: Lifts transitivity of core forward simulations to programs.

    Section 5: Safety Preservation

    • safety_preservation.v: Safety and semantics preservation, including restricted program safety for closed whole programs. (General program safety is in step_lemmas.v).

    Section 6: CompCert Integration

    • Includes files from CompCert 2.0 (e.g., Switch.v, Ordered.v, Cminor.v, Csharpminor.v, Cminorgen.v, Cminorgenproof.v).
    • CminorgenproofRestructured.v: Restructured version of Cminorgenproof.v to isolate instruction cases.
    • Cminor_coop.v & Csharpminor_coop.v: Cooperative core semantics formulations.
    • CminorgenproofSIM.v: Adapted proof of CompCert's Cminorgen phase.

    Linking and File Systems (Not discussed in paper)

    • linking.v: Extensional model of core semantics linking.
    • linking_simulations.v: States the linking simulation theorem.
    • linking_proof.v: Proves the linking simulation theorem.
    • fs_linking.v: Model of a simple file system and its linking simulation theorem.
  4. Overview of the CompCert verified C compiler

    master

    CompCert is a formally-verified C compiler for the core C language. It is distinguished by its formal verification using the Coq proof assistant, which provides a guarantee that the generated assembly code behaves exactly as prescribed by the semantics of the source C code.

    Supported Architectures:

    • ARM
    • PowerPC
    • RISC-V
    • x86
  5. Overview of CompCert verified C compiler

    master

    CompCert is a formally verified C compiler for a large subset of the C programming language. It is verified using the Coq proof assistant, providing a formal guarantee that the generated assembly code behaves according to the semantics of the source C code.

    Supported Architectures:

    • PowerPC
    • ARM
    • x86
    • RISC-V

    For detailed information regarding supported C features, installation, and usage, refer to the official CompCert website or the user's manual.

  6. Explore the fastpile demonstration of FUNSPEC_SUB and subsumption

    master

    The progs/pile/fast/ directory contains a demonstration of FUNSPEC_SUB and subsumption based on the paper 'Abstraction and Subsumption in Modular Verification of C Programs' (Beringer & Appel, FM 2019). This demonstration provides a complete verification of the fastpile program using Coq files.

    Key Files in this Demonstration

    Core Program and Specification (Figure 3 of the paper):

    • fastpile_private.h: Private header file.
    • fastpile.c: The C implementation of the fastpile program.
    • spec_fastpile.v: The Coq specification for fastpile.

    Verification Files:

    • verif_fastpile.v: The Coq proof for the fastpile program.
    • spec_fastapile.v: Additional specification files.

    Files discussed in Section 3 of the paper:

    • spec_fastpile_concrete.v: Concrete specification.
    • subsume_fastpile.v: Subsumption demonstration.
  7. Reference the file structure for the LICS/CSL'14 submission

    master

    This directory contains the formalization of "Structured logical simulation relations for blunderless separate compilation". The files are organized by the sections of the corresponding research paper:

    Section 2: Core Semantics and Memory

    • mem_lemmas.v: Auxiliary definitions, mem_forward, and CompCert memory model lemmas.
    • core_semantics.v: Definitions for core_semantics, cooperative core_semantics, and multistep relations.

    Section 4: Injections and Effects

    • StructuredInjections.v: Structured injections and associated lemmas.
    • effect_semantics.v: Single- and multi-step execution decorated with memory effects.
    • effect_simulations.v: Contains Lemma 1 (inject_restrict and REACH_inject).

    Section 5: Structured Logical Simulation Relations (SLSRs)

    • effect_simulations.v: Defines SLSRs (at the end of the file). Includes replace_locals/replace_externs (corresponding to leakOut/leakIn).
    • effect_simulations_lemmas.v: SLSR composition and multistep simulation diagrams.

    Section 6: Transitivity and Interpolation

    • rg_lemmas.v: Rely-guarantee propositions 1 and 2.
    • effect_simulations_trans.v: Main transitivity proof (Theorem 1: eff_sim_trans).
    • effect_corediagram_trans.v: Transitivity of the core diagram of SLSRs.
    • effect_interpolants.v: Interpolation lemma as a Coq module type.
    • effect_interpolation_II.v: Construction of interpolating memory.
    • effect_interpolation_proofs.v: Formal instantiation of the interpolation module.

    Section 7: CompCert Adaptations

    Located in ./compcert_adapt, these files adapt CompCert semantics (Clight, Csharpminor, Cminor, CminorSel, RTL) to the Core Semantics interface and support effect annotations.

    • [Language]_coop.v: Cooperative core semantics adaptations.
    • [Language]_eff.v: Effect annotation adaptations.
    • [Language]genproofEFF.v: Adaptations of CompCert simulation proofs to SLSRs.
    • effect_properties.v: Contains Lemma 2 (REACH_Store).

    Section 8: External Specs and Trace Semantics

    • extspec.v: Axiomatic specifications of external functions.
    • trace_semantics.v: Memory-instrumented events and trace semantics.
    • closed_safety.v: Safety for trace semantics.
    • open_semantics_preservation.v: Proof of Theorem 2 (trace_refinement) and Corollary 1 (corollary).
  8. Understand VST project organization and dependencies

    master

    VST is organized into several sub-projects. Understanding the dependency graph is helpful for developers working on specific modules:

    • msl (Mechanized Software Library): No dependencies.
    • examples: Depends on msl.
    • compcert: No dependencies.
    • zlist: No dependencies.
    • sepcomp: Depends on compcert.
    • veric: Depends on msl, compcert, and sepcomp.
    • floyd: Depends on msl, sepcomp, compcert, and veric.
    • progs: Depends on msl, sepcomp, compcert, veric, and floyd.

    Note on Imports: VST uses qualified imports (-Q). Modules must be referenced by their full qualified names (e.g., Require Import msl.msl_standard instead of Require Import msl_standard).

  9. Structure of verified concurrent data structures

    master

    For each verified concurrent data structure (such as kvnode_atomic, hashtable_atomic, kvnode_atomic_ra, or hashtable_atomic_ra), the repository provides a consistent set of files for implementation, representation, and verification:

    • <D>.c: The actual C implementation of the data structure.
    • <D>.v: The Coq representation of the C code, generated using the CompCert clightgen tool.
    • verif_<D>.v: The formal specifications and proofs of correctness for that specific data structure.
  10. CompCert licensing and usage restrictions

    master

    CompCert is not free software. This specific non-commercial release is restricted to:

    • Evaluation
    • Research
    • Educational purposes
    • Personal purposes

    For professional use without these restrictions, a commercial version with professional support is available for purchase from AbsInt. Refer to the LICENSE file in the repository for full legal details.

  11. Understand the multilevel verification framework

    master

    To prove a program correct using VST, the recommended approach is a multilevel verification strategy. This involves two distinct steps that can be composed into a single theorem:

    1. Low-level Verification: Prove that a low-level program (e.g., a C program) correctly implements a functional model (often written in Coq/Gallina). This step uses separation logic to specify how C variables and data structures encode the functional model's values.
    2. High-level Verification: Separately prove that the functional model satisfies a high-level specification (the desired mathematical property).

    Key Concepts for Verification Quality:

    • Multilevel/High-level: The verification includes both the implementation-to-model and model-to-specification steps.
    • Unified: The low-level and high-level proofs are performed in the same logical framework so they can be composed into one machine-checkable theorem.
    • Modular/Semimodular: Verification is done in the style of Verified Software Units (VSU), where each function is verified against its own specification, and callers depend only on the callee's specification, not its body.
  12. Understand module linking in VST proofs

    master

    The VSUpile directory serves as a demonstration of modular verification of modular programs.

    • Module Linking: To learn how module linking works in VST proofs, refer to section 2 of the paper 'Abstraction and Subsumption in Modular Verification of C Programs' by Lennart Beringer and Andrew W. Appel (FM 2019). The file linking.v provides support for module linking of VST proofs.
    • Subsumption: To see how subsumption works, examine the fast/ and incr/ directories within this project, which contain their own README files and verification examples.