[PATCH] D62794: [HWASAN] Make new/delete weak
Eugene Leviant via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 4 02:17:04 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362478: [HWASAN] Make new/delete weak (authored by evgeny777, committed by ).
Herald added a subscriber: delcypher.
Herald added a project: LLVM.
Changed prior to commit:
https://reviews.llvm.org/D62794?vs=202609&id=202877#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62794/new/
https://reviews.llvm.org/D62794
Files:
compiler-rt/trunk/lib/hwasan/hwasan_new_delete.cpp
compiler-rt/trunk/test/hwasan/TestCases/override-new-delete.cpp
Index: compiler-rt/trunk/lib/hwasan/hwasan_new_delete.cpp
===================================================================
--- compiler-rt/trunk/lib/hwasan/hwasan_new_delete.cpp
+++ compiler-rt/trunk/lib/hwasan/hwasan_new_delete.cpp
@@ -35,15 +35,15 @@
if (!nothrow && UNLIKELY(!res)) ReportOutOfMemory(size, &stack);\
return res
-INTERCEPTOR_ATTRIBUTE
+INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
void *operator new(size_t size) { OPERATOR_NEW_BODY(false /*nothrow*/); }
-INTERCEPTOR_ATTRIBUTE
+INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
void *operator new[](size_t size) { OPERATOR_NEW_BODY(false /*nothrow*/); }
-INTERCEPTOR_ATTRIBUTE
+INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
void *operator new(size_t size, std::nothrow_t const&) {
OPERATOR_NEW_BODY(true /*nothrow*/);
}
-INTERCEPTOR_ATTRIBUTE
+INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
void *operator new[](size_t size, std::nothrow_t const&) {
OPERATOR_NEW_BODY(true /*nothrow*/);
}
@@ -52,13 +52,13 @@
GET_MALLOC_STACK_TRACE; \
if (ptr) hwasan_free(ptr, &stack)
-INTERCEPTOR_ATTRIBUTE
+INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
void operator delete(void *ptr) NOEXCEPT { OPERATOR_DELETE_BODY; }
-INTERCEPTOR_ATTRIBUTE
+INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
void operator delete[](void *ptr) NOEXCEPT { OPERATOR_DELETE_BODY; }
-INTERCEPTOR_ATTRIBUTE
+INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
void operator delete(void *ptr, std::nothrow_t const&) { OPERATOR_DELETE_BODY; }
-INTERCEPTOR_ATTRIBUTE
+INTERCEPTOR_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
void operator delete[](void *ptr, std::nothrow_t const&) {
OPERATOR_DELETE_BODY;
}
Index: compiler-rt/trunk/test/hwasan/TestCases/override-new-delete.cpp
===================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/override-new-delete.cpp
+++ compiler-rt/trunk/test/hwasan/TestCases/override-new-delete.cpp
@@ -0,0 +1,23 @@
+// RUN: %clangxx_hwasan %s
+#include <stddef.h>
+#include <new>
+
+char *__dummy;
+
+void *operator new(size_t size) { return __dummy; }
+void *operator new[](size_t size) { return __dummy; }
+void *operator new(size_t size, std::nothrow_t const&) noexcept {
+ return __dummy;
+}
+void *operator new[](size_t size, std::nothrow_t const&) noexcept {
+ return __dummy;
+}
+
+void operator delete(void *ptr) noexcept {}
+void operator delete[](void *ptr) noexcept {}
+void operator delete(void *ptr, std::nothrow_t const&) noexcept {}
+void operator delete[](void *ptr, std::nothrow_t const&) noexcept {}
+
+int main() {
+ return 0;
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62794.202877.patch
Type: text/x-patch
Size: 2596 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190604/2fdd2aee/attachment.bin>
More information about the llvm-commits
mailing list