[PATCH] D81238: Correctly report modified status for HWAddressSanitizer
serge via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 11 01:14:59 PDT 2020
serge-sans-paille updated this revision to Diff 270049.
serge-sans-paille added a comment.
Take review into account.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81238/new/
https://reviews.llvm.org/D81238
Files:
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
Index: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -238,7 +238,7 @@
Value *getUARTag(IRBuilder<> &IRB, Value *StackTag);
Value *getHwasanThreadSlotPtr(IRBuilder<> &IRB, Type *Ty);
- void emitPrologue(IRBuilder<> &IRB, bool WithFrameRecord);
+ bool emitPrologue(IRBuilder<> &IRB, bool WithFrameRecord);
void instrumentGlobal(GlobalVariable *GV, uint8_t Tag);
void instrumentGlobals();
@@ -913,15 +913,15 @@
return nullptr;
}
-void HWAddressSanitizer::emitPrologue(IRBuilder<> &IRB, bool WithFrameRecord) {
+bool HWAddressSanitizer::emitPrologue(IRBuilder<> &IRB, bool WithFrameRecord) {
if (!Mapping.InTls) {
LocalDynamicShadow = getDynamicShadowNonTls(IRB);
- return;
+ return LocalDynamicShadow != nullptr;
}
if (!WithFrameRecord && TargetTriple.isAndroid()) {
LocalDynamicShadow = getDynamicShadowIfunc(IRB);
- return;
+ return LocalDynamicShadow != nullptr;
}
Value *SlotPtr = getHwasanThreadSlotPtr(IRB, IntptrTy);
@@ -987,6 +987,8 @@
ConstantInt::get(IntptrTy, (1ULL << kShadowBaseAlignment) - 1)),
ConstantInt::get(IntptrTy, 1), "hwasan.shadow");
LocalDynamicShadow = IRB.CreateIntToPtr(LocalDynamicShadow, Int8PtrTy);
+
+ return true;
}
Value *HWAddressSanitizer::readRegister(IRBuilder<> &IRB, StringRef Name) {
@@ -1121,36 +1123,38 @@
initializeCallbacks(*F.getParent());
- if (!LandingPadVec.empty())
- instrumentLandingPads(LandingPadVec);
+ bool Changed = false;
+
+ if (!LandingPadVec.empty()) {
+ Changed |= instrumentLandingPads(LandingPadVec);
+ }
if (AllocasToInstrument.empty() && F.hasPersonalityFn() &&
F.getPersonalityFn()->getName() == kHwasanPersonalityThunkName) {
// __hwasan_personality_thunk is a no-op for functions without an
// instrumented stack, so we can drop it.
F.setPersonalityFn(nullptr);
+ Changed = true;
}
if (AllocasToInstrument.empty() && OperandsToInstrument.empty() &&
IntrinToInstrument.empty())
- return false;
+ return Changed;
assert(!LocalDynamicShadow);
Instruction *InsertPt = &*F.getEntryBlock().begin();
IRBuilder<> EntryIRB(InsertPt);
- emitPrologue(EntryIRB,
+ Changed |= emitPrologue(EntryIRB,
/*WithFrameRecord*/ ClRecordStackHistory &&
!AllocasToInstrument.empty());
- bool Changed = false;
if (!AllocasToInstrument.empty()) {
Value *StackTag =
ClGenerateTagsWithCalls ? nullptr : getStackBaseTag(EntryIRB);
Changed |= instrumentStack(AllocasToInstrument, AllocaDbgMap, RetVec,
StackTag);
}
-
// Pad and align each of the allocas that we instrumented to stop small
// uninteresting allocas from hiding in instrumented alloca's padding and so
// that we have enough space to store real tags for short granules.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81238.270049.patch
Type: text/x-patch
Size: 3059 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200611/d6ad7e7d/attachment-0001.bin>
More information about the llvm-commits
mailing list