[PATCH] D12335: Repress sanitization on User dtor.
Naomi Musgrave via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 28 14:03:07 PDT 2015
nmusgrave updated this revision to Diff 33462.
nmusgrave marked 2 inline comments as done.
nmusgrave added a comment.
- Moved attribute for repressing msan to operator delete, update comments.
http://reviews.llvm.org/D12335
Files:
include/llvm/IR/User.h
include/llvm/Support/Compiler.h
lib/IR/Metadata.cpp
lib/IR/User.cpp
Index: lib/IR/User.cpp
===================================================================
--- lib/IR/User.cpp
+++ lib/IR/User.cpp
@@ -118,7 +118,9 @@
// User operator delete Implementation
//===----------------------------------------------------------------------===//
-void User::operator delete(void *Usr) {
+// Repress memory sanitization, due to use-after-destroy by operator
+// delete. Bug report 24578 identifies this issue.
+LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE void User::operator delete(void *Usr) {
// Hung off uses use a single Use* before the User, while other subclasses
// use a Use[] allocated prior to the user.
User *Obj = static_cast<User *>(Usr);
Index: lib/IR/Metadata.cpp
===================================================================
--- lib/IR/Metadata.cpp
+++ lib/IR/Metadata.cpp
@@ -401,7 +401,9 @@
return Ptr;
}
-void MDNode::operator delete(void *Mem) {
+// Repress memory sanitization, due to use-after-destroy by operator
+// delete. Bug report 24578 identifies this issue.
+LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE void MDNode::operator delete(void *Mem) {
MDNode *N = static_cast<MDNode *>(Mem);
size_t OpSize = N->NumOperands * sizeof(MDOperand);
OpSize = RoundUpToAlignment(OpSize, llvm::alignOf<uint64_t>());
Index: include/llvm/Support/Compiler.h
===================================================================
--- include/llvm/Support/Compiler.h
+++ include/llvm/Support/Compiler.h
@@ -323,10 +323,12 @@
#if __has_feature(memory_sanitizer)
# define LLVM_MEMORY_SANITIZER_BUILD 1
# include <sanitizer/msan_interface.h>
+# define LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE __attribute__((no_sanitize_memory))
#else
# define LLVM_MEMORY_SANITIZER_BUILD 0
# define __msan_allocated_memory(p, size)
# define __msan_unpoison(p, size)
+# define LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE
#endif
/// \macro LLVM_ADDRESS_SANITIZER_BUILD
Index: include/llvm/IR/User.h
===================================================================
--- include/llvm/IR/User.h
+++ include/llvm/IR/User.h
@@ -72,8 +72,7 @@
void growHungoffUses(unsigned N, bool IsPhi = false);
public:
- ~User() override {
- }
+ ~User() override {}
/// \brief Free memory allocated for User and Use objects.
void operator delete(void *Usr);
/// \brief Placement delete - required by std, but never called.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12335.33462.patch
Type: text/x-patch
Size: 2365 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150828/3f84e6b0/attachment.bin>
More information about the llvm-commits
mailing list