SanRazor is a sanitizer check reduction tool aiming to incur little overhead while retaining all important sanitizer checks (see new repository SanRazor).
The code snapshot for accompanying the manuscript "SanRazor: Reducing Redundant Sanitizer Checks in C/C++ Programs". Our evaluation results can be reproduced from this snapshot. We will provide more documents and instructions to help reproducing the results during the artifact evaluation submission.
src
contains the source code of SanRazor.var
contains the evaluation results of SanRazor.data
contains all the information for reproducing the evaluation results of SanRazor.
docker build -f Dockerfile -t sanrazor:latest --shm-size=8g .
docker run -it sanrazor:latest
bash build_autotrace.sh
- Download and install LLVM and Clang. We run the following command in Ubuntu 18.04 to complete this step:
svn co http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_900/final llvm
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_900/final clang
cd ..
cd tools/clang/tools
svn co http://llvm.org/svn/llvm-project/clang-tools-extra/tags/RELEASE_900/final extra
cd ../../..
cd projects
svn co http://llvm.org/svn/llvm-project/compiler-rt/tags/RELEASE_900/final compiler-rt
cd ..
cd projects
svn co http://llvm.org/svn/llvm-project/libcxx/tags/RELEASE_900/final libcxx
svn co http://llvm.org/svn/llvm-project/libcxxabi/tags/RELEASE_900/final libcxxabi
cd ..
mkdir bulid
cd build
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" ..
make -j 12
sudo make install
- Move the source code of SanRazor into your llvm project:
mv src/SRPass llvm/lib/Transforms/
mv src/SmallPtrSet.h llvm/include/llvm/ADT/
- Add the following command to
CMakeLists.txt
underllvm/lib/Transforms
:
add_subdirectory(SRPass)
- Compile your llvm project again:
cd llvm/build
make -j 12
- Install ruby and make sure that the following libraries are installed in your system:
fileutils
parallel
pathname
shellwords
- Initialization by the following code:
export SR_STATE_PATH="$(pwd)/Cov"
export SR_WORK_PATH="<path-to-your-coverage.sh>/coverage.sh"
SanRazor-clang -SR-init
- Set your compiler for C/C++ program as
SanRazor-clang
/SanRazor-clang++
(CC=SanRazor-clang
/CXX=SanRazor-clang++
), and run the following command:
make CC=SanRazor-clang CXX=SanRazor-clang++ CFLAGS="..." CXXFLAGS="..." LDFLAGS="..." -j 12
- Run your program with workload. The profiling result will be written into folder
$(pwd)/Cov
. - Run the following command to perform sanitizer check reduction:
make clean
SanRazor-clang -SR-opt
make CC=SanRazor-clang CXX=SanRazor-clang++ CFLAGS="..." CXXFLAGS="..." LDFLAGS="..." -j 12
- Test your program after check reduction.
- Install SPEC CPU2006 Benchmark.
- Run the following code under
SPEC_CPU2006v1.0/
to activate the spec environment:
source shrc
- Run the following script to evaluate SanRazor on SPEC CPU2006 Benchmark under
spec/
:
./run_spec_SR.sh
- See the evaluation reports under
SPEC_CPU2006v1.0/result
.
- Unzip
Cov.zip
under the source code folder of each software, which contains the coverage information and precompiled LLVM IR files. - Run the following command under the source code folder of each software:
export SR_STATE_PATH="$(pwd)/Cov"
export SR_WORK_PATH="<path-to-this-file>/coverage.sh"
SanRazor-clang -SR-opt -san-level=<> -use-asap=<>
make CC=SanRazor-clang CXX=SanRazor-clang++ CFLAGS="..." CXXFLAGS="..." LDFLAGS="..." -j 12
We reuse some code from ASAP.