Giter VIP home page Giter VIP logo

xlauko / lart Goto Github PK

View Code? Open in Web Editor NEW
18.0 6.0 2.0 1.09 MB

LLVM Abstraction & Refinement Tool. The goal of this tool is to provide LLVM-to-LLVM transformations that implement various program abstractions. In terms of the instruction set, the resulting programs are normal, concrete LLVM programs that can be executed and analyzed.

License: MIT License

CMake 3.23% Shell 0.75% C++ 83.45% Python 5.15% Dockerfile 0.37% C 5.66% Jupyter Notebook 1.39%
static-analysis llvm abstraction abstract-interpretation symbolic-execution compilers model-checking compiler hacktoberfest

lart's Introduction

LART: LLVM Abstraction and Refinement Tool

Build Status License: MIT

LART = LLVM Abstraction & Refinement Tool. The goal of this tool is to provide LLVM-to-LLVM transformations that implement various program abstractions. In terms of the instruction set, the resulting programs are normal, concrete LLVM programs that can be executed and analyzed. Extra information about the abstraction(s) in effect over a (fragment) program is inserted using special LLVM intrinsic functions and LLVM metadata nodes. LART provides both a standalone tool that processes on-disk bitcode files, as well as a framework that can be integrated into complex LLVM-based tools. The primary motivation behind LART is to provide a "preprocessor" for LLVM-based model checkers and other analysis tools, simplifying their job by reducing the problem size without compromising the soundness of the analyses. The abstractions implemented by LART can be usually refined based on specific instructions about which "part" of the abstraction is too rough (an abstraction that is too rough will create spurious errors visible to subsequent analyses but not present in the original program).

Abstractions for LLVM Bitcode

The purpose of the entire exercise is to abstract away information from LLVM bitcode, making subsequent analyses more efficient (at the expense of some precision). To this end, we mainly need to be able to encode non-deterministic choice in LLVM programs, which can be done simply through a special-purpose function (similar to LLVM intrinsics). The function is named @lart.choice, takes a pair of bounds as arguments and non-deterministically returns a value that falls between those bounds.

This extension to LLVM semantics needs to be recognized by the downstream tool. This is also the only crucial deviation from standard LLVM bitcode. Many analysis tools will already implement a similar mechanism, either internally or even with an external interface. Adapting tools without support for @lart.choice to work with LART is usually very straightforward.

There are other special-purpose functions provided by LART, namely the @lart.meta.* family, but as far as these instructions are concerned, most tools will be able to safely ignore their existence, just like with existing @llvm.dbg.* calls. Program transformations would be expected to retain those calls in case LART is called in to refine an abstraction (each abstraction provided by LART comes with a corresponding refinement procedure, which will often need to find the @lart.meta calls inserted by the abstraction).

While most traditional abstraction engines work as interpreters, abstractions can also be "compiled" into programs. Instead of (re-)interpreting instructions symbolically, the symbolic instructions can be compiled. In case of predicate abstraction, the resulting bitcode will directly manipulate and use predicate valuations instead of concrete variables. As explained above, the important difference is that the bitcode needs to make non-deterministic choices, since some predicates may have indeterminate valuations (are both true and false). Some variables could be even abstracted away entirely, and all tests on such variables will yield both yes and no answers.

Build

Use or repeat the setup from ./devcontainer/Dockerfile for the time being.

Then use:

./scripts/build.sh

Run Compiler

./build/bin/lartcc <domain> <compiler arguments> in.c

OPT

opt -load build/lib/cc/liblart_module.so -lart < in.bc > out.bc

Test

lit -v build/test

Note: build/lartcc/lartcc has to have exacutabple permisions.

lart's People

Contributors

hadamove avatar xlauko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

lart's Issues

svcomp: array category

fix wrong results:

  • array-fpi/eqn4f.yml
  • array-fpi/eqn3f.yml
  • array-programs/copysome2-2.yml
  • array-programs/copysome1-2.yml
  • reducercommutativity/rangesum05.yml
  • array-industry-pattern/check_removal_from_set_after_insertion.yml
  • array-industry-pattern/array_single_elem_init.yml
  • array-examples/standard_partition_ground-1.yml
  • array-examples/standard_copy9_ground-1.yml
  • array-examples/standard_copy8_ground-2.yml
  • array-examples/standard_copy7_ground-1.yml
  • array-examples/standard_copy5_ground-2.yml
  • array-examples/standard_copy6_ground-1.yml
  • array-examples/standard_copy4_ground-2.yml
  • array-examples/standard_copy3_ground-2.yml
  • array-examples/standard_copy2_ground-1.yml
  • array-examples/standard_copy1_ground-2.yml
  • array-examples/standard_allDiff2_ground.yml
  • array-examples/sorting_selectionsort_2_ground.yml
  • array-examples/sorting_selectionsort_ground-1.yml
  • array-examples/sorting_bubblesort_ground-2.yml
  • array-examples/data_structures_set_multi_proc_ground-1.yml
  • array-examples/sorting_bubblesort_2_ground.yml

fix compilation errors:

  • array-fpi/ssina.yml
  • array-fpi/ssinaf.yml
  • array-fpi/ms2.yml
  • array-industry-pattern/array_ptr_single_elem_init-1.yml
  • array-industry-pattern/array_ptr_partial_init.yml
  • array-industry-pattern/array_of_struct_ptr_monotonic.yml
  • array-industry-pattern/array_of_struct_ptr_flag_init.yml
  • array-industry-pattern/array_of_struct_ptr_cond_init.yml
  • array-examples/relax-2.yml

svcomp: bitvector category

investigate wrong results:

  • bitvector/sum02-1.yml
  • bitvector-regression/recHanoi03-1.yml
  • bitvector-loops/diamond_2-1.yml
  • bitvector-loops/verisec_sendmail_tTflag_arr_one_loop.yml

investigate compilation error:

  • bitvector/soft_float_4-3a.c.cil.yml
  • bitvector/soft_float_5a.c.cil.yml

cc: setup preprocessing

  • lower select instructions
  • lower switch instructions
  • lower cmp instructions
  • duplicate called functions

svcomp: heap category

fix wrong results:

  • ldv-regression/rule57_ebda_blast_2.yml
  • ldv-regression/test24-2.yml
  • ldv-regression/test25-1.yml
  • ldv-regression/test28-1.yml
  • ldv-regression/test29-1.yml

dbg: add pretty printing scripts for debuger

create a convenient way to print abstract values right from debugger:

  • it should detect that value is tainted and return abstract print abstract values only in such case
  • use __lamp_dump and test taint functions
  • pretty printer for taints would be also valuable

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.