Remove unreliable CFI test.

Remove tests of implementation details rather than the CFI
functionality itself. In particular, CFI is designed to protect against
invalid calls to executable code, whereas heap memory is covered by page
protection.

Bug: http://b/298741930
Test: treehugger
Change-Id: Ib7f8af283b4c0001da8fa80a1b281bdc4c50af51
diff --git a/tests/cfi_test.cpp b/tests/cfi_test.cpp
index 1c45946..4b061b3 100644
--- a/tests/cfi_test.cpp
+++ b/tests/cfi_test.cpp
@@ -70,21 +70,8 @@
   struct sigaction64 previous_sigtrap_;
 };
 
-static bool KilledByCfi(int status) {
-  return WIFSIGNALED(status) &&
-         (WTERMSIG(status) == SIGTRAP || WTERMSIG(status) == SIGILL || WTERMSIG(status) == SIGSEGV);
-}
-
 static void f() {}
 
-static void test_cfi_slowpath_with_alloc() {
-  std::vector<void*> allocs;
-  for (size_t i = 0; i < 1000; i++) {
-    allocs.push_back(malloc(4096));
-    __cfi_slowpath(46, allocs.back());
-  }
-}
-
 TEST_F(cfi_test_DeathTest, basic) {
 #if defined(__BIONIC__)
   void* handle;
@@ -135,12 +122,6 @@
   EXPECT_EQ(get_global_address(), get_last_address());
   EXPECT_EQ(c, get_count());
 
-  // CFI check for a heap address.
-  // It's possible that this allocation could wind up in the same CFI granule as
-  // an unchecked library, which means the below might not crash. To force a
-  // crash keep allocating up to a max until there is a crash.
-  EXPECT_EXIT(test_cfi_slowpath_with_alloc(), KilledByCfi, "");
-
   // Check all the addresses.
   const size_t bss_size = 1024 * 1024;
   static_assert(bss_size >= kLibraryAlignment * 2, "test range not big enough");
@@ -162,10 +143,6 @@
 
   dlclose(handle);
   dlclose(handle2);
-
-  // CFI check for a function inside the unloaded DSO. This is always invalid and gets the process
-  // killed.
-  EXPECT_EXIT(__cfi_slowpath(45, reinterpret_cast<void*>(code_ptr)), KilledByCfi, "");
 #endif
 }