[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 14:13:26 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:
> eugenis wrote:
> > pcc wrote:
> > > Why not just `memset(p, 0, sizeof(A));`?
> > Because that would test a different thing.
> > 
> Okay, I see. Please give the variables better names to make this code less confusing. Same for the other block. Please also change the loops to just an assignment of the vtable pointer.
done

================
Comment at: test/cfi/target_uninstrumented.cpp:34
@@ +33,3 @@
+  // CHECK: runtime error: control flow integrity check for type 'A' failed during cast to unrelated type
+  // CHECK: invalid vtable in module {{.*}}target_uninstrumented
+  A *a = (A *)p;
----------------
pcc wrote:
> Shouldn't you check specifically that the name matches the DSO name? Maybe have your test output to `%T/target-uninstrumented.so` and have this match against that?
I've made the check a bit stricter. I don't think there is any benefit in making it stricter than that, and it could make the test fragile.


Repository:
  rL LLVM

http://reviews.llvm.org/D16824





More information about the llvm-commits mailing list