mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-18 04:38:08 +00:00
fix output for LTOinstrim
This commit is contained in:
@ -110,8 +110,9 @@ struct InsTrimLTO : public ModulePass {
|
|||||||
|
|
||||||
bool runOnModule(Module &M) override {
|
bool runOnModule(Module &M) override {
|
||||||
|
|
||||||
char be_quiet = 0;
|
char be_quiet = 0;
|
||||||
char *ptr;
|
char * ptr;
|
||||||
|
uint32_t locations = 0, functions = 0;
|
||||||
|
|
||||||
setvbuf(stdout, NULL, _IONBF, 0);
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
|
|
||||||
@ -563,6 +564,8 @@ struct InsTrimLTO : public ModulePass {
|
|||||||
if (F.size() < function_minimum_size) continue;
|
if (F.size() < function_minimum_size) continue;
|
||||||
if (isBlacklisted(&F)) continue;
|
if (isBlacklisted(&F)) continue;
|
||||||
|
|
||||||
|
functions++;
|
||||||
|
|
||||||
// whitelist check
|
// whitelist check
|
||||||
AttributeList Attrs = F.getAttributes();
|
AttributeList Attrs = F.getAttributes();
|
||||||
if (Attrs.hasAttribute(-1, StringRef("skipinstrument"))) {
|
if (Attrs.hasAttribute(-1, StringRef("skipinstrument"))) {
|
||||||
@ -659,6 +662,7 @@ struct InsTrimLTO : public ModulePass {
|
|||||||
if (PI == PE) {
|
if (PI == PE) {
|
||||||
|
|
||||||
L = ConstantInt::get(Int32Ty, afl_global_id++);
|
L = ConstantInt::get(Int32Ty, afl_global_id++);
|
||||||
|
locations++;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -670,6 +674,7 @@ struct InsTrimLTO : public ModulePass {
|
|||||||
auto It = PredMap.insert({PBB, afl_global_id++});
|
auto It = PredMap.insert({PBB, afl_global_id++});
|
||||||
unsigned Label = It.first->second;
|
unsigned Label = It.first->second;
|
||||||
PN->addIncoming(ConstantInt::get(Int32Ty, Label), PBB);
|
PN->addIncoming(ConstantInt::get(Int32Ty, Label), PBB);
|
||||||
|
locations++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -887,7 +892,7 @@ struct InsTrimLTO : public ModulePass {
|
|||||||
for (BasicBlock *Succ : successors(Pred))
|
for (BasicBlock *Succ : successors(Pred))
|
||||||
if (Succ != NULL) count++;
|
if (Succ != NULL) count++;
|
||||||
|
|
||||||
if (count > 1) return true;
|
if (count > 1) would_instrument = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -912,11 +917,12 @@ struct InsTrimLTO : public ModulePass {
|
|||||||
getenv("AFL_USE_MSAN") ? ", MSAN" : "",
|
getenv("AFL_USE_MSAN") ? ", MSAN" : "",
|
||||||
getenv("AFL_USE_CFISAN") ? ", CFISAN" : "",
|
getenv("AFL_USE_CFISAN") ? ", CFISAN" : "",
|
||||||
getenv("AFL_USE_UBSAN") ? ", UBSAN" : "");
|
getenv("AFL_USE_UBSAN") ? ", UBSAN" : "");
|
||||||
OKF("Instrumented %u locations (%llu, %llu) with no collisions (on "
|
OKF("Instrumented %u locations for %u edges in %u functions (%llu, "
|
||||||
|
"%llu) with no collisions (on "
|
||||||
"average %llu collisions would be in afl-gcc/afl-clang-fast for %u "
|
"average %llu collisions would be in afl-gcc/afl-clang-fast for %u "
|
||||||
"edges) (%s mode).",
|
"edges) (%s mode).",
|
||||||
inst_blocks, total_rs, total_hs, calculateCollisions(edges), edges,
|
inst_blocks, locations, functions, total_rs, total_hs,
|
||||||
modeline);
|
calculateCollisions(edges), edges, modeline);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,8 +240,10 @@ u8 *afl_shm_init(sharedmem_t *shm, size_t map_size,
|
|||||||
IPC_CREAT | IPC_EXCL | 0600);
|
IPC_CREAT | IPC_EXCL | 0600);
|
||||||
|
|
||||||
if (shm->cmplog_shm_id < 0) {
|
if (shm->cmplog_shm_id < 0) {
|
||||||
shmctl(shm->shm_id, IPC_RMID, NULL); // do not leak shmem
|
|
||||||
|
shmctl(shm->shm_id, IPC_RMID, NULL); // do not leak shmem
|
||||||
PFATAL("shmget() failed");
|
PFATAL("shmget() failed");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -270,11 +272,16 @@ u8 *afl_shm_init(sharedmem_t *shm, size_t map_size,
|
|||||||
shm->map = shmat(shm->shm_id, NULL, 0);
|
shm->map = shmat(shm->shm_id, NULL, 0);
|
||||||
|
|
||||||
if (shm->map == (void *)-1 || !shm->map) {
|
if (shm->map == (void *)-1 || !shm->map) {
|
||||||
shmctl(shm->shm_id, IPC_RMID, NULL); // do not leak shmem
|
|
||||||
|
shmctl(shm->shm_id, IPC_RMID, NULL); // do not leak shmem
|
||||||
if (shm->cmplog_mode) {
|
if (shm->cmplog_mode) {
|
||||||
shmctl(shm->cmplog_shm_id, IPC_RMID, NULL); // do not leak shmem
|
|
||||||
|
shmctl(shm->cmplog_shm_id, IPC_RMID, NULL); // do not leak shmem
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PFATAL("shmat() failed");
|
PFATAL("shmat() failed");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shm->cmplog_mode) {
|
if (shm->cmplog_mode) {
|
||||||
@ -283,10 +290,13 @@ u8 *afl_shm_init(sharedmem_t *shm, size_t map_size,
|
|||||||
|
|
||||||
if (shm->cmp_map == (void *)-1 || !shm->cmp_map) {
|
if (shm->cmp_map == (void *)-1 || !shm->cmp_map) {
|
||||||
|
|
||||||
shmctl(shm->shm_id, IPC_RMID, NULL); // do not leak shmem
|
shmctl(shm->shm_id, IPC_RMID, NULL); // do not leak shmem
|
||||||
if (shm->cmplog_mode) {
|
if (shm->cmplog_mode) {
|
||||||
shmctl(shm->cmplog_shm_id, IPC_RMID, NULL); // do not leak shmem
|
|
||||||
|
shmctl(shm->cmplog_shm_id, IPC_RMID, NULL); // do not leak shmem
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PFATAL("shmat() failed");
|
PFATAL("shmat() failed");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user