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

Kostya Serebryany kcc at google.com
Wed Feb 18 15:00:38 PST 2015


Lovely!

+samsonov for cmake code. 
Questions:

  can we make these tests run with -O0 and -O2 w/o adding extra RUN lines? 
  what will happen with the tests if LTO is not supported?


================
Comment at: test/cfi/anon-namespace.cpp:4
@@ +3,3 @@
+// RUN: %clang_cfi -o %t %t1.o %t2.o
+// RUN: not --crash %t
+
----------------
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

================
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.
----------------
Why does it require that now? Is that an LTO limitation? 

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

================
Comment at: test/cfi/simple-fail.cpp:2
@@ +1,3 @@
+// RUN: %clang_cfi -o %t %s
+// RUN: not --crash %t
+
----------------
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. 

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

http://reviews.llvm.org/D7738

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






More information about the llvm-commits mailing list