[llvm] 71be1c1 - [dfsan] Fix getShadowAddress computation (#162864)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 29 14:38:45 PDT 2025
Author: anoopkg6
Date: 2025-10-29T14:38:41-07:00
New Revision: 71be1c10ffb60b92edce8d20d5354f14a53c5506
URL: https://github.com/llvm/llvm-project/commit/71be1c10ffb60b92edce8d20d5354f14a53c5506
DIFF: https://github.com/llvm/llvm-project/commit/71be1c10ffb60b92edce8d20d5354f14a53c5506.diff
LOG: [dfsan] Fix getShadowAddress computation (#162864)
Fix getShadowAddress computation by adding ShadowBase if it is not zero.
Co-authored-by: anoopkg6 <anoopkg6 at github.com>
Added:
Modified:
llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
index 5ba2167859490..cc53ec2c0f2f3 100644
--- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -1957,8 +1957,12 @@ Value *DataFlowSanitizer::getShadowAddress(Value *Addr,
Value *DataFlowSanitizer::getShadowAddress(Value *Addr,
BasicBlock::iterator Pos) {
IRBuilder<> IRB(Pos->getParent(), Pos);
- Value *ShadowOffset = getShadowOffset(Addr, IRB);
- return getShadowAddress(Addr, Pos, ShadowOffset);
+ Value *ShadowAddr = getShadowOffset(Addr, IRB);
+ uint64_t ShadowBase = MapParams->ShadowBase;
+ if (ShadowBase != 0)
+ ShadowAddr =
+ IRB.CreateAdd(ShadowAddr, ConstantInt::get(IntptrTy, ShadowBase));
+ return getShadowAddress(Addr, Pos, ShadowAddr);
}
Value *DFSanFunction::combineShadowsThenConvert(Type *T, Value *V1, Value *V2,
More information about the llvm-commits
mailing list