diff options
author | van Hauser <vh@thc.org> | 2019-10-26 17:31:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-26 17:31:01 +0200 |
commit | 8e41a59e2e00447a97208ed7cf0d163a3d47066b (patch) | |
tree | 0091c64da66fe6238af9963f2626db578bff30bd /llvm_mode/afl-llvm-pass.so.cc | |
parent | 17729ce856058845314d1a3cb08e7a28d943db29 (diff) | |
parent | 15c920a6126e3a0b5ac5a7293188c3d7a523bbde (diff) | |
download | afl++-8e41a59e2e00447a97208ed7cf0d163a3d47066b.tar.gz |
Merge pull request #87 from devnexen/gcc_llvm_plugins_little_cjg
Little compiler plugins rework regarding block location picked up.
Diffstat (limited to 'llvm_mode/afl-llvm-pass.so.cc')
-rw-r--r-- | llvm_mode/afl-llvm-pass.so.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm_mode/afl-llvm-pass.so.cc b/llvm_mode/afl-llvm-pass.so.cc index 475a3f33..e094a0b2 100644 --- a/llvm_mode/afl-llvm-pass.so.cc +++ b/llvm_mode/afl-llvm-pass.so.cc @@ -34,6 +34,7 @@ #include <list> #include <string> #include <fstream> +#include <sys/time.h> #include "llvm/IR/DebugInfo.h" #include "llvm/IR/BasicBlock.h" @@ -95,8 +96,16 @@ bool AFLCoverage::runOnModule(Module &M) { IntegerType *Int8Ty = IntegerType::getInt8Ty(C); IntegerType *Int32Ty = IntegerType::getInt32Ty(C); + struct timeval tv; + struct timezone tz; + u32 rand_seed; unsigned int cur_loc = 0; + /* Setup random() so we get Actually Random(TM) outputs from AFL_R() */ + gettimeofday(&tv, &tz); + rand_seed = tv.tv_sec ^ tv.tv_usec ^ getpid(); + AFL_SR(rand_seed); + /* Show a banner */ char be_quiet = 0; |