[PATCH] D12713: Explicit reference to issue.
Naomi Musgrave via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 16:24:06 PDT 2015
nmusgrave created this revision.
nmusgrave added reviewers: eugenis, kcc.
nmusgrave added a subscriber: llvm-commits.
Runtime testing for vtable ptr poisoning in dtor.
http://reviews.llvm.org/D12713
Files:
test/msan/dtor-trivial.cpp
test/msan/dtor-vtable.cc
Index: test/msan/dtor-vtable.cc
===================================================================
--- test/msan/dtor-vtable.cc
+++ test/msan/dtor-vtable.cc
@@ -4,36 +4,24 @@
// RUN: %clangxx_msan %s -O2 -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && MSAN_OPTIONS=poison_in_dtor=1 %run %t >%t.out 2>&1
-// TODO Success pending on resolution of 596
+// Expected to quit due to invalid access when invoking
+// function using vtable.
// XFAIL: *
-#include <assert.h>
#include <sanitizer/msan_interface.h>
-template <class T> class Vector {
- public:
- int size;
- ~Vector() {}
-};
-
-struct NonTrivial {
- int a;
- Vector<int> v;
-};
-
-struct Trivial {
- int a;
- int b;
+class A {
+public:
+ int x;
+ virtual ~A() {}
+ virtual void A_Foo() {}
};
int main() {
- NonTrivial *nt = new NonTrivial();
- nt->~NonTrivial();
- assert(__msan_test_shadow(nt, sizeof(*nt)) != -1);
-
- Trivial *t = new Trivial();
- t->~Trivial();
- assert(__msan_test_shadow(t, sizeof(*t)) != -1);
-
+ // Get pointer to virtual function in base class
+ A *a = new A();
+ a->~A();
+ // Shouldn't be allowed to invoke function via vtable.
+ a->A_Foo();
return 0;
}
Index: test/msan/dtor-trivial.cpp
===================================================================
--- test/msan/dtor-trivial.cpp
+++ test/msan/dtor-trivial.cpp
@@ -4,7 +4,9 @@
// RUN: %clangxx_msan %s -O2 -fsanitize=memory -fsanitize-memory-use-after-dtor -o %t && MSAN_OPTIONS=poison_in_dtor=1 %run %t >%t.out 2>&1
-// TODO Success pending on resolution of 596
+// TODO Success pending on resolution of
+// https://github.com/google/sanitizers/issues/596
+
// XFAIL: *
#include <assert.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12713.34278.patch
Type: text/x-patch
Size: 1691 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150908/a36a5bdb/attachment.bin>
More information about the llvm-commits
mailing list