Comments (5)
Hi,
I see the problem. Please apply the following patch to disable these options while compiling *.s files
diff --git a/llvm_mode/afl-clang-fast.c b/llvm_mode/afl-clang-fast.c
index 9fd8ea4..d35800a 100644
--- a/llvm_mode/afl-clang-fast.c
+++ b/llvm_mode/afl-clang-fast.c
@@ -99,6 +99,15 @@ static void edit_params(u32 argc, char** argv) {
u8 fortify_set = 0, asan_set = 0, x_set = 0, maybe_linking = 1, bit_mode = 0;
u8 *name;
+ u8 is_assembly_code=0;
+
+ for (int i =1; i < argc; i++) {
+ if (strstr(argv[i], ".s") || strstr(argv[i], ".S")) {
+ is_assembly_code = 1;
+ break;
+ }
+ }
+
cc_params = ck_alloc((argc + 128) * sizeof(u8*));
name = strrchr(argv[0], '/');
@@ -142,8 +151,14 @@ static void edit_params(u32 argc, char** argv) {
if (!strncmp(cur, "-distance", 9)
|| !strncmp(cur, "-targets", 8)
- || !strncmp(cur, "-outdir", 7))
- cc_params[cc_par_cnt++] = "-mllvm";
+ || !strncmp(cur, "-outdir", 7)) {
+ if(!is_assembly_code) {
+ cc_params[cc_par_cnt++] = "-mllvm";
+ } else {
+ continue;
+ }
+ }
+
if (!strcmp(cur, "-m32")) bit_mode = 32;
if (!strcmp(cur, "-m64")) bit_mode = 64;
Thuan
from aflgo.
Hi
This -target option only works with afl-clang-fast/afl-clang-fast++. It is not supported by normal clang. So please set CC and CXX environment variables to the afl-clang-fast and afl-clang-fast++ binaries inside your AFLGo build directory before compiling your subject programs.
You may need to move -target=/path to CFLAGS and/or CXXFLAGS as well. Please check our tutorial for libxml2 for more information.
Regards,
Thuan
from aflgo.
Yes, I have set CC and CXX as the tutorial .
But when compiling openssl, there is a moment executing a sentence as
"clang -Xclang -load -Xclang afl-llvm-pass.so -mllvm -targets /path/ -mllvm -outdir /path/ ... -c aes-x86_64.s -o aes-x86_64.o",
the clang won't load the afl-llvm-pass.so when compiling the *.s file, so that it outputs
"clang-6.0: error: unknown argument: '-target=/path".
How could I deal with this problem?
Thank you very much!
from aflgo.
Thanks for your patch.
I apply this patch and the compile is successful!
But after the compiling, the Ftargets.txt is just empty!
The process is as following:
- git clone https://github.com/openssl/openssl.git
- git checkcout OpenSSL_1_0_1f
- set the BBtargets.txt is
t1_lib.c:2586
s3_pkt.c:1092
s3_both.c:457
s3_srvr.c:941
s3_srvr.c:357
these information comes from https://github.com/google/fuzzer-test-suite/blob/master/openssl-1.0.1f/README.md - export AFLGO SUBJECT TMP_DIR CC CXX CFLAGS CXXFLAGS
e.g. the CFLAGS is "-targets=/path/BBtargets.txt -outdir=/path -flto -fuse-ld=gold -Wl,-plugin-opt=save-temps " - make clean && make
After these operations, the compile is successful and get the BBcalls.txt BBnames.txt BBtargets.txt dot-files Fnames.txt.
But the output of Ftargets.txt is empty, which impedes the subsequent distance calculation.
I am very sorry to disturb you, can you give me some advise? Thank you!
from aflgo.
Hi,
Your BBtargets file looks short. In our experiment, we used the following information to extract BBtargets automatically (refer to Step 5 of the tutorial)
Introducing commit: https://git.openssl.org/gitweb/?p=openssl.git&a=commit&h=4817504d069b4c5082161b02a22116ad75f822b1
Fixing commit: https://github.com/openssl/openssl/commit/96db9023b881d7cd9f379b0c154650d6c108e9a3
See: https://www.quora.com/Which-OpenSSL-commit-introduced-the-Heartbleed-vulnerability
Moreover, we used the test driver following this blog post: https://blog.hboeck.de/archives/868-How-Heartbleed-couldve-been-found.html
You can also take a look at #11
from aflgo.
Related Issues (20)
- typo of AFLGO_PROFILER_FILE HOT 1
- Incorrect method of merge call graph HOT 2
- Some incorrect lines caused the script gen_distance_fast.py to abort.
- Can't build libxml2 HOT 1
- Function distance calculation differs from paper HOT 3
- Can afl-llvm-pass.so.cc:366 solve the same name issue of basic block? HOT 2
- Build sqlite by afl-clang-fast HOT 1
- Cannot observe the crash in simple C program HOT 1
- Build libxml2: C compiler cannot create executables
- cannot access 'TMP_DIR/dot-files': No such file or directory HOT 4
- How to direct to code in a shared library HOT 1
- Erros when generating distance file HOT 5
- Distance calculation optimization in distance.py
- Details about AFLGo for patch testing
- Troubles Encountered in Distance Calculation HOT 3
- Link DG with AFLGo HOT 12
- gen_distance_fast.py: error: Couldn't find any binaries in folder /home/chen/aflgo/libxml2. HOT 1
- the
- The same name for BasicBlock
- error about argument '-targets'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aflgo.