Running Steps of ConAnalysis
Installation and Build of LLVM, Clang, Compiler RT & LLDB
wget http://releases.llvm.org/5.0.0/llvm-5.0.0.src.tar.xz
tar -xvf llvm-5.0.0.src.tar.xz
wget http://releases.llvm.org/5.0.0/cfe-5.0.0.src.tar.xz
tar -xvf cfe-5.0.0.src.tar.xz
wget http://releases.llvm.org/5.0.0/compiler-rt-5.0.0.src.tar.xz
tar -xvf compiler-rt-5.0.0.src.tar.xz
wget http://releases.llvm.org/5.0.0/lldb-5.0.0.src.tar.xz
tar -xvf lldb-5.0.0.src.tar.xz
Use Version 3.6.1 instead (If not available or error occurs)!
Addresses of Version 3.6.1
http://releases.llvm.org/3.6.1/cfe-3.6.1.src.tar.xz
http://releases.llvm.org/3.6.1/llvm-3.6.1.src.tar.xz
http://releases.llvm.org/3.6.1/compiler-rt-3.6.1.src.tar.xz
http://releases.llvm.org/3.6.1/lldb-3.6.1.src.tar.xz
Move the Extracted Directories to the "tools" Directory of LLVM (and rename them for convenience)
mv cfe-5.0.0.src llvm-5.0.0.src/tools/clang
mv lldb-5.0.0.src llvm-5.0.0.src/tools/lldb
mv compiler-rt-5.0.0.src llvm-5.0.0.src/tools/compiler-rt
Get Dependencies Installed or Updated
sudo apt-get update
sudo apt-get install build-essential subversion python2.7-dev libedit-dev libncurses5-dev cmake inotify-tools fdupes libxml2-dev swig expect
Compile LLVM
Go to the llvm-3.6.1.src Directory.
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make # it takes so long
Build LLVM
After the above step, under path-to-llvm-source/build/bin, you'll see all the executables including clang and clang++ etc.
sudo make install
Installation of Submodules
Currently, we're using whole-program-llvm to build the target project into one single llvm bitcode file. We're using whole-program-llvm as a submodule of our project. The following are the steps to set up whole-program-llvm.
cd path-to-ConAnalysis-source
git submodule update --init --recursive
Setup Environment Variables
You can put the following bash command into your ~/.bashrc file. Make sure you replace the path-to... with your own path name.
export CONANAL_ROOT=path-to-ConAnalysis-source
alias wllvm=$CONANAL_ROOT/whole-program-llvm/wllvm
export WLLVM_HOME=$CONANAL_ROOT/whole-program-llvm
export PATH=${WLLVM_HOME}:${PATH}
export LLVM_COMPILER=clang
export WLLVM_OUTPUT=WARNING
To execute first,
source ~/.bashrc
Build ConAnalysis Project
cd $CONANAL_ROOT
mkdir build
cd build
cmake ..
make
Run the LLVM Analysis on libsafe
ctest -R libsafe
Then go to the folder contains the actual test output.
cd $CONANAL_ROOT/build/Testing/Temporary
vim LastTest.log
For each test case, there is a folder under TESTS named standard-output contains all the verified standarded output.
Run Scripts and Get Output Results
Softwares and tools used for concurrency attack in git repo: https://github.com/ruigulala/concurrency-exploits
Userspace
[ mk.sh -> run.sh -> autotestSyncloop.sh -> autotestConAnalysis.sh ]
Build MySQL ./mk.sh in concurrency-exploits/mysql-24988
./run.sh -> ./autotestSyncloop.sh mysql-24988 race_report0.race & ./autotestConAnalysis.sh mysql-24988 race_report0.race
Kernel Space
- Kernel Config
- source config.sh -> sh from git -> boot -> ssh enter
(To be continued ... )
(Additional) Install MySQL and Extract "bc" File
wget http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.7/mysql-5.7.19.tar.gz
tar -xvf mysql-5.7.19.tar.gz
cd mysql-5.7.19.tar.gz
Add Patches (in config.cmake):
/* Define to 1 if you have the `memcpy' function. */
#undef HAVE_MEMCPY
+#define HAVE_MEMCPY 1
/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE
+#define HAVE_MEMMOVE 1
/* Define to 1 if you have the header file. */
#undef HAVE_MEMORY_H
mkdir build
cd build
CC=wllvm CXX=wllvm++ cmake .. -DDOWNLOAD_BOOST=1 -DWITH_BOOST=$HOME/my_boost
CC=wllvm CXX=wllvm++ make
CC=wllvm CXX=wllvm++ make install
# for MySQL versions not using cmake
CC=wllvm CXX=wllvm++ ./configure
make
make install
# extract bit code file
extract-bc mysqld
You will get mysqld.bc in the end by these steps.