code format

This commit is contained in:
Andrea Fioraldi
2020-02-16 13:21:39 +01:00
parent 8acd503526
commit ef00ed6090
7 changed files with 50 additions and 73 deletions

View File

@ -26,7 +26,7 @@
/* Version string: */ /* Version string: */
// c = release, d = volatile github dev, e = experimental branch // c = release, d = volatile github dev, e = experimental branch
#define VERSION "++2.60d" #define VERSION "++2.60d"
/****************************************************** /******************************************************

View File

@ -482,19 +482,10 @@ struct InsTrim : public ModulePass {
char modeline[100]; char modeline[100];
snprintf(modeline, sizeof(modeline), "%s%s%s%s", snprintf(modeline, sizeof(modeline), "%s%s%s%s",
getenv("AFL_HARDEN") getenv("AFL_HARDEN") ? "hardened" : "non-hardened",
? "hardened" getenv("AFL_USE_ASAN") ? ", ASAN" : "",
: "non-hardened", getenv("AFL_USE_MSAN") ? ", MSAN" : "",
getenv("AFL_USE_ASAN") getenv("AFL_USE_UBSAN") ? ", UBSAN" : "");
? ", ASAN"
: "",
getenv("AFL_USE_MSAN")
? ", MSAN"
: "",
getenv("AFL_USE_UBSAN")
? ", UBSAN"
: ""
);
OKF("Instrumented %u locations (%llu, %llu) (%s mode)\n", total_instr, OKF("Instrumented %u locations (%llu, %llu) (%s mode)\n", total_instr,
total_rs, total_hs, modeline); total_rs, total_hs, modeline);

View File

@ -468,24 +468,16 @@ bool AFLCoverage::runOnModule(Module &M) {
if (!inst_blocks) if (!inst_blocks)
WARNF("No instrumentation targets found."); WARNF("No instrumentation targets found.");
else { else {
char modeline[100]; char modeline[100];
snprintf(modeline, sizeof(modeline), "%s%s%s%s", snprintf(modeline, sizeof(modeline), "%s%s%s%s",
getenv("AFL_HARDEN") getenv("AFL_HARDEN") ? "hardened" : "non-hardened",
? "hardened" getenv("AFL_USE_ASAN") ? ", ASAN" : "",
: "non-hardened", getenv("AFL_USE_MSAN") ? ", MSAN" : "",
getenv("AFL_USE_ASAN") getenv("AFL_USE_UBSAN") ? ", UBSAN" : "");
? ", ASAN"
: "",
getenv("AFL_USE_MSAN")
? ", MSAN"
: "",
getenv("AFL_USE_UBSAN")
? ", UBSAN"
: ""
);
OKF("Instrumented %u locations (%s mode, ratio %u%%).", inst_blocks, OKF("Instrumented %u locations (%s mode, ratio %u%%).", inst_blocks,
modeline, modeline, inst_ratio);
inst_ratio);
} }
} }

View File

@ -41,7 +41,6 @@
#define _DEFAULT_MO MO_32 #define _DEFAULT_MO MO_32
#endif #endif
void HELPER(afl_compcov_16)(target_ulong cur_loc, target_ulong arg1, void HELPER(afl_compcov_16)(target_ulong cur_loc, target_ulong arg1,
target_ulong arg2) { target_ulong arg2) {
@ -293,7 +292,8 @@ static void gpr_saving(TCGv *cpu_regs, int regs_num) {
afl_gen_tcg_plain_call(&afl_persistent_loop); afl_gen_tcg_plain_call(&afl_persistent_loop);
if (afl_persistent_hook_ptr) afl_gen_tcg_plain_call(callback_to_persistent_hook); if (afl_persistent_hook_ptr)
afl_gen_tcg_plain_call(callback_to_persistent_hook);
// restore GPR registers // restore GPR registers
for (i = 0; i < regs_num; ++i) { for (i = 0; i < regs_num; ++i) {
@ -340,7 +340,8 @@ static void restore_state_for_persistent(TCGv *cpu_regs, int regs_num, int sp) {
if (afl_persistent_ret_addr == 0) { \ if (afl_persistent_ret_addr == 0) { \
\ \
TCGv paddr = tcg_const_tl(afl_persistent_addr); \ TCGv paddr = tcg_const_tl(afl_persistent_addr); \
tcg_gen_qemu_st_tl(paddr, cpu_regs[R_ESP], persisent_retaddr_offset, _DEFAULT_MO); \ tcg_gen_qemu_st_tl(paddr, cpu_regs[R_ESP], persisent_retaddr_offset, \
_DEFAULT_MO); \
tcg_temp_free(paddr); \ tcg_temp_free(paddr); \
\ \
} \ } \

View File

@ -33,7 +33,7 @@
void afl_gen_tcg_plain_call(void *func) { void afl_gen_tcg_plain_call(void *func) {
TCGOp * op = tcg_emit_op(INDEX_op_call); TCGOp *op = tcg_emit_op(INDEX_op_call);
TCGOP_CALLO(op) = 0; TCGOP_CALLO(op) = 0;
@ -42,3 +42,4 @@ void afl_gen_tcg_plain_call(void *func) {
TCGOP_CALLI(op) = 0; TCGOP_CALLI(op) = 0;
} }

View File

@ -479,27 +479,19 @@ static void add_instrumentation(void) {
WARNF("No instrumentation targets found%s.", WARNF("No instrumentation targets found%s.",
pass_thru ? " (pass-thru mode)" : ""); pass_thru ? " (pass-thru mode)" : "");
else { else {
char modeline[100]; char modeline[100];
snprintf(modeline, sizeof(modeline), "%s%s%s%s", snprintf(modeline, sizeof(modeline), "%s%s%s%s",
getenv("AFL_HARDEN") getenv("AFL_HARDEN") ? "hardened" : "non-hardened",
? "hardened" getenv("AFL_USE_ASAN") ? ", ASAN" : "",
: "non-hardened", getenv("AFL_USE_MSAN") ? ", MSAN" : "",
getenv("AFL_USE_ASAN") getenv("AFL_USE_UBSAN") ? ", UBSAN" : "");
? ", ASAN"
: "",
getenv("AFL_USE_MSAN")
? ", MSAN"
: "",
getenv("AFL_USE_UBSAN")
? ", UBSAN"
: ""
);
OKF("Instrumented %u locations (%s-bit, %s mode, ratio %u%%).", ins_lines, OKF("Instrumented %u locations (%s-bit, %s mode, ratio %u%%).", ins_lines,
use_64bit ? "64" : "32", use_64bit ? "64" : "32", modeline, inst_ratio);
modeline,
inst_ratio);
} }
} }
} }