diff options
author | Florian Hahn <flo@fhahn.com> | 2024-06-27 15:08:19 +0100 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2024-06-27 15:18:01 +0100 |
commit | b1465a7248e5957694195d557d9af74eb588e739 (patch) | |
tree | 750e6bedffe243b23a5652a943e8a9bfe3f40866 | |
parent | 84f29fb9a0a626cb2a1f8b619a1f798a7b8c8ea6 (diff) | |
download | llvm-users/fhahn/tysan-a-type-sanitizer-llvm.zip llvm-users/fhahn/tysan-a-type-sanitizer-llvm.tar.gz llvm-users/fhahn/tysan-a-type-sanitizer-llvm.tar.bz2 |
!fiupx address comments, thanks!users/fhahn/tysan-a-type-sanitizer-llvm
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/TypeSanitizer.cpp | 22 | ||||
-rw-r--r-- | llvm/test/Instrumentation/TypeSanitizer/access-with-offset.ll (renamed from llvm/test/Instrumentation/TypeSanitizer/access-with-offfset.ll) | 0 |
2 files changed, 10 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/TypeSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/TypeSanitizer.cpp index 2ca9b8a8..f1fa19e 100644 --- a/llvm/lib/Transforms/Instrumentation/TypeSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/TypeSanitizer.cpp @@ -143,9 +143,9 @@ void TypeSanitizer::initializeCallbacks(Module &M) { TysanCheck = cast<Function>( M.getOrInsertFunction(kTysanCheckName, Attr, IRB.getVoidTy(), IRB.getPtrTy(), // Pointer to data to be read. - OrdTy, // Size of the data in bytes. + OrdTy, // Size of the data in bytes. IRB.getPtrTy(), // Pointer to type descriptor. - OrdTy // Flags. + OrdTy // Flags. ) .getCallee()); @@ -637,8 +637,7 @@ bool TypeSanitizer::instrumentWithShadowUpdate( Constant *Flags = ConstantInt::get(OrdTy, (int)IsRead | (((int)IsWrite) << 1)); - Value *LoadedTD = - IRB.CreateLoad(IRB.getPtrTy(), ShadowData, "shadow.desc"); + Value *LoadedTD = IRB.CreateLoad(IRB.getPtrTy(), ShadowData, "shadow.desc"); if (SanitizeFunction) { Value *BadTDCmp = IRB.CreateICmpNE(LoadedTD, TD, "bad.desc"); Instruction *BadTDTerm, *GoodTDTerm; @@ -673,16 +672,16 @@ bool TypeSanitizer::instrumentWithShadowUpdate( Instruction *BadUTDTerm = SplitBlockAndInsertIfThen( NotAllUnkTD, BeforeSetType, false, UnlikelyBW); IRB.SetInsertPoint(BadUTDTerm); - IRB.CreateCall(TysanCheck, {IRB.CreateBitCast(Ptr, IRB.getPtrTy()), - Size, (Value *)TD, (Value *)Flags}); + IRB.CreateCall(TysanCheck, {IRB.CreateBitCast(Ptr, IRB.getPtrTy()), Size, + (Value *)TD, (Value *)Flags}); IRB.SetInsertPoint(BeforeSetType); SetType(); // We have a non-trivial mismatch. Call the runtime. IRB.SetInsertPoint(MismatchTerm); - IRB.CreateCall(TysanCheck, {IRB.CreateBitCast(Ptr, IRB.getPtrTy()), - Size, (Value *)TD, (Value *)Flags}); + IRB.CreateCall(TysanCheck, {IRB.CreateBitCast(Ptr, IRB.getPtrTy()), Size, + (Value *)TD, (Value *)Flags}); // We appear to have the right type. Make sure that all other bytes in // the type are still marked as interior bytes. If not, call the runtime. @@ -703,8 +702,8 @@ bool TypeSanitizer::instrumentWithShadowUpdate( Instruction *BadITDTerm = SplitBlockAndInsertIfThen( NotAllBadTD, &*IRB.GetInsertPoint(), false, UnlikelyBW); IRB.SetInsertPoint(BadITDTerm); - IRB.CreateCall(TysanCheck, {IRB.CreateBitCast(Ptr, IRB.getPtrTy()), - Size, (Value *)TD, (Value *)Flags}); + IRB.CreateCall(TysanCheck, {IRB.CreateBitCast(Ptr, IRB.getPtrTy()), Size, + (Value *)TD, (Value *)Flags}); } else { // If we're not sanitizing this function, then we only care whether we // need to *set* the type. @@ -843,8 +842,7 @@ bool TypeSanitizer::instrumentMemInst(Value *V, Value *&ShadowBase, IRB.CreateAnd(IRB.CreatePtrToInt(Src, IntptrTy), AppMemMask), PtrShift), ShadowBase); - Value *SrcShadowData = - IRB.CreateIntToPtr(SrcShadowDataInt, IRB.getPtrTy()); + Value *SrcShadowData = IRB.CreateIntToPtr(SrcShadowDataInt, IRB.getPtrTy()); if (NeedsMemMove) { IRB.CreateMemMove(ShadowData, Align(1u << PtrShift), SrcShadowData, diff --git a/llvm/test/Instrumentation/TypeSanitizer/access-with-offfset.ll b/llvm/test/Instrumentation/TypeSanitizer/access-with-offset.ll index 297ee83..297ee83 100644 --- a/llvm/test/Instrumentation/TypeSanitizer/access-with-offfset.ll +++ b/llvm/test/Instrumentation/TypeSanitizer/access-with-offset.ll |