[PATCH] D16824: [cfi] Safe handling of unaddressable vtable pointers (compiler-rt).
Evgeniy Stepanov via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 3 12:24:04 PST 2016
eugenis added inline comments.
================
Comment at: test/cfi/cross-dso/target_out_of_bounds.cpp:41
@@ +40,3 @@
+ for (uintptr_t *q = (uintptr_t *)p; q < (uintptr_t *)(p + sizeof(A)); ++q)
+ *q = v;
+ // CHECK-ZERO: runtime error: control flow integrity check for type 'A' failed during cast
----------------
pcc wrote:
> Why not just `memset(p, 0, sizeof(A));`?
Because that would test a different thing.
================
Comment at: test/cfi/cross-dso/target_out_of_bounds.cpp:51-55
@@ +50,7 @@
+ // typeinfo pointer.
+ void *empty = calloc(1, 128);
+ memset(empty, 0xFE, 128);
+ uintptr_t v = (uintptr_t)empty + 64;
+ for (uintptr_t *q = (uintptr_t *)p; q < (uintptr_t *)(p + sizeof(A)); ++q)
+ *q = v;
+ // CHECK-TYPEINFO: runtime error: control flow integrity check for type 'A' failed during cast
----------------
pcc wrote:
> Likewise `memset(p, 0xFE, sizeof(A));`
That, again, would be quite different.
This code is testing an invalid TypeInfo pointer, not an invalid vptr.
Repository:
rL LLVM
http://reviews.llvm.org/D16824
More information about the llvm-commits
mailing list