aboutsummaryrefslogtreecommitdiff
path: root/instrumentation
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2021-01-04 23:13:56 +0100
committervan Hauser <vh@thc.org>2021-01-04 23:13:56 +0100
commit6c095b3937565e0e3c645cab706269e8c764701e (patch)
tree9601020625edc4c311e4fa1656651cdb74f767a5 /instrumentation
parentd367b033a206187b9342c8003512512f62ff99b0 (diff)
downloadAFLplusplus-6c095b3937565e0e3c645cab706269e8c764701e.tar.gz
code format
Diffstat (limited to 'instrumentation')
-rw-r--r--instrumentation/afl-compiler-rt.o.c19
-rw-r--r--instrumentation/afl-llvm-lto-instrumentation.so.cc6
-rw-r--r--instrumentation/cmplog-instructions-pass.cc14
-rw-r--r--instrumentation/compare-transform-pass.so.cc21
4 files changed, 36 insertions, 24 deletions
diff --git a/instrumentation/afl-compiler-rt.o.c b/instrumentation/afl-compiler-rt.o.c
index 0b6c6e47..fdfc8d58 100644
--- a/instrumentation/afl-compiler-rt.o.c
+++ b/instrumentation/afl-compiler-rt.o.c
@@ -691,17 +691,26 @@ static void __afl_start_forkserver(void) {
void (*old_sigchld_handler)(int) = 0; // = signal(SIGCHLD, SIG_DFL);
- if (__afl_map_size <= FS_OPT_MAX_MAPSIZE)
+ if (__afl_map_size <= FS_OPT_MAX_MAPSIZE) {
+
status_for_fsrv |= (FS_OPT_SET_MAPSIZE(__afl_map_size) | FS_OPT_MAPSIZE);
- if (__afl_dictionary_len && __afl_dictionary) status_for_fsrv |= FS_OPT_AUTODICT;
- if (__afl_sharedmem_fuzzing != 0) status_for_fsrv |= FS_OPT_SHDMEM_FUZZ;
- if (status_for_fsrv) status_for_fsrv |= (FS_OPT_ENABLED);
+
+ }
+
+ if (__afl_dictionary_len && __afl_dictionary) {
+
+ status_for_fsrv |= FS_OPT_AUTODICT;
+
+ }
+
+ if (__afl_sharedmem_fuzzing != 0) { status_for_fsrv |= FS_OPT_SHDMEM_FUZZ; }
+ if (status_for_fsrv) { status_for_fsrv |= (FS_OPT_ENABLED); }
memcpy(tmp, &status_for_fsrv, 4);
/* Phone home and tell the parent that we're OK. If parent isn't there,
assume we're not running in forkserver mode and just execute program. */
- if (write(FORKSRV_FD + 1, tmp, 4) != 4) return;
+ if (write(FORKSRV_FD + 1, tmp, 4) != 4) { return; }
if (__afl_sharedmem_fuzzing || (__afl_dictionary_len && __afl_dictionary)) {
diff --git a/instrumentation/afl-llvm-lto-instrumentation.so.cc b/instrumentation/afl-llvm-lto-instrumentation.so.cc
index 89d49936..9cacacf9 100644
--- a/instrumentation/afl-llvm-lto-instrumentation.so.cc
+++ b/instrumentation/afl-llvm-lto-instrumentation.so.cc
@@ -100,9 +100,9 @@ class AFLLTOPass : public ModulePass {
bool AFLLTOPass::runOnModule(Module &M) {
- LLVMContext & C = M.getContext();
- std::vector<std::string> dictionary;
-// std::vector<CallInst *> calls;
+ LLVMContext & C = M.getContext();
+ std::vector<std::string> dictionary;
+ // std::vector<CallInst *> calls;
DenseMap<Value *, std::string *> valueMap;
std::vector<BasicBlock *> BlockList;
char * ptr;
diff --git a/instrumentation/cmplog-instructions-pass.cc b/instrumentation/cmplog-instructions-pass.cc
index 154bec2b..3499ccf0 100644
--- a/instrumentation/cmplog-instructions-pass.cc
+++ b/instrumentation/cmplog-instructions-pass.cc
@@ -234,9 +234,9 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
auto ty0 = op0->getType();
if (ty0->isHalfTy()
#if LLVM_VERSION_MAJOR >= 11
- || ty0->isBFloatTy()
+ || ty0->isBFloatTy()
#endif
- )
+ )
max_size = 16;
else if (ty0->isFloatTy())
max_size = 32;
@@ -253,15 +253,15 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
if (intTyOp0 && intTyOp1) {
max_size = intTyOp0->getBitWidth() > intTyOp1->getBitWidth()
- ? intTyOp0->getBitWidth()
- : intTyOp1->getBitWidth();
+ ? intTyOp0->getBitWidth()
+ : intTyOp1->getBitWidth();
args.push_back(V0);
args.push_back(V1);
-
+
} else {
-
+
max_size = 0;
-
+
}
}
diff --git a/instrumentation/compare-transform-pass.so.cc b/instrumentation/compare-transform-pass.so.cc
index 887970a0..da5cf7e9 100644
--- a/instrumentation/compare-transform-pass.so.cc
+++ b/instrumentation/compare-transform-pass.so.cc
@@ -68,7 +68,7 @@ class CompareTransform : public ModulePass {
const char *getPassName() const override {
#else
- StringRef getPassName() const override {
+ StringRef getPassName() const override {
#endif
return "transforms compare functions";
@@ -106,23 +106,26 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp,
FunctionCallee tolowerFn;
#endif
{
+
#if LLVM_VERSION_MAJOR < 9
- Constant *
+ Constant *
#else
- FunctionCallee
+ FunctionCallee
#endif
- c = M.getOrInsertFunction("tolower", Int32Ty, Int32Ty
+ c = M.getOrInsertFunction("tolower", Int32Ty, Int32Ty
#if LLVM_VERSION_MAJOR < 5
- ,
- NULL
+ ,
+ NULL
#endif
- );
+ );
#if LLVM_VERSION_MAJOR < 9
- tolowerFn = cast<Function>(c);
+ tolowerFn = cast<Function>(c);
#else
- tolowerFn = c;
+ tolowerFn = c;
#endif
+
}
+
/* iterate over all functions, bbs and instruction and add suitable calls to
* strcmp/memcmp/strncmp/strcasecmp/strncasecmp */
for (auto &F : M) {