Skip to content

Commit

Permalink
Artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
FloridSleeves committed Sep 27, 2023
1 parent cbbbfab commit a46eead
Show file tree
Hide file tree
Showing 393 changed files with 123,178 additions and 1 deletion.
60 changes: 59 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,59 @@
# ValueCheck
# ValueCheck

This repo is for code release of our paper `Effective Bug Detection with Unused Definitions` in `EuroSys 2024`.

In the paper we propose to use cross-author unused definitions to detect bugs and prioritize bugs by its familarity.

Its workflow contains three steps:
* With the bitcode as input, ValueCheck applies static analysis to identify unused definitions and prune false positives.
* From the found snippets, ValueCheck extracts authorship information and capture cross-authorship relationship.
* After calculating the code familiarity, ValueCheck prioritizes the detected unused definitions.

This repo contains the source code, scrips, and other artifacts. These are required to reproduce the results we presented in the paper.
It helps the reproduction of evaluation results in the section 8 of the paper.

The artifact is available on GitHub at https://github.com/floridsleeves/ValueCheck.

## Software dependencies
- Linux (tested on Ubuntu 20.04)
- Python >=3.8
- SVF >= 2.7
- LLVM >= 12.0

## Data sets
- The artifact evaluates four open-source web applications. The scripts will automatically download their source code from GitHub and checkout the corresponding versions.
- The directory `bitcode` in the artifact includes the pre-compiled bitcode from each application by `wllvm` with flag `-fno-inline` `-O0` and `-g`. The bitcodes are broken into different modules to reduce the inter-procedural value analysis time of SVF.

## Steps to reproduce
- We provide a script `./install.sh` to automatically install the dependencies and build the software.
- We provide a script `./run.sh` to automatically perform the evaluation.

```python
./install.sh
# Step 0: Clean the previous output files
# Step 1: Install dependencies, compile SVF
# Step 2: Compile ValueCheck

./run.sh
# Step 3: Run ValueCheck - the analysis tool.
# Step 4: Run ValueCheck and produce the result
```

## Evaluation and expected results
We provide the scripts to automate the evaluation and generate the Tables and numbers in Section 4.
The output will be in the `result/` folder and contain the following key results:
- `result/table_2_detected_bugs.csv`:
- Total number of detected bugs from each application. (`Table 2`)
- `result/table_6_dok_effect.csv`:
- The number of detected bugs within top 20 bugs under different DOK settings. (`Table 6`)
- `result/figure_7_dist.pdf`, `result/figure_7_security.pdf`, `result/figure_7_days.pdf`:
- The category of bugs based on distribution, security, and days before detected. (`Figure 7`)
- `result/figure_9_detected_bug_dok.pdf`:
- The figure of reported bugs when increasing DOK rank. (`Figure 9`)
- `result/table_7_time_analysis.csv`:
- Time (seconds) to run the analysis. (First column of `Table 7`)

- In the `result/APP_NAME/` directory, `detected.csv` contains all the detected bugs.

Note that some results involve random sampling (second and third columns in `Table 6`) and developers' confirmation (last column in `Table 2`), thus not included in the artifact.
Note that due to the differences in hardware environments and the optimization we later add to the tool, the performance results in `Table 7` can be different from the numbers reported in the paper.
24 changes: 24 additions & 0 deletions SVF/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Release*/
Debug*/
build/
html/
Test-Suite
Release+Asserts/
Debug+Asserts/
autoconf/
tests/result/
doxygen/
.*
!.gitignore
*~
*.o
*.out
*.ll
*.bc
*.opt
*.log
*.status
*.obj
*.svf
cmake-build-debug/
compile_commands.json
90 changes: 90 additions & 0 deletions SVF/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
cmake_minimum_required(VERSION 3.13.4)

project("SVF")

configure_file(${PROJECT_SOURCE_DIR}/.config.in
${PROJECT_BINARY_DIR}/include/Util/config.h)

# We need to match the build environment for LLVM: In particular, we need C++14
# and the -fno-rtti flag
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# add -std=gnu++14
set(CMAKE_CXX_EXTENSIONS ON)

add_compile_options("-fno-rtti")
add_compile_options("-fno-exceptions")

# Treat compiler warnings as errors
add_compile_options("-Werror" "-Wall")
add_compile_options("-fPIC")

