mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-16 03:48:08 +00:00
fix LTO mode
This commit is contained in:
3
TODO.md
3
TODO.md
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
## Roadmap 2.65+
|
## Roadmap 2.65+
|
||||||
|
|
||||||
- AFL_MAP_SIZE for afl-llvm-pass, qemu_mode and unicorn_mode
|
- InsTrim mode for LTO solution
|
||||||
|
- AFL_MAP_SIZE for qemu_mode and unicorn_mode
|
||||||
- random crc32 HASH_CONST per run? because with 65536 paths we have collisions
|
- random crc32 HASH_CONST per run? because with 65536 paths we have collisions
|
||||||
- namespace for targets? e.g. network
|
- namespace for targets? e.g. network
|
||||||
- libradamsa as a custom module?
|
- libradamsa as a custom module?
|
||||||
|
@ -690,8 +690,7 @@ bool AFLLTOPass::runOnModule(Module &M) {
|
|||||||
if (map_addr) {
|
if (map_addr) {
|
||||||
|
|
||||||
GlobalVariable *AFLMapAddrFixed = new GlobalVariable(
|
GlobalVariable *AFLMapAddrFixed = new GlobalVariable(
|
||||||
M, Int64Ty, true, GlobalValue::ExternalLinkage, 0, "__afl_map_addr",
|
M, Int64Ty, true, GlobalValue::ExternalLinkage, 0, "__afl_map_addr");
|
||||||
0, GlobalVariable::GeneralDynamicTLSModel, 0, false);
|
|
||||||
ConstantInt *MapAddr = ConstantInt::get(Int64Ty, map_addr);
|
ConstantInt *MapAddr = ConstantInt::get(Int64Ty, map_addr);
|
||||||
StoreInst * StoreMapAddr = IRB.CreateStore(MapAddr, AFLMapAddrFixed);
|
StoreInst * StoreMapAddr = IRB.CreateStore(MapAddr, AFLMapAddrFixed);
|
||||||
StoreMapAddr->setMetadata(M.getMDKindID("nosanitize"),
|
StoreMapAddr->setMetadata(M.getMDKindID("nosanitize"),
|
||||||
@ -706,8 +705,7 @@ bool AFLLTOPass::runOnModule(Module &M) {
|
|||||||
if (afl_global_id % 8) write_loc = (((afl_global_id + 8) >> 3) << 3);
|
if (afl_global_id % 8) write_loc = (((afl_global_id + 8) >> 3) << 3);
|
||||||
|
|
||||||
GlobalVariable *AFLFinalLoc = new GlobalVariable(
|
GlobalVariable *AFLFinalLoc = new GlobalVariable(
|
||||||
M, Int32Ty, true, GlobalValue::ExternalLinkage, 0, "__afl_final_loc",
|
M, Int32Ty, true, GlobalValue::ExternalLinkage, 0, "__afl_final_loc");
|
||||||
0, GlobalVariable::GeneralDynamicTLSModel, 0, false);
|
|
||||||
ConstantInt *const_loc = ConstantInt::get(Int32Ty, write_loc);
|
ConstantInt *const_loc = ConstantInt::get(Int32Ty, write_loc);
|
||||||
StoreInst * StoreFinalLoc = IRB.CreateStore(const_loc, AFLFinalLoc);
|
StoreInst * StoreFinalLoc = IRB.CreateStore(const_loc, AFLFinalLoc);
|
||||||
StoreFinalLoc->setMetadata(M.getMDKindID("nosanitize"),
|
StoreFinalLoc->setMetadata(M.getMDKindID("nosanitize"),
|
||||||
@ -756,10 +754,9 @@ bool AFLLTOPass::runOnModule(Module &M) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalVariable *AFLDictionaryLen = new GlobalVariable(
|
GlobalVariable *AFLDictionaryLen =
|
||||||
M, Int32Ty, false, GlobalValue::ExternalLinkage, 0,
|
new GlobalVariable(M, Int32Ty, false, GlobalValue::ExternalLinkage,
|
||||||
"__afl_dictionary_len", 0, GlobalVariable::GeneralDynamicTLSModel,
|
0, "__afl_dictionary_len");
|
||||||
0, false);
|
|
||||||
ConstantInt *const_len = ConstantInt::get(Int32Ty, offset);
|
ConstantInt *const_len = ConstantInt::get(Int32Ty, offset);
|
||||||
StoreInst *StoreDictLen = IRB.CreateStore(const_len, AFLDictionaryLen);
|
StoreInst *StoreDictLen = IRB.CreateStore(const_len, AFLDictionaryLen);
|
||||||
StoreDictLen->setMetadata(M.getMDKindID("nosanitize"),
|
StoreDictLen->setMetadata(M.getMDKindID("nosanitize"),
|
||||||
@ -770,8 +767,7 @@ bool AFLLTOPass::runOnModule(Module &M) {
|
|||||||
M, ArrayTy, true, GlobalValue::ExternalLinkage,
|
M, ArrayTy, true, GlobalValue::ExternalLinkage,
|
||||||
ConstantDataArray::get(C,
|
ConstantDataArray::get(C,
|
||||||
*(new ArrayRef<char>((char *)ptr, offset))),
|
*(new ArrayRef<char>((char *)ptr, offset))),
|
||||||
"__afl_internal_dictionary", 0,
|
"__afl_internal_dictionary");
|
||||||
GlobalVariable::GeneralDynamicTLSModel, 0, false);
|
|
||||||
AFLInternalDictionary->setInitializer(ConstantDataArray::get(
|
AFLInternalDictionary->setInitializer(ConstantDataArray::get(
|
||||||
C, *(new ArrayRef<char>((char *)ptr, offset))));
|
C, *(new ArrayRef<char>((char *)ptr, offset))));
|
||||||
AFLInternalDictionary->setConstant(true);
|
AFLInternalDictionary->setConstant(true);
|
||||||
|
@ -583,8 +583,7 @@ bool AFLCoverage::runOnModule(Module &M) {
|
|||||||
|
|
||||||
GlobalVariable *AFLFinalLoc = new GlobalVariable(
|
GlobalVariable *AFLFinalLoc = new GlobalVariable(
|
||||||
M, Int32Ty, true, GlobalValue::ExternalLinkage, 0,
|
M, Int32Ty, true, GlobalValue::ExternalLinkage, 0,
|
||||||
"__afl_final_loc", 0, GlobalVariable::GeneralDynamicTLSModel, 0,
|
"__afl_final_loc");
|
||||||
false);
|
|
||||||
ConstantInt *const_loc = ConstantInt::get(Int32Ty, map_size);
|
ConstantInt *const_loc = ConstantInt::get(Int32Ty, map_size);
|
||||||
StoreInst * StoreFinalLoc = IRB.CreateStore(const_loc, AFLFinalLoc);
|
StoreInst * StoreFinalLoc = IRB.CreateStore(const_loc, AFLFinalLoc);
|
||||||
StoreFinalLoc->setMetadata(M.getMDKindID("nosanitize"),
|
StoreFinalLoc->setMetadata(M.getMDKindID("nosanitize"),
|
||||||
|
Reference in New Issue
Block a user