-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaflgo_slicer.patch
More file actions
79 lines (72 loc) · 3.08 KB
/
Copy pathaflgo_slicer.patch
File metadata and controls
79 lines (72 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
diff --git a/distance/distance_calculator/distance.bin.cc b/distance/distance_calculator/distance.bin.cc
index 869998b..7ec0877 100644
--- a/distance/distance_calculator/distance.bin.cc
+++ b/distance/distance_calculator/distance.bin.cc
@@ -163,6 +163,10 @@ std::vector<vertex_desc> cfg_calculation(
bo::trim(line);
std::vector<std::string> splits;
bo::algorithm::split(splits, line, bo::is_any_of(","));;
+ if (splits.size() != 2) {
+ cout << line << "\n";
+ cout << "splits.size(): " << splits.size() << "\n";
+ }
assert(splits.size() == 2);
cg_distance[splits[0]] = std::stod(splits[1]);
}
@@ -175,6 +179,10 @@ std::vector<vertex_desc> cfg_calculation(
bo::trim(line);
std::vector<std::string> splits;
bo::algorithm::split(splits, line, bo::is_any_of(","));;
+ if (splits.size() != 2) {
+ cout << line << "\n";
+ cout << "splits.size(): " << splits.size() << "\n";
+ }
assert(splits.size() == 2);
if (not find_nodes(G, splits[0]).empty()) {
if (cg_distance.find(splits[1]) != cg_distance.end()) {
diff --git a/instrument/aflgo-clang.c b/instrument/aflgo-clang.c
index a7ebc11..06e5979 100644
--- a/instrument/aflgo-clang.c
+++ b/instrument/aflgo-clang.c
@@ -1,5 +1,5 @@
/*
- aflgo compiler
+aflgo compiler
--------------
Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,6 +25,8 @@
static u8* obj_path; /* Path to runtime libraries */
static u8** cc_params; /* Parameters passed to the real CC */
static u32 cc_par_cnt = 1; /* Param count, including argv0 */
+static u8* slicer_pass;
+static u8* workspace;
/* Try to find the runtime libraries. If that fails, abort. */
@@ -33,6 +35,8 @@ static void find_obj(u8* argv0) {
u8 *afl_path = getenv("AFLGO");
u8 *slash, *tmp;
+ slicer_pass = getenv("SLICER_PASS");
+ workspace = getenv("WORKSPACE");
if (afl_path) {
@@ -111,10 +115,23 @@ static void edit_params(u32 argc, char** argv) {
cc_params[cc_par_cnt++] = "-sanitizer-coverage-block-threshold=0";
# error AFLGO has not supported trace-pc-guard yet
#else
+ if (getenv("USE_SLICER_PASS") && strcmp(getenv("USE_SLICER_PASS"), "1") == 0) {
+ cc_params[cc_par_cnt++] = "-Xclang";
+ cc_params[cc_par_cnt++] = "-load";
+ cc_params[cc_par_cnt++] = "-Xclang";
+ cc_params[cc_par_cnt++] = alloc_printf("%s", slicer_pass);
+ cc_params[cc_par_cnt++] = "-mllvm";
+ cc_params[cc_par_cnt++] = alloc_printf("-slice-mark=%s/slice_mark", workspace);
+ cc_params[cc_par_cnt++] = "-mllvm";
+ cc_params[cc_par_cnt++] = alloc_printf("-preserve-functions=%s/dontTouchFuncNames.txt", workspace);
+ cc_params[cc_par_cnt++] = "-mllvm";
+ cc_params[cc_par_cnt++] = alloc_printf("-erase-functions=%s/funcsToErase.txt", workspace);
+ }
cc_params[cc_par_cnt++] = "-Xclang";
cc_params[cc_par_cnt++] = "-load";
cc_params[cc_par_cnt++] = "-Xclang";
cc_params[cc_par_cnt++] = alloc_printf("%s/aflgo-pass.so", obj_path);
+
#endif /* ^USE_TRACE_PC */
cc_params[cc_par_cnt++] = "-Qunused-arguments";