Git Product home page Git Product logo

Comments (5)

thuanpv avatar thuanpv commented on August 27, 2024 1

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.

thuanpv avatar thuanpv commented on August 27, 2024

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.

Mambaboy avatar Mambaboy commented on August 27, 2024

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.

Mambaboy avatar Mambaboy commented on August 27, 2024

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:

  1. git clone https://github.com/openssl/openssl.git
  2. git checkcout OpenSSL_1_0_1f
  3. 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
  4. 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 "
  5. 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.

thuanpv avatar thuanpv commented on August 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.