forked from AFLplusplus/AFLplusplus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
small improvements to Marcel's patch, fix laf-intel + redqueen crashes
- Loading branch information
1 parent
fe08482
commit 383cd48
Showing
12 changed files
with
104 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ sending a mail to <[email protected]>. | |
- all compilers combined to afl-cc which emulates the previous ones | ||
- afl-llvm/gcc-rt.o merged into afl-compiler-rt.o | ||
- afl-fuzz | ||
- Marcel Boehme submitted a patch that improves all AFFast schedules :) | ||
- reading testcases from -i now descends into subdirectories | ||
- allow up to 4 -x command line options | ||
- loaded extras now have a duplicate protection | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,7 +210,8 @@ bool CmpLogInstructions::hookInstrs(Module &M) { | |
} | ||
|
||
if (!icomps.size()) return false; | ||
if (!be_quiet) errs() << "Hooking " << icomps.size() << " cmp instructions\n"; | ||
// if (!be_quiet) errs() << "Hooking " << icomps.size() << " cmp | ||
// instructions\n"; | ||
|
||
for (auto &selectcmpInst : icomps) { | ||
|
||
|
@@ -259,8 +260,7 @@ bool CmpLogInstructions::hookInstrs(Module &M) { | |
bool CmpLogInstructions::runOnModule(Module &M) { | ||
|
||
if (getenv("AFL_QUIET") == NULL) | ||
llvm::errs() | ||
<< "Running cmplog-instructions-pass by [email protected]\n"; | ||
printf("Running cmplog-instructions-pass by [email protected]\n"); | ||
else | ||
be_quiet = 1; | ||
hookInstrs(M); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,9 +149,11 @@ bool CmpLogRoutines::hookRtns(Module &M) { | |
} | ||
|
||
if (!calls.size()) return false; | ||
if (!be_quiet) | ||
errs() << "Hooking " << calls.size() | ||
<< " calls with pointers as arguments\n"; | ||
/* | ||
if (!be_quiet) | ||
errs() << "Hooking " << calls.size() | ||
<< " calls with pointers as arguments\n"; | ||
*/ | ||
|
||
for (auto &callInst : calls) { | ||
|
||
|
@@ -179,8 +181,7 @@ bool CmpLogRoutines::hookRtns(Module &M) { | |
bool CmpLogRoutines::runOnModule(Module &M) { | ||
|
||
if (getenv("AFL_QUIET") == NULL) | ||
llvm::errs() | ||
<< "Running cmplog-routines-pass by [email protected]\n"; | ||
printf("Running cmplog-routines-pass by [email protected]\n"); | ||
else | ||
be_quiet = 1; | ||
hookRtns(M); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -339,8 +339,9 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp, | |
|
||
if (!calls.size()) return false; | ||
if (!be_quiet) | ||
errs() << "Replacing " << calls.size() | ||
<< " calls to strcmp/memcmp/strncmp/strcasecmp/strncasecmp\n"; | ||
printf( | ||
"Replacing %lu calls to strcmp/memcmp/strncmp/strcasecmp/strncasecmp\n", | ||
calls.size()); | ||
|
||
for (auto &callInst : calls) { | ||
|
||
|
@@ -426,11 +427,14 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp, | |
else | ||
unrollLen = constStrLen; | ||
|
||
if (!be_quiet) | ||
errs() << callInst->getCalledFunction()->getName() << ": unroll len " | ||
<< unrollLen | ||
<< ((isSizedcmp && !isConstSized) ? ", variable n" : "") << ": " | ||
<< ConstStr << "\n"; | ||
/* | ||
if (!be_quiet) | ||
errs() << callInst->getCalledFunction()->getName() << ": unroll len " | ||
<< unrollLen | ||
<< ((isSizedcmp && !isConstSized) ? ", variable n" : "") << ": | ||
" | ||
<< ConstStr << "\n"; | ||
*/ | ||
|
||
/* split before the call instruction */ | ||
BasicBlock *bb = callInst->getParent(); | ||
|
@@ -556,10 +560,12 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp, | |
bool CompareTransform::runOnModule(Module &M) { | ||
|
||
if ((isatty(2) && getenv("AFL_QUIET") == NULL) || getenv("AFL_DEBUG") != NULL) | ||
llvm::errs() << "Running compare-transform-pass by [email protected], " | ||
"extended by [email protected]\n"; | ||
printf( | ||
"Running compare-transform-pass by [email protected], extended by " | ||
"[email protected]\n"); | ||
else | ||
be_quiet = 1; | ||
|
||
transformCmps(M, true, true, true, true, true); | ||
verifyModule(M); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1262,8 +1262,9 @@ bool SplitComparesTransform::runOnModule(Module &M) { | |
if ((isatty(2) && getenv("AFL_QUIET") == NULL) || | ||
getenv("AFL_DEBUG") != NULL) { | ||
|
||
errs() << "Split-compare-pass by [email protected], extended by " | ||
"[email protected]\n"; | ||
printf( | ||
"Split-compare-pass by [email protected], extended by " | ||
"[email protected]\n"); | ||
|
||
} else { | ||
|
||
|
@@ -1275,13 +1276,15 @@ bool SplitComparesTransform::runOnModule(Module &M) { | |
|
||
count = splitFPCompares(M); | ||
|
||
if (!be_quiet) { | ||
/* | ||
if (!be_quiet) { | ||
errs() << "Split-floatingpoint-compare-pass: " << count | ||
<< " FP comparisons split\n"; | ||
errs() << "Split-floatingpoint-compare-pass: " << count | ||
<< " FP comparisons split\n"; | ||
} | ||
} | ||
*/ | ||
simplifyFPCompares(M); | ||
|
||
} | ||
|
@@ -1294,37 +1297,43 @@ bool SplitComparesTransform::runOnModule(Module &M) { | |
|
||
case 64: | ||
count = splitIntCompares(M, bitw); | ||
if (!be_quiet) | ||
errs() << "Split-integer-compare-pass " << bitw << "bit: " << count | ||
<< " split\n"; | ||
|
||
/* | ||
if (!be_quiet) | ||
errs() << "Split-integer-compare-pass " << bitw << "bit: " << | ||
count | ||
<< " split\n"; | ||
*/ | ||
bitw >>= 1; | ||
#if LLVM_VERSION_MAJOR > 3 || \ | ||
(LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 7) | ||
[[clang::fallthrough]]; /*FALLTHRU*/ /* FALLTHROUGH */ | ||
#endif | ||
case 32: | ||
count = splitIntCompares(M, bitw); | ||
if (!be_quiet) | ||
errs() << "Split-integer-compare-pass " << bitw << "bit: " << count | ||
<< " split\n"; | ||
|
||
/* | ||
if (!be_quiet) | ||
errs() << "Split-integer-compare-pass " << bitw << "bit: " << | ||
count | ||
<< " split\n"; | ||
*/ | ||
bitw >>= 1; | ||
#if LLVM_VERSION_MAJOR > 3 || \ | ||
(LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 7) | ||
[[clang::fallthrough]]; /*FALLTHRU*/ /* FALLTHROUGH */ | ||
#endif | ||
case 16: | ||
count = splitIntCompares(M, bitw); | ||
if (!be_quiet) | ||
errs() << "Split-integer-compare-pass " << bitw << "bit: " << count | ||
<< " split\n"; | ||
|
||
/* | ||
if (!be_quiet) | ||
errs() << "Split-integer-compare-pass " << bitw << "bit: " << | ||
count | ||
<< " split\n"; | ||
*/ | ||
bitw >>= 1; | ||
break; | ||
|
||
default: | ||
if (!be_quiet) errs() << "NOT Running split-compare-pass \n"; | ||
// if (!be_quiet) errs() << "NOT Running split-compare-pass \n"; | ||
return false; | ||
break; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -327,10 +327,11 @@ bool SplitSwitchesTransform::splitSwitches(Module &M) { | |
} | ||
|
||
if (!switches.size()) return false; | ||
if (!be_quiet) | ||
errs() << "Rewriting " << switches.size() << " switch statements " | ||
<< "\n"; | ||
|
||
/* | ||
if (!be_quiet) | ||
errs() << "Rewriting " << switches.size() << " switch statements " | ||
<< "\n"; | ||
*/ | ||
for (auto &SI : switches) { | ||
|
||
BasicBlock *CurBlock = SI->getParent(); | ||
|
@@ -341,15 +342,17 @@ bool SplitSwitchesTransform::splitSwitches(Module &M) { | |
BasicBlock *Default = SI->getDefaultDest(); | ||
unsigned bitw = Val->getType()->getIntegerBitWidth(); | ||
|
||
if (!be_quiet) | ||
errs() << "switch: " << SI->getNumCases() << " cases " << bitw | ||
<< " bit\n"; | ||
/* | ||
if (!be_quiet) | ||
errs() << "switch: " << SI->getNumCases() << " cases " << bitw | ||
<< " bit\n"; | ||
*/ | ||
|
||
/* If there is only the default destination or the condition checks 8 bit or | ||
* less, don't bother with the code below. */ | ||
if (!SI->getNumCases() || bitw <= 8) { | ||
|
||
if (!be_quiet) errs() << "skip trivial switch..\n"; | ||
// if (!be_quiet) errs() << "skip trivial switch..\n"; | ||
continue; | ||
|
||
} | ||
|
@@ -415,7 +418,7 @@ bool SplitSwitchesTransform::splitSwitches(Module &M) { | |
bool SplitSwitchesTransform::runOnModule(Module &M) { | ||
|
||
if ((isatty(2) && getenv("AFL_QUIET") == NULL) || getenv("AFL_DEBUG") != NULL) | ||
llvm::errs() << "Running split-switches-pass by [email protected]\n"; | ||
printf("Running split-switches-pass by [email protected]\n"); | ||
else | ||
be_quiet = 1; | ||
splitSwitches(M); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.