mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-15 19:38:09 +00:00
nits and code format
This commit is contained in:
@ -216,7 +216,7 @@ static gboolean instrument_coverage_find_low(const GumRangeDetails *details,
|
|||||||
static GumAddress last_limit = (64ULL << 10);
|
static GumAddress last_limit = (64ULL << 10);
|
||||||
gpointer * address = (gpointer *)user_data;
|
gpointer * address = (gpointer *)user_data;
|
||||||
|
|
||||||
last_limit = GUM_ALIGN_SIZE (last_limit, __afl_map_size);
|
last_limit = GUM_ALIGN_SIZE(last_limit, __afl_map_size);
|
||||||
|
|
||||||
if ((details->range->base_address - last_limit) > __afl_map_size) {
|
if ((details->range->base_address - last_limit) > __afl_map_size) {
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ inline void discover_word(u8 *ret, u32 *current, u32 *virgin) {
|
|||||||
that have not been already cleared from the virgin map - since this will
|
that have not been already cleared from the virgin map - since this will
|
||||||
almost always be the case. */
|
almost always be the case. */
|
||||||
|
|
||||||
if (*current & *virgin) {
|
if (unlikely(*current & *virgin)) {
|
||||||
|
|
||||||
if (likely(*ret < 2)) {
|
if (likely(*ret < 2)) {
|
||||||
|
|
||||||
@ -80,8 +80,8 @@ inline void discover_word(u8 *ret, u32 *current, u32 *virgin) {
|
|||||||
/* Looks like we have not found any new bytes yet; see if any non-zero
|
/* Looks like we have not found any new bytes yet; see if any non-zero
|
||||||
bytes in current[] are pristine in virgin[]. */
|
bytes in current[] are pristine in virgin[]. */
|
||||||
|
|
||||||
if ((cur[0] && vir[0] == 0xff) || (cur[1] && vir[1] == 0xff) ||
|
if (unlikely((cur[0] && vir[0] == 0xff) || (cur[1] && vir[1] == 0xff) ||
|
||||||
(cur[2] && vir[2] == 0xff) || (cur[3] && vir[3] == 0xff))
|
(cur[2] && vir[2] == 0xff) || (cur[3] && vir[3] == 0xff)))
|
||||||
*ret = 2;
|
*ret = 2;
|
||||||
else
|
else
|
||||||
*ret = 1;
|
*ret = 1;
|
||||||
@ -99,10 +99,10 @@ inline u32 skim(const u32 *virgin, const u32 *current, const u32 *current_end) {
|
|||||||
|
|
||||||
for (; current < current_end; virgin += 4, current += 4) {
|
for (; current < current_end; virgin += 4, current += 4) {
|
||||||
|
|
||||||
if (current[0] && classify_word(current[0]) & virgin[0]) return 1;
|
if (unlikely(current[0] && classify_word(current[0]) & virgin[0])) return 1;
|
||||||
if (current[1] && classify_word(current[1]) & virgin[1]) return 1;
|
if (unlikely(current[1] && classify_word(current[1]) & virgin[1])) return 1;
|
||||||
if (current[2] && classify_word(current[2]) & virgin[2]) return 1;
|
if (unlikely(current[2] && classify_word(current[2]) & virgin[2])) return 1;
|
||||||
if (current[3] && classify_word(current[3]) & virgin[3]) return 1;
|
if (unlikely(current[3] && classify_word(current[3]) & virgin[3])) return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,11 +116,12 @@ inline u32 skim(const u64 *virgin, const u64 *current, const u64 *current_end) {
|
|||||||
__mmask8 mask = _mm512_testn_epi64_mask(value, value);
|
__mmask8 mask = _mm512_testn_epi64_mask(value, value);
|
||||||
|
|
||||||
/* All bytes are zero. */
|
/* All bytes are zero. */
|
||||||
if (mask == 0xff) continue;
|
if (likely(mask == 0xff)) continue;
|
||||||
|
|
||||||
/* Look for nonzero bytes and check for new bits. */
|
/* Look for nonzero bytes and check for new bits. */
|
||||||
#define UNROLL(x) \
|
#define UNROLL(x) \
|
||||||
if (!(mask & (1 << x)) && classify_word(current[x]) & virgin[x]) return 1
|
if (unlikely(!(mask & (1 << x)) && classify_word(current[x]) & virgin[x])) \
|
||||||
|
return 1
|
||||||
UNROLL(0);
|
UNROLL(0);
|
||||||
UNROLL(1);
|
UNROLL(1);
|
||||||
UNROLL(2);
|
UNROLL(2);
|
||||||
@ -152,13 +153,17 @@ inline u32 skim(const u64 *virgin, const u64 *current, const u64 *current_end) {
|
|||||||
u32 mask = _mm256_movemask_epi8(cmp);
|
u32 mask = _mm256_movemask_epi8(cmp);
|
||||||
|
|
||||||
/* All bytes are zero. */
|
/* All bytes are zero. */
|
||||||
if (mask == (u32)-1) continue;
|
if (likely(mask == (u32)-1)) continue;
|
||||||
|
|
||||||
/* Look for nonzero bytes and check for new bits. */
|
/* Look for nonzero bytes and check for new bits. */
|
||||||
if (!(mask & 0xff) && classify_word(current[0]) & virgin[0]) return 1;
|
if (unlikely(!(mask & 0xff) && classify_word(current[0]) & virgin[0]))
|
||||||
if (!(mask & 0xff00) && classify_word(current[1]) & virgin[1]) return 1;
|
return 1;
|
||||||
if (!(mask & 0xff0000) && classify_word(current[2]) & virgin[2]) return 1;
|
if (unlikely(!(mask & 0xff00) && classify_word(current[1]) & virgin[1]))
|
||||||
if (!(mask & 0xff000000) && classify_word(current[3]) & virgin[3]) return 1;
|
return 1;
|
||||||
|
if (unlikely(!(mask & 0xff0000) && classify_word(current[2]) & virgin[2]))
|
||||||
|
return 1;
|
||||||
|
if (unlikely(!(mask & 0xff000000) && classify_word(current[3]) & virgin[3]))
|
||||||
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,10 +179,10 @@ inline u32 skim(const u64 *virgin, const u64 *current, const u64 *current_end) {
|
|||||||
|
|
||||||
for (; current < current_end; virgin += 4, current += 4) {
|
for (; current < current_end; virgin += 4, current += 4) {
|
||||||
|
|
||||||
if (current[0] && classify_word(current[0]) & virgin[0]) return 1;
|
if (unlikely(current[0] && classify_word(current[0]) & virgin[0])) return 1;
|
||||||
if (current[1] && classify_word(current[1]) & virgin[1]) return 1;
|
if (unlikely(current[1] && classify_word(current[1]) & virgin[1])) return 1;
|
||||||
if (current[2] && classify_word(current[2]) & virgin[2]) return 1;
|
if (unlikely(current[2] && classify_word(current[2]) & virgin[2])) return 1;
|
||||||
if (current[3] && classify_word(current[3]) & virgin[3]) return 1;
|
if (unlikely(current[3] && classify_word(current[3]) & virgin[3])) return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,17 +33,17 @@ typedef long double max_align_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LLVM_VERSION_MAJOR >= 11
|
#if LLVM_VERSION_MAJOR >= 11
|
||||||
#define MNAME M.getSourceFileName()
|
#define MNAME M.getSourceFileName()
|
||||||
#define FMNAME F.getParent()->getSourceFileName()
|
#define FMNAME F.getParent()->getSourceFileName()
|
||||||
#else
|
#else
|
||||||
#define MNAME std::string("")
|
#define MNAME std::string("")
|
||||||
#define FMNAME std::string("")
|
#define FMNAME std::string("")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char * getBBName(const llvm::BasicBlock *BB);
|
char *getBBName(const llvm::BasicBlock *BB);
|
||||||
bool isIgnoreFunction(const llvm::Function *F);
|
bool isIgnoreFunction(const llvm::Function *F);
|
||||||
void initInstrumentList();
|
void initInstrumentList();
|
||||||
bool isInInstrumentList(llvm::Function *F, std::string Filename);
|
bool isInInstrumentList(llvm::Function *F, std::string Filename);
|
||||||
unsigned long long int calculateCollisions(uint32_t edges);
|
unsigned long long int calculateCollisions(uint32_t edges);
|
||||||
void scanForDangerousFunctions(llvm::Module *M);
|
void scanForDangerousFunctions(llvm::Module *M);
|
||||||
|
|
||||||
|
@ -631,18 +631,23 @@ bool AFLCoverage::runOnModule(Module &M) {
|
|||||||
LoadInst *PrevLoc;
|
LoadInst *PrevLoc;
|
||||||
|
|
||||||
if (ngram_size) {
|
if (ngram_size) {
|
||||||
|
|
||||||
PrevLoc = IRB.CreateLoad(
|
PrevLoc = IRB.CreateLoad(
|
||||||
#if LLVM_VERSION_MAJOR >= 14
|
#if LLVM_VERSION_MAJOR >= 14
|
||||||
PrevLocTy,
|
PrevLocTy,
|
||||||
#endif
|
#endif
|
||||||
AFLPrevLoc);
|
AFLPrevLoc);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
PrevLoc = IRB.CreateLoad(
|
PrevLoc = IRB.CreateLoad(
|
||||||
#if LLVM_VERSION_MAJOR >= 14
|
#if LLVM_VERSION_MAJOR >= 14
|
||||||
IRB.getInt32Ty(),
|
IRB.getInt32Ty(),
|
||||||
#endif
|
#endif
|
||||||
AFLPrevLoc);
|
AFLPrevLoc);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PrevLoc->setMetadata(M.getMDKindID("nosanitize"), MDNode::get(C, None));
|
PrevLoc->setMetadata(M.getMDKindID("nosanitize"), MDNode::get(C, None));
|
||||||
Value *PrevLocTrans;
|
Value *PrevLocTrans;
|
||||||
|
|
||||||
|
@ -478,27 +478,28 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
|
|||||||
*/
|
*/
|
||||||
if (is_fp) {
|
if (is_fp) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ConstantFP *i0 = dyn_cast<ConstantFP>(op0);
|
ConstantFP *i0 = dyn_cast<ConstantFP>(op0);
|
||||||
ConstantFP *i1 = dyn_cast<ConstantFP>(op1);
|
ConstantFP *i1 = dyn_cast<ConstantFP>(op1);
|
||||||
// BUG FIXME TODO: this is null ... but why?
|
// BUG FIXME TODO: this is null ... but why?
|
||||||
// fprintf(stderr, "%p %p\n", i0, i1);
|
// fprintf(stderr, "%p %p\n", i0, i1);
|
||||||
if (i0) {
|
if (i0) {
|
||||||
|
|
||||||
cur_val = (uint64_t)i0->getValue().convertToDouble();
|
cur_val = (uint64_t)i0->getValue().convertToDouble();
|
||||||
if (last_val0 && last_val0 == cur_val) { skip = 1; }
|
if (last_val0 && last_val0 == cur_val) { skip = 1; }
|
||||||
last_val0 = cur_val;
|
last_val0 = cur_val;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i1) {
|
if (i1) {
|
||||||
|
|
||||||
cur_val = (uint64_t)i1->getValue().convertToDouble();
|
cur_val = (uint64_t)i1->getValue().convertToDouble();
|
||||||
if (last_val1 && last_val1 == cur_val) { skip = 1; }
|
if (last_val1 && last_val1 == cur_val) { skip = 1; }
|
||||||
last_val1 = cur_val;
|
last_val1 = cur_val;
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
*/
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -876,11 +876,12 @@ static void edit_params(u32 argc, char **argv, char **envp) {
|
|||||||
|
|
||||||
cc_params[cc_par_cnt++] = "-fsanitize=leak";
|
cc_params[cc_par_cnt++] = "-fsanitize=leak";
|
||||||
cc_params[cc_par_cnt++] = "-includesanitizer/lsan_interface.h";
|
cc_params[cc_par_cnt++] = "-includesanitizer/lsan_interface.h";
|
||||||
cc_params[cc_par_cnt++] = "-D__AFL_LEAK_CHECK()={if(__lsan_do_recoverable_leak_check() > 0) _exit(23); }";
|
cc_params[cc_par_cnt++] =
|
||||||
|
"-D__AFL_LEAK_CHECK()={if(__lsan_do_recoverable_leak_check() > 0) "
|
||||||
|
"_exit(23); }";
|
||||||
cc_params[cc_par_cnt++] = "-D__AFL_LSAN_OFF()=__lsan_disable();";
|
cc_params[cc_par_cnt++] = "-D__AFL_LSAN_OFF()=__lsan_disable();";
|
||||||
cc_params[cc_par_cnt++] = "-D__AFL_LSAN_ON()=__lsan_enable();";
|
cc_params[cc_par_cnt++] = "-D__AFL_LSAN_ON()=__lsan_enable();";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getenv("AFL_USE_CFISAN")) {
|
if (getenv("AFL_USE_CFISAN")) {
|
||||||
|
@ -769,11 +769,7 @@ void cull_queue(afl_state_t *afl) {
|
|||||||
afl->top_rated[i]->favored = 1;
|
afl->top_rated[i]->favored = 1;
|
||||||
++afl->queued_favored;
|
++afl->queued_favored;
|
||||||
|
|
||||||
if (!afl->top_rated[i]->was_fuzzed) {
|
if (!afl->top_rated[i]->was_fuzzed) { ++afl->pending_favored; }
|
||||||
|
|
||||||
++afl->pending_favored;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1321,8 +1321,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
|||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
if (afl->fsrv.nyx_mode) {
|
if (afl->fsrv.nyx_mode) {
|
||||||
|
|
||||||
if (afl->fsrv.nyx_standalone &&
|
if (afl->fsrv.nyx_standalone && strcmp(afl->sync_id, "default") != 0) {
|
||||||
strcmp(afl->sync_id, "default") != 0) {
|
|
||||||
|
|
||||||
FATAL(
|
FATAL(
|
||||||
"distributed fuzzing is not supported in this Nyx mode (use -Y "
|
"distributed fuzzing is not supported in this Nyx mode (use -Y "
|
||||||
|
Submodule unicorn_mode/unicornafl updated: 6c7392fb5a...9df92d6868
Reference in New Issue
Block a user