Remove cfi_buildflags.h Change-Id: I273e36539cc4a99418e6cd4568dfd932c98e0b8d Reviewed-on: https://gn-review.googlesource.com/1180 Reviewed-by: Brett Wilson <brettw@chromium.org> Reviewed-by: Scott Graham <scottmg@chromium.org>
diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc index f3f05da..b954b97 100644 --- a/base/debug/stack_trace_posix.cc +++ b/base/debug/stack_trace_posix.cc
@@ -39,7 +39,6 @@ #include "base/debug/proc_maps_linux.h" #endif -#include "base/cfi_buildflags.h" #include "base/debug/debugger.h" #include "base/files/scoped_file.h" #include "base/logging.h" @@ -321,16 +320,6 @@ } PrintToStderr("\n"); -#if BUILDFLAG(CFI_ENFORCEMENT_TRAP) - if (signal == SIGILL && info->si_code == ILL_ILLOPN) { - PrintToStderr( - "CFI: Most likely a control flow integrity violation; for more " - "information see:\n"); - PrintToStderr( - "https://www.chromium.org/developers/testing/control-flow-integrity\n"); - } -#endif // BUILDFLAG(CFI_ENFORCEMENT_TRAP) - debug::StackTrace().Print(); #if defined(OS_LINUX)
diff --git a/base/memory/protected_memory_cfi.h b/base/memory/protected_memory_cfi.h index a90023b..44f4654 100644 --- a/base/memory/protected_memory_cfi.h +++ b/base/memory/protected_memory_cfi.h
@@ -13,16 +13,11 @@ #include <utility> -#include "base/cfi_buildflags.h" #include "base/compiler_specific.h" #include "base/macros.h" #include "base/memory/protected_memory.h" #include "build/build_config.h" -#if BUILDFLAG(CFI_ICALL_CHECK) && !PROTECTED_MEMORY_ENABLED -#error "CFI-icall enabled for platform without protected memory support" -#endif // BUILDFLAG(CFI_ICALL_CHECK) && !PROTECTED_MEMORY_ENABLED - namespace base { namespace internal {
diff --git a/base/memory/protected_memory_unittest.cc b/base/memory/protected_memory_unittest.cc index b7daed3..5601f45 100644 --- a/base/memory/protected_memory_unittest.cc +++ b/base/memory/protected_memory_unittest.cc
@@ -3,7 +3,6 @@ // found in the LICENSE file. #include "base/memory/protected_memory.h" -#include "base/cfi_buildflags.h" #include "base/memory/protected_memory_cfi.h" #include "base/synchronization/lock.h" #include "base/test/gtest_util.h" @@ -100,11 +99,7 @@ &icall_pm1, BadIcall(reinterpret_cast<int (*)(int)>(&bad_icall))); EXPECT_EQ(UnsanitizedCfiCall(icall_pm1, &BadIcall::fp)(1), 5); -#if !BUILDFLAG(CFI_ICALL_CHECK) EXPECT_EQ(icall_pm1->fp(1), 5); -#elif BUILDFLAG(CFI_ENFORCEMENT_TRAP) || BUILDFLAG(CFI_ENFORCEMENT_DIAGNOSTIC) - EXPECT_DEATH({ icall_pm1->fp(1); }, ""); -#endif } PROTECTED_MEMORY_SECTION ProtectedMemory<int (*)(int)> icall_pm2; @@ -114,11 +109,7 @@ &icall_pm2, reinterpret_cast<int (*)(int)>(&bad_icall)); EXPECT_EQ(UnsanitizedCfiCall(icall_pm2)(1), 5); -#if !BUILDFLAG(CFI_ICALL_CHECK) EXPECT_EQ((*icall_pm2)(1), 5); -#elif BUILDFLAG(CFI_ENFORCEMENT_TRAP) || BUILDFLAG(CFI_ENFORCEMENT_DIAGNOSTIC) - EXPECT_DEATH({ (*icall_pm2)(1); }, ""); -#endif } #endif // defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID)
diff --git a/base/tools_sanity_unittest.cc b/base/tools_sanity_unittest.cc index 98c30df..42d45f4 100644 --- a/base/tools_sanity_unittest.cc +++ b/base/tools_sanity_unittest.cc
@@ -9,7 +9,6 @@ #include <stddef.h> #include "base/atomicops.h" -#include "base/cfi_buildflags.h" #include "base/debug/asan_invalid_access.h" #include "base/debug/profiler.h" #include "base/third_party/dynamic_annotations/dynamic_annotations.h" @@ -332,20 +331,6 @@ EXPECT_EQ(kMagicValue, shared); } -#if BUILDFLAG(CFI_ENFORCEMENT_TRAP) -#if defined(OS_WIN) -#define CFI_ERROR_MSG "EXCEPTION_ILLEGAL_INSTRUCTION" -#elif defined(OS_ANDROID) -// TODO(pcc): Produce proper stack dumps on Android and test for the correct -// si_code here. -#define CFI_ERROR_MSG "^$" -#else -#define CFI_ERROR_MSG "ILL_ILLOPN" -#endif -#elif BUILDFLAG(CFI_ENFORCEMENT_DIAGNOSTIC) -#define CFI_ERROR_MSG "runtime error: control flow integrity check" -#endif // BUILDFLAG(CFI_ENFORCEMENT_TRAP || CFI_ENFORCEMENT_DIAGNOSTIC) - #if defined(CFI_ERROR_MSG) class A { public: @@ -389,27 +374,6 @@ CFI_ERROR_MSG); } -// TODO(pcc): remove CFI_CAST_CHECK, see https://crbug.com/626794. -#if BUILDFLAG(CFI_CAST_CHECK) -TEST(ToolsSanityTest, BadDerivedCast) { - A a; - EXPECT_DEATH((void)(B*)&a, CFI_ERROR_MSG); -} - -TEST(ToolsSanityTest, BadUnrelatedCast) { - class A { - virtual void f() {} - }; - - class B { - virtual void f() {} - }; - - A a; - EXPECT_DEATH((void)(B*)&a, CFI_ERROR_MSG); -} -#endif // BUILDFLAG(CFI_CAST_CHECK) - #endif // CFI_ERROR_MSG #undef CFI_ERROR_MSG
diff --git a/tools/gn/bootstrap/bootstrap.py b/tools/gn/bootstrap/bootstrap.py index 602f43d..9a134a5 100755 --- a/tools/gn/bootstrap/bootstrap.py +++ b/tools/gn/bootstrap/bootstrap.py
@@ -226,14 +226,6 @@ root_gen_dir = os.path.join(tempdir, 'gen') mkdir_p(root_gen_dir) - write_buildflag_header_manually(root_gen_dir, 'base/cfi_buildflags.h', - { - 'CFI_CAST_CHECK': 'false', - 'CFI_ICALL_CHECK': 'false', - 'CFI_ENFORCEMENT_TRAP': 'false', - 'CFI_ENFORCEMENT_DIAGNOSTIC': 'false' - }) - write_build_date_header(root_gen_dir) if is_mac: