[PATCH] Add test suite for the Control Flow Integrity feature.

Peter Collingbourne peter at pcc.me.uk
Wed Feb 18 15:48:22 PST 2015


================
Comment at: test/cfi/anon-namespace.cpp:4
@@ +3,3 @@
+// RUN: %clang_cfi -o %t %t1.o %t2.o
+// RUN: not --crash %t
+
----------------
kcc wrote:
> Hm... I would actually like to have a way to validate that we have an expected crash, not some unrelated crash (e.g. due to miscompile). 
> The simplest way is to add two printfs, one before and one after the vcall, and check that only the first one is there
Done

================
Comment at: test/cfi/anon-namespace.cpp:6
@@ +5,3 @@
+
+// FIXME: This test should not require that the paths supplied to the compiler
+// are different.
----------------
kcc wrote:
> Why does it require that now? Is that an LTO limitation? 
Added a comment explaining.

================
Comment at: test/cfi/overwrite.cpp:2
@@ +1,3 @@
+// RUN: %clang_cfi -o %t %s
+// RUN: not --crash %t
+
----------------
kcc wrote:
> I would like to run this test with and w/o CFI, so that w/o CFI we actually see foo() called. 
Done

================
Comment at: test/cfi/simple-fail.cpp:2
@@ +1,3 @@
+// RUN: %clang_cfi -o %t %s
+// RUN: not --crash %t
+
----------------
kcc wrote:
> Same here and for all other --crash tests: I would like to also run these tests w/o CFI to see that they "work". 
> I't ok that the test has undefined behavior according to the standard. We are testing the expected behavior of the particular compiler. 
Done

================
Comment at: test/cfi/simple-pass.cpp:50
@@ +49,3 @@
+  A *a = new A;
+  a->f();
+  a = new A2;
----------------
kcc wrote:
> we need to ensure that the calls are not devirtualized. 
> e.g. check break_optimization in test/asan/TestCases/Linux/sized_delete_test.cc
Done

http://reviews.llvm.org/D7738

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list