about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2021-03-04 11:00:54 +0100
committerAndrea Fioraldi <andreafioraldi@gmail.com>2021-03-04 11:00:54 +0100
commit0e736276e6421162da0070e98d17d25b9a679de0 (patch)
tree75601c459064e2a26a5d148fb3f3f0cb76f497ae
parent08ef8d6b787f1a04b5ec3644d7ecae41d2668193 (diff)
downloadafl++-0e736276e6421162da0070e98d17d25b9a679de0.tar.gz
restore correct CTX behaviour in llvm mode
-rw-r--r--instrumentation/afl-llvm-pass.so.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/instrumentation/afl-llvm-pass.so.cc b/instrumentation/afl-llvm-pass.so.cc
index 16fd9c94..87267e35 100644
--- a/instrumentation/afl-llvm-pass.so.cc
+++ b/instrumentation/afl-llvm-pass.so.cc
@@ -354,7 +354,8 @@ bool AFLCoverage::runOnModule(Module &M) {
         // if yes we store a context ID for this function in the global var
         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);
           StoreCtx->setMetadata(M.getMDKindID("nosanitize"),
                                 MDNode::get(C, None));