restore correct CTX behaviour in llvm mode

This commit is contained in:
Andrea Fioraldi 2021-03-04 11:00:54 +01:00
parent 08ef8d6b78
commit 0e736276e6

View File

@ -354,7 +354,8 @@ bool AFLCoverage::runOnModule(Module &M) {
// if yes we store a context ID for this function in the global var // if yes we store a context ID for this function in the global var
if (has_calls) { if (has_calls) {
ConstantInt *NewCtx = ConstantInt::get(Int32Ty, AFL_R(map_size)); Value *NewCtx = IRB.CreateXor(
PrevCtx, ConstantInt::get(Int32Ty, AFL_R(map_size)));
StoreInst * StoreCtx = IRB.CreateStore(NewCtx, AFLContext); StoreInst * StoreCtx = IRB.CreateStore(NewCtx, AFLContext);
StoreCtx->setMetadata(M.getMDKindID("nosanitize"), StoreCtx->setMetadata(M.getMDKindID("nosanitize"),
MDNode::get(C, None)); MDNode::get(C, None));