Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 164b16e

Browse files
authored
Update README.md
1 parent c63b820 commit 164b16e

File tree

1 file changed

+80
-1
lines changed

1 file changed

+80
-1
lines changed

README.md

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,80 @@
1-
HexVASAN repo
1+
# HexVASAN: Venerable Variadic Vulnerabilities Vanquished
2+
3+
## To build:
4+
### Step 1: `git clone https://github.com/HexHive/HexVASAN.git`
5+
### Step 2: Now in your llvm working directory, do the following steps
6+
7+
```
8+
- rm /path/to/llvm/tools/clang/lib/Driver/Tools.cpp
9+
ln -s /path/to/HexVASAN/src/Tools.cpp /path/to/llvm/tools/clang/lib/Driver/Tools.cpp
10+
11+
- rm /path/to/llvm/tools/clang/include/clang/Basic/Sanitizers.def
12+
ln -s /path/to/HexVASAN/src/Sanitizers.def /path/to/llvm/tools/clang/include/clang/Basic/Sanitizers.def
13+
14+
- rm /path/to/llvm/tools/clang/include/clang/Driver/SanitizerArgs.h
15+
ln -s /path/to/HexVASAN/src/SanitizerArgs.h /path/to/llvm/tools/clang/include/clang/Driver/SanitizerArgs.h
16+
17+
- rm /path/to/llvm/include/llvm/Transforms/Instrumentation.h
18+
ln -s /path/to/HexVASAN/src/Instrumentation.h /path/to/llvm/include/llvm/Transforms/Instrumentation.h
19+
20+
- rm /path/to/llvm/include/llvm/InitializePasses.h
21+
ln -s /path/to/HexVASAN/src/InitializePasses.h /path/to/llvm/include/llvm/InitializePasses.h
22+
23+
- rm /path/to/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp
24+
ln -s /path/to/HexVASAN/src/BackendUtil.cpp /path/to/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp
25+
```
26+
27+
### Step 3:
28+
a. Now link the two compiler passes
29+
30+
```
31+
ln -s /path/to/HexVASAN/lib/Transforms/Instrumentation/VASAN.cpp path/to/llvm/lib/Transforms/Instrumentation/VASAN.cpp
32+
ln -s /path/to/HexVASAN/lib/Transforms/Instrumentation/VASANCaller.cpp path/to/llvm/lib/Transforms/Instrumentation/VASANCaller.cpp
33+
```
34+
35+
b. Now add VASAN.cpp and VASANCaller.cpp in the CMakeLists.txt in path/to/llvm/lib/Transforms/Instrumentation/
36+
37+
### Step 4:
38+
a. Now add the runtime library
39+
```
40+
ln -s /path/to/HexVASAN/runtime/vasan /path/to/llvm/projects/compiler-rt/lib/vasan
41+
```
42+
b. Add the following line in the CMakeLists.txt at /path/to/llvm/projects/compiler-rt/lib/
43+
```
44+
add_subdirectory(vasan)
45+
```
46+
### Step 5: cmake option for build
47+
```
48+
cmake -GNinja \
49+
-DCMAKE_BUILD_TYPE=Release \
50+
-DCMAKE_C_COMPILER=clang \
51+
-DCMAKE_CXX_COMPILER=clang++ \
52+
-DLLVM_ENABLE_ASSERTIONS=ON \
53+
-DLLVM_BUILD_TESTS=OFF \
54+
-DLLVM_BUILD_EXAMPLES=OFF \
55+
-DLLVM_INCLUDE_TESTS=OFF \
56+
-DLLVM_INCLUDE_EXAMPLES=OFF \
57+
-DBUILD_SHARED_LIBS=on \
58+
-DLLVM_TARGETS_TO_BUILD="X86" \
59+
-DCMAKE_C_FLAGS="-fstandalone-debug" \
60+
-DCMAKE_CXX_FLAGS="-fstandalone-debug" \
61+
../llvm
62+
```
63+
### Step 6:
64+
Build command
65+
```
66+
ninja
67+
```
68+
69+
## Run
70+
a. To run, give the following command:
71+
```
72+
$BUILD_DIR/bin/clang++ test.cpp -fsanitize=vasan
73+
./a.out
74+
```
75+
b. Alternatively, you can set the error log file and run with backtracing enabled
76+
```
77+
export VASAN_ERR_LOG_PATH="/tmp/vasan/"
78+
$BUILD_DIR/bin/clang++ test.cpp -fsanitize=vasan-backtrace
79+
./a.out
80+
```

0 commit comments

Comments
 (0)