# Keep assertions enabled if requested
option(SVF_ENABLE_ASSERTIONS "Always enable assertions")
if(SVF_ENABLE_ASSERTIONS)
add_compile_options("-UNDEBUG")
endif()

# Turn this on if you need symbols (e.g., use them for backtrace debugging)
# add_link_options("-rdynamic")

option(SVF_COVERAGE "Create coverage build")
if(SVF_COVERAGE OR DEFINED ENV{SVF_COVERAGE})
add_compile_options("-fprofile-arcs" "-ftest-coverage")
add_link_options("-fprofile-arcs" "-ftest-coverage")
message(STATUS "Enable coverage")
endif()

set(SVF_SANITIZE
""
CACHE STRING "Create sanitizer build (address)")
if(SVF_SANITIZE STREQUAL "address")
add_compile_options("-fno-omit-frame-pointer" "-fsanitize=address")
add_link_options("-fsanitize=address")
message(STATUS "Sanitizer build: ${SVF_SANITIZE}")
elseif(SVF_SANITIZE STREQUAL "thread")
add_compile_options("-fsanitize=thread")
add_link_options("-fsanitize=thread")
message(STATUS "Sanitizer build: ${SVF_SANITIZE}")
elseif(NOT SVF_SANITIZE STREQUAL "")
message(ERROR "Unknown sanitizer type: ${SVF_SANITIZE}")
endif()

find_library(
Z3_LIBRARIES
NAMES z3
HINTS ${Z3_DIR} ENV Z3_DIR
PATH_SUFFIXES bin lib)
find_path(
Z3_INCLUDES
NAMES z3++.h
HINTS ${Z3_DIR} ENV Z3_DIR
PATH_SUFFIXES include z3)
if(NOT Z3_LIBRARIES OR NOT Z3_INCLUDES)
message(FATAL_ERROR "Z3 not found!")
endif()
message(STATUS "Found Z3: ${Z3_LIBRARIES}")
message(STATUS "Z3 include dir: ${Z3_INCLUDES}")

include_directories(${PROJECT_SOURCE_DIR}/svf/include
${PROJECT_BINARY_DIR}/include ${Z3_INCLUDES})

# checks if the test-suite is present, if it is then build bc files and add
# testing to cmake build
if(EXISTS "${PROJECT_SOURCE_DIR}/Test-Suite")
include_directories(${PROJECT_SOURCE_DIR}/Test-Suite)
enable_testing()
add_subdirectory(Test-Suite)
include(CTest)
endif()

add_subdirectory(svf)
add_subdirectory(svf-llvm)

install(
DIRECTORY ${PROJECT_SOURCE_DIR}/svf/include/
${PROJECT_SOURCE_DIR}/svf-llvm/include/
COMPONENT devel
DESTINATION include/svf
FILES_MATCHING
PATTERN "**/*.h")
36 changes: 36 additions & 0 deletions SVF/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM ubuntu:20.04

# Stop ubuntu-20 interactive options.
ENV DEBIAN_FRONTEND noninteractive

# Stop script if any individual command fails.
RUN set -e

# Define LLVM version.
ENV llvm_version=14.0.0

# Define home directory
ENV HOME=/home/SVF-tools

# Define dependencies.
ENV lib_deps="make g++-8 gcc-8 git zlib1g-dev libncurses5-dev build-essential libssl-dev libpcre2-dev zip vim libtinfo5"
ENV build_deps="wget xz-utils cmake python git gdb tcl"

# Fetch dependencies.
RUN apt-get update --fix-missing
RUN apt-get install -y $build_deps $lib_deps

# Fetch and build SVF source.
RUN echo "Downloading LLVM and building SVF to " ${HOME}
WORKDIR ${HOME}
RUN git clone "https://github.com/SVF-tools/SVF.git"
WORKDIR ${HOME}/SVF
RUN echo "Building SVF ..."
RUN bash ./build.sh

# Export SVF, llvm, z3 paths
ENV PATH=${HOME}/SVF/Release-build/bin:$PATH
ENV PATH=${HOME}/SVF/llvm-$llvm_version.obj/bin:$PATH
ENV SVF_DIR=${HOME}/SVF
ENV LLVM_DIR=${HOME}/SVF/llvm-$llvm_version.obj
ENV Z3_DIR=${HOME}/SVF/z3.obj
Loading

0 comments on commit a46eead

Please sign in to comment.