| 1 | CIVL: The Concurrency Intermediate Verification Language
|
|---|
| 2 | v1.21
|
|---|
| 3 |
|
|---|
| 4 | ------------------------------ Overview -------------------------------
|
|---|
| 5 |
|
|---|
| 6 | CIVL is a framework encompassing...
|
|---|
| 7 |
|
|---|
| 8 | * a programming language, CIVL-C, which adds to C a number of
|
|---|
| 9 | concurrency primitives, as well as the ability to define
|
|---|
| 10 | functions in any scope. Together, these features make for
|
|---|
| 11 | a very expressive concurrent language that can faithfully
|
|---|
| 12 | represent programs using various APIs and parallel languages,
|
|---|
| 13 | such as MPI, OpenMP, Pthread, CUDA, and Chapel. CIVL-C also
|
|---|
| 14 | provides a number of primitives supporting verification.
|
|---|
| 15 | * a model checker which uses symbolic execution to verify a
|
|---|
| 16 | number of safety properties of CIVL-C programs. The model
|
|---|
| 17 | checker can also be used to verify that two CIVL-C programs
|
|---|
| 18 | are functionally equivalent.
|
|---|
| 19 | * a number of translators from various commonly-used languages
|
|---|
| 20 | and APIs to CIVL-C. (This part is still a work in progress.)
|
|---|
| 21 |
|
|---|
| 22 | CIVL is developed by the Verified Software Laboratory at the
|
|---|
| 23 | University of Delaware Department of Computer Science.
|
|---|
| 24 | For more information, visit http://vsl.cis.udel.edu/civl
|
|---|
| 25 |
|
|---|
| 26 | Active Developers:
|
|---|
| 27 | Matthew B. Dwyer
|
|---|
| 28 | Mitchell Gerrard
|
|---|
| 29 | Ziqing Luo
|
|---|
| 30 | Stephen F. Siegel
|
|---|
| 31 | Wenhao Wu
|
|---|
| 32 | Alexander Wilton
|
|---|
| 33 |
|
|---|
| 34 | Inactive Developers:
|
|---|
| 35 | John Edenhofner
|
|---|
| 36 | Andre Marianiello
|
|---|
| 37 | Michael Rogers
|
|---|
| 38 | Timothy K. Zirkel
|
|---|
| 39 | Si Li
|
|---|
| 40 | Manchun Zheng
|
|---|
| 41 | Yihao Yan
|
|---|
| 42 |
|
|---|
| 43 | ------------------------------- License -------------------------------
|
|---|
| 44 |
|
|---|
| 45 | CIVL is open source software distributed under the GNU
|
|---|
| 46 | General Public License. However, the libraries used by CIVL
|
|---|
| 47 | (and incorporated into the complete distribution) use various
|
|---|
| 48 | licenses. See directory licenses for the license of each component.
|
|---|
| 49 |
|
|---|
| 50 | -------------------------- Updates from v1.20 -------------------------
|
|---|
| 51 | -- 1. refine the Fortran extension for paper submitted to TACAS 2022
|
|---|
| 52 | 1.1 Complete Fortran Array Descriptor for tracking changes made on
|
|---|
| 53 | index ranges by array section and reshape operations.
|
|---|
| 54 | Any declared array type is transformed into a Fortran array
|
|---|
| 55 | descriptor by Fortran to CIVL-C AST transformer.
|
|---|
| 56 | 1.2 Introduce four basic CIVL verification primitives Fortran bindings
|
|---|
| 57 | 1.2.1 Type qualifiers:
|
|---|
| 58 | - !$CVL $input: indicates that all variables declared immediately
|
|---|
| 59 | in the next line are symbolic and read-only.
|
|---|
| 60 | - !$CVL $output: indicates that all variables declared immediately
|
|---|
| 61 | in the next line are write-only and used for
|
|---|
| 62 | verifying functional output equivalence.
|
|---|
| 63 | A type declaration statement is required to be used immediately
|
|---|
| 64 | after any CIVL type qualifier and variables qualified shall follow
|
|---|
| 65 | read/write constraints mentioned above.
|
|---|
| 66 | CIVL assumption primitives can be used for limiting the value range
|
|---|
| 67 | of variables qualified by '!$CVL $input'.
|
|---|
| 68 | e.g.,
|
|---|
| 69 | !$CVL $input
|
|---|
| 70 | integer :: n, a(n)
|
|---|
| 71 | !! both 'n' and elements of 'a' are symbolic and read-only
|
|---|
| 72 | !$CVL $output
|
|---|
| 73 | integer :: sum
|
|---|
| 74 | !! sum is write-only and can be used for comparing with another
|
|---|
| 75 | !! program, which also has 'sum' with a same type and qualified
|
|---|
| 76 | !! by '!$CVL $output'
|
|---|
| 77 |
|
|---|
| 78 | 1.2.2 Verification
|
|---|
| 79 | - !$CVL $assume(logic_expr);
|
|---|
| 80 | Make CIVL only explores paths, whose path conditions shall
|
|---|
| 81 | make 'logic_expr' to be true.
|
|---|
| 82 | Set the value range for varialbes qualified by '!$CVL $input'
|
|---|
| 83 | - !$CVL $assert(logic_expr);
|
|---|
| 84 | Checks predicates representing specific correctness properties
|
|---|
| 85 | that users expect to verify.
|
|---|
| 86 | If any CIVL assertion primitive is evaluated as false, then
|
|---|
| 87 | CIVL shall report an assertion violation.
|
|---|
| 88 | 1.3 Add supports for additional Fortran features include:
|
|---|
| 89 | 1.3.1 'inout' and 'out' attributes declared by 'intent' statement
|
|---|
| 90 | 1.3.2 compound types with fields having scalar types.
|
|---|
| 91 | 1.3.3 pointer types to scalar types.
|
|---|
| 92 | 1.3.4 logic expression evaluation without short-circuits
|
|---|
| 93 | 1.3.5 line truncation for fixed and free forms
|
|---|
| 94 | 1.3.6 other features are shown here:
|
|---|
| 95 | https://vsl.cis.udel.edu/trac/civl/wiki/FortranTransformations
|
|---|
| 96 | 1.4 Add test cases imported from SMACK verification suite
|
|---|
| 97 | https://github.com/soarlab/gandalv/
|
|---|
| 98 | 2. CUDA Support Improvement
|
|---|
| 99 | 2.1 Fixed CUDA bug in which CUDA kernel declarations were not being
|
|---|
| 100 | transformed properly
|
|---|
| 101 | 2.2 Fixed source info bug (completeSources wasn’t being called
|
|---|
| 102 | everywhere that it should)
|
|---|
| 103 | 2.3 Fixed short circuit bug described in ticket #943
|
|---|
| 104 | 2.4 Added small optimization to short circuit transformer to allow
|
|---|
| 105 | for finer granularity of its transformation
|
|---|
| 106 | 3. Other Improvement and Fixed Bugs
|
|---|
| 107 | 3.1 MPI_Comm types can be compared by equality operator ('==').
|
|---|
| 108 | 3.2 Java-Doc improvements
|
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 | -------------------------- Updates from v1.19 -------------------------
|
|---|
| 112 | -- 1. added new language primitives:
|
|---|
| 113 | 1.1 $local_start() and $local_end()
|
|---|
| 114 | An execution of the statements in between of this pair, including this pair themselves,
|
|---|
| 115 | is NOT ONLY uninterruptable BUT ALSO purely local to the view of the verifier.
|
|---|
| 116 | 1.2 $read_set_push() and $read_set_pop() (the correspondence for write set has already been supported)
|
|---|
| 117 | This pair of primitives can be used to turn on/off the capturing of read set during execution.
|
|---|
| 118 | -- 2. added Fortran support for translating basic Fortran features into CIVL-AST
|
|---|
| 119 | (see: https://vsl.cis.udel.edu/trac/civl/wiki/FortranTransformations)
|
|---|
| 120 | -- 3. added simple Fortran verification examples (edited)
|
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 | ------------------------- Binary Installation -------------------------
|
|---|
| 124 |
|
|---|
| 125 | For most users, this will be the easiest way to install and
|
|---|
| 126 | use CIVL. Developers should instead follow the instructions for
|
|---|
| 127 | "Source Installation" below.
|
|---|
| 128 |
|
|---|
| 129 | 1. Install at least one of the theorem provers below.
|
|---|
| 130 | The more provers you install, the more precise CIVL analysis will
|
|---|
| 131 | be. Note that CIVL only requires the binary executable
|
|---|
| 132 | version of each prover; you can ignore the libraries, various
|
|---|
| 133 | API bindings, etc. You just need to ensure that
|
|---|
| 134 | each binary executable is in your PATH when you run
|
|---|
| 135 | "civl config". The currently supported provers are:
|
|---|
| 136 |
|
|---|
| 137 | - CVC3, http://www.cs.nyu.edu/acsys/cvc3/download.html
|
|---|
| 138 | download the latest, optimized build with static library
|
|---|
| 139 | and executable for your OS. Place the executable file
|
|---|
| 140 | "cvc3" in your PATH. You can discard everything else.
|
|---|
| 141 | Alternatively, on some linux systems, CVC3 can be installed
|
|---|
| 142 | using the package manager via "sudo apt-get install cvc3".
|
|---|
| 143 | This will place cvc3 in /usr/bin.
|
|---|
| 144 |
|
|---|
| 145 | - CVC4, http://cvc4.cs.nyu.edu/downloads/
|
|---|
| 146 |
|
|---|
| 147 | - Z3, http://z3.codeplex.com/SourceControl/latest
|
|---|
| 148 |
|
|---|
| 149 | 2. Install a Java 8 SDK if you have not already. Go to
|
|---|
| 150 |
|
|---|
| 151 | http://www.oracle.com/technetwork/java/javase/downloads/
|
|---|
| 152 |
|
|---|
| 153 | for the latest from Oracle. On linux, you can instead use
|
|---|
| 154 | the package manager:
|
|---|
| 155 |
|
|---|
| 156 | sudo apt-get install openjdk-8-jdk
|
|---|
| 157 |
|
|---|
| 158 | 3. Download the CIVL distribution from http://vsl.cis.udel.edu/civl.
|
|---|
| 159 |
|
|---|
| 160 | 4. Unzip and untar the CIVL distribution file if this
|
|---|
| 161 | does not happen automatically. This should result in a
|
|---|
| 162 | folder named CIVL-TAG, where TAG is some version ID string.
|
|---|
| 163 | This folder contains the following:
|
|---|
| 164 |
|
|---|
| 165 | - README : this file
|
|---|
| 166 | - bin : containing one executable sh script called "civl"
|
|---|
| 167 | - lib : containing civl-TAG.jar
|
|---|
| 168 | - doc : containing the manual and the tutorial of CIVL
|
|---|
| 169 | - emacs : CIVL-C emacs mode and its installation instructions
|
|---|
| 170 | - licenses : licenses for CIVL and included libraries
|
|---|
| 171 | - examples : some example CIVL programs
|
|---|
| 172 |
|
|---|
| 173 | 5. You can move the CIVL folder wherever you want.
|
|---|
| 174 | The JAR file in the lib directory is all you need to run CIVL.
|
|---|
| 175 | You may also move this jar file wherever you want. You
|
|---|
| 176 | run CIVL by typing a command that begins
|
|---|
| 177 | "java -jar /path/to/civl-TAG.jar ...". For convenience
|
|---|
| 178 | you may instead use the shell script "civl" in bin,
|
|---|
| 179 | which allows you to replace "java -jar /path/to/civl-TAG.jar"
|
|---|
| 180 | with just "civl" on the command line. Simply edit the civl script
|
|---|
| 181 | to reflect the path to civl-TAG.jar and place the script
|
|---|
| 182 | somewhere in your PATH. Alternatively, you can just define
|
|---|
| 183 | an alias in your .profile, .bash_profile, or equivalent, such as
|
|---|
| 184 |
|
|---|
| 185 | alias civl='java -jar /path/to/civl-TAG.jar'
|
|---|
| 186 |
|
|---|
| 187 | In the following, we will assume that you have defined
|
|---|
| 188 | a command "civl" in one these ways.
|
|---|
| 189 |
|
|---|
| 190 | 6. Type "civl config". This should report that it found
|
|---|
| 191 | the theorem provers you installed (and are in your PATH).
|
|---|
| 192 | It should create a file called ".sarl" in your home directory
|
|---|
| 193 | which you can also edit by hand.
|
|---|
| 194 |
|
|---|
| 195 |
|
|---|
| 196 | ------------------------- Source Installation -------------------------
|
|---|
| 197 |
|
|---|
| 198 | We recommend using the Eclipse IDE for Java/EE developers.
|
|---|
| 199 |
|
|---|
| 200 | 0. Install theorem provers following the directions above.
|
|---|
| 201 | Install Eclipse IDE for Java/EE developers if you have not already
|
|---|
| 202 | done so.
|
|---|
| 203 |
|
|---|
| 204 | 1. Install an SVN plugin in Eclipse (such as Subversive) if you have
|
|---|
| 205 | not already.
|
|---|
| 206 |
|
|---|
| 207 | 2. Install prerequisite projects ABC, SARL and GMC.
|
|---|
| 208 | Make sure that the three projects are put in the workspace
|
|---|
| 209 | directory where CIVL will be created. Specifically:
|
|---|
| 210 |
|
|---|
| 211 | a. Install the symbolic algebra and reasoning library SARL.
|
|---|
| 212 | In Eclipse, select New Project...from SVN, use the archive
|
|---|
| 213 | svn://vsl.cis.udel.edu/sarl. After entering that, open it
|
|---|
| 214 | up and select the "trunk". After checking out trunk, name
|
|---|
| 215 | the project "SARL". Then follow the instructions in the INSTALL
|
|---|
| 216 | file for Eclipse installation. Build the sarl.jar from within
|
|---|
| 217 | Eclipse by right-clicking (or ctrl-clicking) on the build.xml
|
|---|
| 218 | file and selecting Run As->Ant Build.
|
|---|
| 219 |
|
|---|
| 220 | b. Install the C front-end ABC. In Eclipse,
|
|---|
| 221 | select New Project...from SVN, use the archive
|
|---|
| 222 | svn://vsl.cis.udel.edu/abc. After entering that, open it
|
|---|
| 223 | up and select the "trunk". After checking out trunk, name
|
|---|
| 224 | the project "ABC". Then follow the instructions in the INSTALL
|
|---|
| 225 | file for Eclipse installation. Build the abc.jar from within
|
|---|
| 226 | Eclipse by right-clicking (or ctrl-clicking on OS X) on the
|
|---|
| 227 | build.xml file and selecting Run As->Ant Build.
|
|---|
| 228 |
|
|---|
| 229 | c. Install the generic model checking utilities package GMC.
|
|---|
| 230 | In Eclipse, select New Project...from SVN, use the archive
|
|---|
| 231 | svn://vsl.cis.udel.edu/gmc. After entering that, open it
|
|---|
| 232 | up and select the "trunk". After checking out trunk, name
|
|---|
| 233 | the project "GMC". Build the gmc.jar from within Eclipse
|
|---|
| 234 | by right-clicking (or ctrl-clicking) on the build.xml file and
|
|---|
| 235 | selecting Run As->Ant Build.
|
|---|
| 236 |
|
|---|
| 237 | 3. From within Eclipse, select New Project...from SVN. The archive is
|
|---|
| 238 | svn://vsl.cis.udel.edu/civl. After entering that, open it up and
|
|---|
| 239 | select the "trunk". (It is simplest to just check out the trunk for
|
|---|
| 240 | the Eclipse project.)
|
|---|
| 241 |
|
|---|
| 242 | 4. Check out the trunk, and create the project using the New Java
|
|---|
| 243 | Project Wizard as usual, naming it "CIVL". The .project, .classpath,
|
|---|
| 244 | and other Eclipse meta-data are already in the SVN archive,
|
|---|
| 245 | saving you a bunch of work.
|
|---|
| 246 |
|
|---|
| 247 | 5. If you already have the VSL dependencies library, you may
|
|---|
| 248 | skip this step. Otherwise, download the tgz archive of VSL
|
|---|
| 249 | dependencies from http://vsl.cis.udel.edu/lib/tools/vsl_depend
|
|---|
| 250 | Unzip the .tgz file and you will have the folder vsl.
|
|---|
| 251 | Move vsl to /opt.
|
|---|
| 252 | Note: you probably will need to use sudo for this.
|
|---|
| 253 | Also, if you don't already have a directory called /opt,
|
|---|
| 254 | you will have to create it with "mkdir /opt". Also, if you
|
|---|
| 255 | don't want to use /opt for some reason, you can use any
|
|---|
| 256 | directory you want; just modify the instructions below
|
|---|
| 257 | accordingly.
|
|---|
| 258 |
|
|---|
| 259 | Suppose that you put the .tgz file (or .tar file if your browser
|
|---|
| 260 | unzipped it automatically to a .tar file) in the directory DOWNLOAD.
|
|---|
| 261 | You can use the following commands:
|
|---|
| 262 |
|
|---|
| 263 | $ cd DOWNLOAD
|
|---|
| 264 | $ tar xzf YourTgzOrTarFile vsl
|
|---|
| 265 | $ sudo mv vsl /opt
|
|---|
| 266 |
|
|---|
| 267 | (Leave out the "x" in the tar command if the file was already
|
|---|
| 268 | unzipped.) Now you can type "ls /opt/vsl", and the output
|
|---|
| 269 | should be
|
|---|
| 270 |
|
|---|
| 271 | README.txt lib licenses src
|
|---|
| 272 |
|
|---|
| 273 | 6. If default_build.properties matches the configuration of your system,
|
|---|
| 274 | then you can skip this step. Otherwise, you may need to create a file
|
|---|
| 275 | build.properties in the directory containing build.xml.
|
|---|
| 276 | Copy and paste the content from any file under properties, edit each
|
|---|
| 277 | entry with the path configured in your system. The newly created file
|
|---|
| 278 | build.properties will automatically be used by ant to to build the
|
|---|
| 279 | .jar file.
|
|---|
| 280 |
|
|---|
| 281 | 7. Navigate to Preferences -> Java -> Build Path -> ClassPath
|
|---|
| 282 | Variables, and then select New to create a classpath variable VSL,
|
|---|
| 283 | and specify its value to be /opt/vsl.
|
|---|
| 284 |
|
|---|
| 285 | 8. Do a clean build. Everything should compile. Generate the civl.jar
|
|---|
| 286 | by right-clicking (or ctrl-click on OS X) the build.xml file and
|
|---|
| 287 | Run As->Ant Build.
|
|---|
| 288 |
|
|---|
| 289 | 9. Shortcuts for running CIVL
|
|---|
| 290 |
|
|---|
| 291 | Somewhere on your system, create a plain text file containing
|
|---|
| 292 | exactly the following two lines:
|
|---|
| 293 |
|
|---|
| 294 | #!/bin/sh
|
|---|
| 295 | java -jar /Path/To/Your/workspace/CIVL/civl.jar $@
|
|---|
| 296 |
|
|---|
| 297 | where "/Path/To/Your/workspace" is replaced with the path
|
|---|
| 298 | to your Eclipse workspace directory. Name this file "civl",
|
|---|
| 299 | put it in your PATH, and make it executable (chmod ugo+x civl).
|
|---|
| 300 |
|
|---|
| 301 | 10. From a terminal window, execute "civl config". This should
|
|---|
| 302 | find the theorem provers in your PATH and create a file
|
|---|
| 303 | .sarl in your home directory.
|
|---|
| 304 |
|
|---|
| 305 | 11. In Eclipse, navigate to "Run->Run Configurations... Create a new
|
|---|
| 306 | JUnit configuration."
|
|---|
| 307 | Name it "CIVL Regression Tests". Select "Run all tests in the
|
|---|
| 308 | selected project..." and navigate to the folder "test/regress"
|
|---|
| 309 | in the CIVL project. The Test runner should be JUnit 4. Under the
|
|---|
| 310 | Arguments tab, type "-ea" (without the quotes) in the VM arguments
|
|---|
| 311 | area (to enable assertion checking).
|
|---|
| 312 |
|
|---|
| 313 | 12. An example of how to set up a single test from within Eclipse:
|
|---|
| 314 | create a new Run Configuration via the Run->Run
|
|---|
| 315 | Configurations... menu. Create a new "Java Application"
|
|---|
| 316 | configuration. Call it "CIVL barrier2". The Project is CIVL. The
|
|---|
| 317 | main class is edu.udel.cis.vsl.civl.CIVL. Under the Arguments tab,
|
|---|
| 318 | set the Program arguments to
|
|---|
| 319 |
|
|---|
| 320 | verify examples/concurrency/barrier2.cvl
|
|---|
| 321 |
|
|---|
| 322 | Modify the VM arguments as in the step above. You should now be
|
|---|
| 323 | able to run the test by clicking "Run".
|
|---|
| 324 |
|
|---|