diff options
author | Kostya Serebryany <kcc@google.com> | 2014-08-26 02:29:59 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2014-08-26 02:29:59 +0000 |
commit | 4ee6904288f1fde659fa00952ec0778bcca5e2b4 (patch) | |
tree | 9459f63b23ad880c6f8682cd0235dffdba2929b6 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | b06f77b608a449ad7342977085dbab8c8e124b40 (diff) | |
download | llvm-4ee6904288f1fde659fa00952ec0778bcca5e2b4.zip llvm-4ee6904288f1fde659fa00952ec0778bcca5e2b4.tar.gz llvm-4ee6904288f1fde659fa00952ec0778bcca5e2b4.tar.bz2 |
[clang/asan] call __asan_poison_cxx_array_cookie after operator new[]
Summary:
PR19838
When operator new[] is called and an array cookie is created
we want asan to detect buffer overflow bugs that touch the cookie.
For that we need to
a) poison the shadow for the array cookie (call __asan_poison_cxx_array_cookie).
b) ignore the legal accesses to the cookie generated by clang (add 'nosanitize' metadata)
Reviewers: timurrrr, samsonov, rsmith
Reviewed By: rsmith
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4774
llvm-svn: 216434
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 16e20b1..d18cbc9 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -1683,11 +1683,8 @@ void CodeGenFunction::InsertHelper(llvm::Instruction *I, llvm::BasicBlock *BB, llvm::BasicBlock::iterator InsertPt) const { LoopStack.InsertHelper(I); - if (IsSanitizerScope) { - I->setMetadata( - CGM.getModule().getMDKindID("nosanitize"), - llvm::MDNode::get(CGM.getLLVMContext(), ArrayRef<llvm::Value *>())); - } + if (IsSanitizerScope) + CGM.getSanitizerMetadata()->disableSanitizerForInstruction(I); } template <bool PreserveNames> |