diff options
author | Filipe Cabecinhas <me@filcab.net> | 2018-01-02 13:21:50 +0000 |
---|---|---|
committer | Filipe Cabecinhas <me@filcab.net> | 2018-01-02 13:21:50 +0000 |
commit | 016860cf2fa92698088a13d60259102546c7be29 (patch) | |
tree | 178c05b73db053560bc4b68ed6914123778dfc07 /clang/lib/CodeGen/ItaniumCXXABI.cpp | |
parent | 39f50e103b9bc282dee2195e303a51d6676c6c2d (diff) | |
download | bcm5719-llvm-016860cf2fa92698088a13d60259102546c7be29.tar.gz bcm5719-llvm-016860cf2fa92698088a13d60259102546c7be29.zip |
ASan+operator new[]: Fix operator new[] cookie poisoning
Summary:
The C++ Itanium ABI says:
No cookie is required if the new operator being used is ::operator new[](size_t, void*).
We should only avoid poisoning the cookie if we're calling this
operator, not others. This is dealt with before the call to
InitializeArrayCookie.
Reviewers: rjmccall, kcc, rsmith
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D41301
llvm-svn: 321645
Diffstat (limited to 'clang/lib/CodeGen/ItaniumCXXABI.cpp')
-rw-r--r-- | clang/lib/CodeGen/ItaniumCXXABI.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp index c375b82ea93..bfb18aee2e6 100644 --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -1847,8 +1847,7 @@ Address ItaniumCXXABI::InitializeArrayCookie(CodeGenFunction &CGF, llvm::Instruction *SI = CGF.Builder.CreateStore(NumElements, NumElementsPtr); // Handle the array cookie specially in ASan. - if (CGM.getLangOpts().Sanitize.has(SanitizerKind::Address) && AS == 0 && - expr->getOperatorNew()->isReplaceableGlobalAllocationFunction()) { + if (CGM.getLangOpts().Sanitize.has(SanitizerKind::Address) && AS == 0) { // The store to the CookiePtr does not need to be instrumented. CGM.getSanitizerMetadata()->disableSanitizerForInstruction(SI); llvm::FunctionType *FTy = |