[PATCH] D12335: Repress sanitization on User dtor.
Naomi Musgrave via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 28 11:35:30 PDT 2015
nmusgrave updated this revision to Diff 33446.
nmusgrave marked an inline comment as done.
nmusgrave added a comment.
- Simplified sanitization macro.
http://reviews.llvm.org/D12335
Files:
include/llvm/IR/Metadata.h
include/llvm/IR/User.h
include/llvm/Support/Compiler.h
lib/IR/User.cpp
Index: lib/IR/User.cpp
===================================================================
--- lib/IR/User.cpp
+++ lib/IR/User.cpp
@@ -118,7 +118,7 @@
// User operator delete Implementation
//===----------------------------------------------------------------------===//
-void User::operator delete(void *Usr) {
+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: 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,9 @@
void growHungoffUses(unsigned N, bool IsPhi = false);
public:
- ~User() override {
- }
+ // Repress memory sanitization, due to use-after-destroy by operator
+ // delete. Bug report 24578 identifies this issue.
+ ~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.
Index: include/llvm/IR/Metadata.h
===================================================================
--- include/llvm/IR/Metadata.h
+++ include/llvm/IR/Metadata.h
@@ -766,7 +766,7 @@
MDNode(LLVMContext &Context, unsigned ID, StorageType Storage,
ArrayRef<Metadata *> Ops1, ArrayRef<Metadata *> Ops2 = None);
- ~MDNode() = default;
+ LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE ~MDNode() = default;
void dropAllReferences();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12335.33446.patch
Type: text/x-patch
Size: 2218 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150828/259f1a48/attachment.bin>
More information about the llvm-commits
mailing list