Revert "Fix CFI initialization crash on x86."
Breaks aosp-master/sdk.
This reverts commit 4ccd4317f9301ec9b32aa0d3317a0439b994d7bf.
diff --git a/tests/cfi_test.cpp b/tests/cfi_test.cpp
index cd70968..0f93edb 100644
--- a/tests/cfi_test.cpp
+++ b/tests/cfi_test.cpp
@@ -1,25 +1,7 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <dlfcn.h>
#include <gtest/gtest.h>
+#include <dlfcn.h>
#include "BionicDeathTest.h"
-#include "gtest_globals.h"
-#include "utils.h"
// Private libdl interface.
extern "C" {
@@ -30,7 +12,6 @@
static void f() {}
TEST(cfi_test, basic) {
-#if defined(__BIONIC__)
void* handle;
handle = dlopen("libcfi-test.so", RTLD_NOW | RTLD_LOCAL);
ASSERT_TRUE(handle != nullptr) << dlerror();
@@ -101,37 +82,13 @@
// CFI check for a function inside the unloaded DSO. This is always invalid and gets the process
// killed.
EXPECT_DEATH(__cfi_slowpath(45, reinterpret_cast<void*>(code_ptr)), "");
-#endif
}
TEST(cfi_test, invalid) {
-#if defined(__BIONIC__)
void* handle;
handle = dlopen("libcfi-test-bad.so", RTLD_NOW | RTLD_LOCAL);
ASSERT_FALSE(handle != nullptr) << dlerror();
handle = dlopen("libcfi-test-bad.so", RTLD_NOW | RTLD_LOCAL);
ASSERT_FALSE(handle != nullptr) << dlerror();
-#endif
-}
-
-// cfi_test_helper exports __cfi_check, which triggers CFI initialization at startup.
-TEST(cfi_test, early_init) {
-#if defined(__BIONIC__)
- std::string helper = get_testlib_root() + "/cfi_test_helper/cfi_test_helper";
- ExecTestHelper eth;
- eth.SetArgs({ helper.c_str(), nullptr });
- eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0, nullptr);
-#endif
-}
-
-// cfi_test_helper2 depends on a library that exports __cfi_check, which triggers CFI initialization
-// at startup.
-TEST(cfi_test, early_init2) {
-#if defined(__BIONIC__)
- std::string helper = get_testlib_root() + "/cfi_test_helper2/cfi_test_helper2";
- ExecTestHelper eth;
- eth.SetArgs({ helper.c_str(), nullptr });
- eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0, nullptr);
-#endif
}