summaryrefslogtreecommitdiffstats
path: root/libsanitizer
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2022-05-05 12:51:36 +0200
committerMartin Liska <mliska@suse.cz>2022-05-05 13:24:04 +0200
commit8996894d00f95b24bddb06aa6a2d62bd9cb371f9 (patch)
treea5c519d98caa37cd210dac8f94868f9944d7997d /libsanitizer
parentEmbed real_value into REAL_CST (diff)
downloadgcc-8996894d00f95b24bddb06aa6a2d62bd9cb371f9.tar.gz
gcc-8996894d00f95b24bddb06aa6a2d62bd9cb371f9.tar.bz2
gcc-8996894d00f95b24bddb06aa6a2d62bd9cb371f9.tar.xz
libsanitizer: merge from master (75f9e83ace52773af65dcebca543005ec8a2705d).
Diffstat (limited to 'libsanitizer')
-rw-r--r--libsanitizer/MERGE2
-rw-r--r--libsanitizer/asan/asan_globals.cpp19
-rw-r--r--libsanitizer/asan/asan_interceptors.h7
-rw-r--r--libsanitizer/asan/asan_mapping.h2
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_internal_defs.h6
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp4
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_mac.cpp12
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_mac.h20
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cpp5
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp4
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h2
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_stacktrace.cpp17
-rw-r--r--libsanitizer/tsan/tsan_rtl_ppc64.S1
-rw-r--r--libsanitizer/tsan/tsan_shadow.h11
-rw-r--r--libsanitizer/ubsan/ubsan_flags.cpp1
-rw-r--r--libsanitizer/ubsan/ubsan_handlers.cpp15
-rw-r--r--libsanitizer/ubsan/ubsan_handlers.h8
-rw-r--r--libsanitizer/ubsan/ubsan_platform.h2
18 files changed, 45 insertions, 93 deletions
diff --git a/libsanitizer/MERGE b/libsanitizer/MERGE
index b92d082f9ae..691c82b0003 100644
--- a/libsanitizer/MERGE
+++ b/libsanitizer/MERGE
@@ -1,4 +1,4 @@
10a1bcab9f3bf75c4c5d3e53bafb3eeb80320af46 175f9e83ace52773af65dcebca543005ec8a2705d
2 2
3The first line of this file holds the git revision number of the 3The first line of this file holds the git revision number of the
4last merge done from the master library sources. 4last merge done from the master library sources.
diff --git a/libsanitizer/asan/asan_globals.cpp b/libsanitizer/asan/asan_globals.cpp
index 326a49798f0..ecc2600f039 100644
--- a/libsanitizer/asan/asan_globals.cpp
+++ b/libsanitizer/asan/asan_globals.cpp
@@ -153,6 +153,23 @@ static void CheckODRViolationViaIndicator(const Global *g) {
153 } 153 }
154} 154}
155 155
156// Check ODR violation for given global G by checking if it's already poisoned.
157// We use this method in case compiler doesn't use private aliases for global
158// variables.
159static void CheckODRViolationViaPoisoning(const Global *g) {
160 if (__asan_region_is_poisoned(g->beg, g->size_with_redzone)) {
161 // This check may not be enough: if the first global is much larger
162 // the entire redzone of the second global may be within the first global.
163 for (ListOfGlobals *l = list_of_all_globals; l; l = l->next) {
164 if (g->beg == l->g->beg &&
165 (flags()->detect_odr_violation >= 2 || g->size != l->g->size) &&
166 !IsODRViolationSuppressed(g->name))
167 ReportODRViolation(g, FindRegistrationSite(g),
168 l->g, FindRegistrationSite(l->g));
169 }
170 }
171}
172
156// Clang provides two different ways for global variables protection: 173// Clang provides two different ways for global variables protection:
157// it can poison the global itself or its private alias. In former 174// it can poison the global itself or its private alias. In former
158// case we may poison same symbol multiple times, that can help us to 175// case we may poison same symbol multiple times, that can help us to
@@ -198,6 +215,8 @@ static void RegisterGlobal(const Global *g) {
198 // where two globals with the same name are defined in different modules. 215 // where two globals with the same name are defined in different modules.
199 if (UseODRIndicator(g)) 216 if (UseODRIndicator(g))
200 CheckODRViolationViaIndicator(g); 217 CheckODRViolationViaIndicator(g);
218 else
219 CheckODRViolationViaPoisoning(g);
201 } 220 }
202 if (CanPoisonMemory()) 221 if (CanPoisonMemory())
203 PoisonRedZones(*g); 222 PoisonRedZones(*g);
diff --git a/libsanitizer/asan/asan_interceptors.h b/libsanitizer/asan/asan_interceptors.h
index 105c672cc24..047b044c8bf 100644
--- a/libsanitizer/asan/asan_interceptors.h
+++ b/libsanitizer/asan/asan_interceptors.h
@@ -81,12 +81,7 @@ void InitializePlatformInterceptors();
81#if ASAN_HAS_EXCEPTIONS && !SANITIZER_WINDOWS && !SANITIZER_SOLARIS && \ 81#if ASAN_HAS_EXCEPTIONS && !SANITIZER_WINDOWS && !SANITIZER_SOLARIS && \
82 !SANITIZER_NETBSD 82 !SANITIZER_NETBSD
83# define ASAN_INTERCEPT___CXA_THROW 1 83# define ASAN_INTERCEPT___CXA_THROW 1
84# if ! defined(ASAN_HAS_CXA_RETHROW_PRIMARY_EXCEPTION) \ 84# define ASAN_INTERCEPT___CXA_RETHROW_PRIMARY_EXCEPTION 1
85 || ASAN_HAS_CXA_RETHROW_PRIMARY_EXCEPTION
86# define ASAN_INTERCEPT___CXA_RETHROW_PRIMARY_EXCEPTION 1
87# else
88# define ASAN_INTERCEPT___CXA_RETHROW_PRIMARY_EXCEPTION 0
89# endif
90# if defined(_GLIBCXX_SJLJ_EXCEPTIONS) || (SANITIZER_IOS && defined(__arm__)) 85# if defined(_GLIBCXX_SJLJ_EXCEPTIONS) || (SANITIZER_IOS && defined(__arm__))
91# define ASAN_INTERCEPT__UNWIND_SJLJ_RAISEEXCEPTION 1 86# define ASAN_INTERCEPT__UNWIND_SJLJ_RAISEEXCEPTION 1
92# else 87# else
diff --git a/libsanitizer/asan/asan_mapping.h b/libsanitizer/asan/asan_mapping.h
index 1b6669e1270..4ff09b103d5 100644
--- a/libsanitizer/asan/asan_mapping.h
+++ b/libsanitizer/asan/asan_mapping.h
@@ -181,7 +181,7 @@
181# elif defined(__aarch64__) 181# elif defined(__aarch64__)
182# define ASAN_SHADOW_OFFSET_CONST 0x0000001000000000 182# define ASAN_SHADOW_OFFSET_CONST 0x0000001000000000
183# elif defined(__powerpc64__) 183# elif defined(__powerpc64__)
184# define ASAN_SHADOW_OFFSET_CONST 0x0000020000000000 184# define ASAN_SHADOW_OFFSET_CONST 0x0000100000000000
185# elif defined(__s390x__) 185# elif defined(__s390x__)
186# define ASAN_SHADOW_OFFSET_CONST 0x0010000000000000 186# define ASAN_SHADOW_OFFSET_CONST 0x0010000000000000
187# elif SANITIZER_FREEBSD 187# elif SANITIZER_FREEBSD
diff --git a/libsanitizer/sanitizer_common/sanitizer_internal_defs.h b/libsanitizer/sanitizer_common/sanitizer_internal_defs.h
index 95a80b4629c..ff65069de8d 100644
--- a/libsanitizer/sanitizer_common/sanitizer_internal_defs.h
+++ b/libsanitizer/sanitizer_common/sanitizer_internal_defs.h
@@ -259,10 +259,10 @@ typedef u64 tid_t;
259# define NOEXCEPT throw() 259# define NOEXCEPT throw()
260#endif 260#endif
261 261
262#if __has_cpp_attribute(fallthrough) 262#if __has_cpp_attribute(clang::fallthrough)
263# define FALLTHROUGH [[fallthrough]]
264#elif __has_cpp_attribute(clang::fallthrough)
265# define FALLTHROUGH [[clang::fallthrough]] 263# define FALLTHROUGH [[clang::fallthrough]]
264#elif __has_cpp_attribute(fallthrough)
265# define FALLTHROUGH [[fallthrough]]
266#else 266#else
267# define FALLTHROUGH 267# define FALLTHROUGH
268#endif 268#endif
diff --git a/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp b/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp
index d966d857a76..25ad825f568 100644
--- a/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp
@@ -792,13 +792,9 @@ u32 GetNumberOfCPUs() {
792#elif SANITIZER_SOLARIS 792#elif SANITIZER_SOLARIS
793 return sysconf(_SC_NPROCESSORS_ONLN); 793 return sysconf(_SC_NPROCESSORS_ONLN);
794#else 794#else
795#if defined(CPU_COUNT)
796 cpu_set_t CPUs; 795 cpu_set_t CPUs;
797 CHECK_EQ(sched_getaffinity(0, sizeof(cpu_set_t), &CPUs), 0); 796 CHECK_EQ(sched_getaffinity(0, sizeof(cpu_set_t), &CPUs), 0);
798 return CPU_COUNT(&CPUs); 797 return CPU_COUNT(&CPUs);
799#else
800 return 1;
801#endif
802#endif 798#endif
803} 799}
804 800
diff --git a/libsanitizer/sanitizer_common/sanitizer_mac.cpp b/libsanitizer/sanitizer_common/sanitizer_mac.cpp
index 7ce8d670ecc..05512a576ad 100644
--- a/libsanitizer/sanitizer_common/sanitizer_mac.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_mac.cpp
@@ -38,7 +38,7 @@
38extern char **environ; 38extern char **environ;
39#endif 39#endif
40 40
41#if defined(__has_include) && __has_include(<os/trace.h>) && defined(__BLOCKS__) 41#if defined(__has_include) && __has_include(<os/trace.h>)
42#define SANITIZER_OS_TRACE 1 42#define SANITIZER_OS_TRACE 1
43#include <os/trace.h> 43#include <os/trace.h>
44#else 44#else
@@ -71,15 +71,7 @@ extern "C" {
71#include <mach/mach_time.h> 71#include <mach/mach_time.h>
72#include <mach/vm_statistics.h> 72#include <mach/vm_statistics.h>
73#include <malloc/malloc.h> 73#include <malloc/malloc.h>
74#if defined(__has_builtin) && __has_builtin(__builtin_os_log_format) 74#include <os/log.h>
75# include <os/log.h>
76#else
77 /* Without support for __builtin_os_log_format, fall back to the older
78 method. */
79# define OS_LOG_DEFAULT 0
80# define os_log_error(A,B,C) \
81 asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "%s", (C));
82#endif
83#include <pthread.h> 75#include <pthread.h>
84#include <sched.h> 76#include <sched.h>
85#include <signal.h> 77#include <signal.h>
diff --git a/libsanitizer/sanitizer_common/sanitizer_mac.h b/libsanitizer/sanitizer_common/sanitizer_mac.h
index 96a5986a47a..0b6af5a3c0e 100644
--- a/libsanitizer/sanitizer_common/sanitizer_mac.h
+++ b/libsanitizer/sanitizer_common/sanitizer_mac.h
@@ -14,26 +14,6 @@
14 14
15#include "sanitizer_common.h" 15#include "sanitizer_common.h"
16#include "sanitizer_platform.h" 16#include "sanitizer_platform.h"
17
18/* TARGET_OS_OSX is not present in SDKs before Darwin16 (macOS 10.12) use
19 TARGET_OS_MAC (we have no support for iOS in any form for these versions,
20 so there's no ambiguity). */
21#if !defined(TARGET_OS_OSX) && TARGET_OS_MAC
22# define TARGET_OS_OSX 1
23#endif
24
25/* Other TARGET_OS_xxx are not present on earlier versions, define them to
26 0 (we have no support for them; they are not valid targets anyway). */
27#ifndef TARGET_OS_IOS
28#define TARGET_OS_IOS 0
29#endif
30#ifndef TARGET_OS_TV
31#define TARGET_OS_TV 0
32#endif
33#ifndef TARGET_OS_WATCH
34#define TARGET_OS_WATCH 0
35#endif
36
37#if SANITIZER_MAC 17#if SANITIZER_MAC
38#include "sanitizer_posix.h" 18#include "sanitizer_posix.h"
39 19
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cpp b/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cpp
index 2b1a2f7932c..9d577570ea1 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cpp
@@ -26,10 +26,7 @@
26 26
27// With old kernels (and even new kernels on powerpc) asm/stat.h uses types that 27// With old kernels (and even new kernels on powerpc) asm/stat.h uses types that
28// are not defined anywhere in userspace headers. Fake them. This seems to work 28// are not defined anywhere in userspace headers. Fake them. This seems to work
29// fine with newer headers, too. Beware that with <sys/stat.h>, struct stat 29// fine with newer headers, too.
30// takes the form of struct stat64 on 32-bit platforms if _FILE_OFFSET_BITS=64.
31// Also, for some platforms (e.g. mips) there are additional members in the
32// <sys/stat.h> struct stat:s.
33#include <linux/posix_types.h> 30#include <linux/posix_types.h>
34# if defined(__x86_64__) || defined(__mips__) || defined(__hexagon__) 31# if defined(__x86_64__) || defined(__mips__) || defined(__hexagon__)
35# include <sys/stat.h> 32# include <sys/stat.h>
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
index e5cecaaaffc..8ed3e92d270 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -218,6 +218,10 @@ namespace __sanitizer {
218 218
219 unsigned ucontext_t_sz(void *ctx) { 219 unsigned ucontext_t_sz(void *ctx) {
220# if SANITIZER_GLIBC && SANITIZER_X64 220# if SANITIZER_GLIBC && SANITIZER_X64
221 // Added in Linux kernel 3.4.0, merged to glibc in 2.16
222# ifndef FP_XSTATE_MAGIC1
223# define FP_XSTATE_MAGIC1 0x46505853U
224# endif
221 // See kernel arch/x86/kernel/fpu/signal.c for details. 225 // See kernel arch/x86/kernel/fpu/signal.c for details.
222 const auto *fpregs = static_cast<ucontext_t *>(ctx)->uc_mcontext.fpregs; 226 const auto *fpregs = static_cast<ucontext_t *>(ctx)->uc_mcontext.fpregs;
223 // The member names differ across header versions, but the actual layout 227 // The member names differ across header versions, but the actual layout
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index 89772a7e5c0..62a99035db3 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -83,7 +83,7 @@ const unsigned struct_kernel_stat64_sz = 104;
83#elif defined(__mips__) 83#elif defined(__mips__)
84const unsigned struct_kernel_stat_sz = SANITIZER_ANDROID 84const unsigned struct_kernel_stat_sz = SANITIZER_ANDROID
85 ? FIRST_32_SECOND_64(104, 128) 85 ? FIRST_32_SECOND_64(104, 128)
86 : FIRST_32_SECOND_64(144, 216); 86 : FIRST_32_SECOND_64(160, 216);
87const unsigned struct_kernel_stat64_sz = 104; 87const unsigned struct_kernel_stat64_sz = 104;
88#elif defined(__s390__) && !defined(__s390x__) 88#elif defined(__s390__) && !defined(__s390x__)
89const unsigned struct_kernel_stat_sz = 64; 89const unsigned struct_kernel_stat_sz = 64;
diff --git a/libsanitizer/sanitizer_common/sanitizer_stacktrace.cpp b/libsanitizer/sanitizer_common/sanitizer_stacktrace.cpp
index 7386285f34b..3013a0c4abd 100644
--- a/libsanitizer/sanitizer_common/sanitizer_stacktrace.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_stacktrace.cpp
@@ -87,8 +87,8 @@ static inline uhwptr *GetCanonicFrame(uptr bp,
87 // Nope, this does not look right either. This means the frame after next does 87 // Nope, this does not look right either. This means the frame after next does
88 // not have a valid frame pointer, but we can still extract the caller PC. 88 // not have a valid frame pointer, but we can still extract the caller PC.
89 // Unfortunately, there is no way to decide between GCC and LLVM frame 89 // Unfortunately, there is no way to decide between GCC and LLVM frame
90 // layouts. Assume GCC. 90 // layouts. Assume LLVM.
91 return bp_prev - 1; 91 return bp_prev;
92#else 92#else
93 return (uhwptr*)bp; 93 return (uhwptr*)bp;
94#endif 94#endif
@@ -111,21 +111,14 @@ void BufferedStackTrace::UnwindFast(uptr pc, uptr bp, uptr stack_top,
111 IsAligned((uptr)frame, sizeof(*frame)) && 111 IsAligned((uptr)frame, sizeof(*frame)) &&
112 size < max_depth) { 112 size < max_depth) {
113#ifdef __powerpc__ 113#ifdef __powerpc__
114 // PowerPC ABIs specify that the return address is saved on the 114 // PowerPC ABIs specify that the return address is saved at offset
115 // *caller's* stack frame. Thus we must dereference the back chain 115 // 16 of the *caller's* stack frame. Thus we must dereference the
116 // to find the caller frame before extracting it. 116 // back chain to find the caller frame before extracting it.
117 uhwptr *caller_frame = (uhwptr*)frame[0]; 117 uhwptr *caller_frame = (uhwptr*)frame[0];
118 if (!IsValidFrame((uptr)caller_frame, stack_top, bottom) || 118 if (!IsValidFrame((uptr)caller_frame, stack_top, bottom) ||
119 !IsAligned((uptr)caller_frame, sizeof(uhwptr))) 119 !IsAligned((uptr)caller_frame, sizeof(uhwptr)))
120 break; 120 break;
121 // For most ABIs the offset where the return address is saved is two
122 // register sizes. The exception is the SVR4 ABI, which uses an
123 // offset of only one register size.
124#ifdef _CALL_SYSV
125 uhwptr pc1 = caller_frame[1];
126#else
127 uhwptr pc1 = caller_frame[2]; 121 uhwptr pc1 = caller_frame[2];
128#endif
129#elif defined(__s390__) 122#elif defined(__s390__)
130 uhwptr pc1 = frame[14]; 123 uhwptr pc1 = frame[14];
131#elif defined(__riscv) 124#elif defined(__riscv)
diff --git a/libsanitizer/tsan/tsan_rtl_ppc64.S b/libsanitizer/tsan/tsan_rtl_ppc64.S
index 9e533a71a9c..8285e21aa1e 100644
--- a/libsanitizer/tsan/tsan_rtl_ppc64.S
+++ b/libsanitizer/tsan/tsan_rtl_ppc64.S
@@ -1,6 +1,5 @@
1#include "tsan_ppc_regs.h" 1#include "tsan_ppc_regs.h"
2 2
3 .machine altivec
4 .section .text 3 .section .text
5 .hidden __tsan_setjmp 4 .hidden __tsan_setjmp
6 .globl _setjmp 5 .globl _setjmp
diff --git a/libsanitizer/tsan/tsan_shadow.h b/libsanitizer/tsan/tsan_shadow.h
index 843573ecf5d..b222acf9e6c 100644
--- a/libsanitizer/tsan/tsan_shadow.h
+++ b/libsanitizer/tsan/tsan_shadow.h
@@ -88,10 +88,13 @@ class Shadow {
88 if (size) 88 if (size)
89 *size = part_.access_ == kFreeAccess ? kShadowCell 89 *size = part_.access_ == kFreeAccess ? kShadowCell
90 : __builtin_popcount(part_.access_); 90 : __builtin_popcount(part_.access_);
91 if (typ) 91 if (typ) {
92 *typ = (part_.is_read_ ? kAccessRead : kAccessWrite) | 92 *typ = part_.is_read_ ? kAccessRead : kAccessWrite;
93 (part_.is_atomic_ ? kAccessAtomic : 0) | 93 if (part_.is_atomic_)
94 (part_.access_ == kFreeAccess ? kAccessFree : 0); 94 *typ |= kAccessAtomic;
95 if (part_.access_ == kFreeAccess)
96 *typ |= kAccessFree;
97 }
95 } 98 }
96 99
97 ALWAYS_INLINE 100 ALWAYS_INLINE
diff --git a/libsanitizer/ubsan/ubsan_flags.cpp b/libsanitizer/ubsan/ubsan_flags.cpp
index 9a66bd37518..25cefd46ce2 100644
--- a/libsanitizer/ubsan/ubsan_flags.cpp
+++ b/libsanitizer/ubsan/ubsan_flags.cpp
@@ -50,7 +50,6 @@ void InitializeFlags() {
50 { 50 {
51 CommonFlags cf; 51 CommonFlags cf;
52 cf.CopyFrom(*common_flags()); 52 cf.CopyFrom(*common_flags());
53 cf.print_summary = false;
54 cf.external_symbolizer_path = GetFlag("UBSAN_SYMBOLIZER_PATH"); 53 cf.external_symbolizer_path = GetFlag("UBSAN_SYMBOLIZER_PATH");
55 OverrideCommonFlags(cf); 54 OverrideCommonFlags(cf);
56 } 55 }
diff --git a/libsanitizer/ubsan/ubsan_handlers.cpp b/libsanitizer/ubsan/ubsan_handlers.cpp
index 2184625aa6e..e201e6bba22 100644
--- a/libsanitizer/ubsan/ubsan_handlers.cpp
+++ b/libsanitizer/ubsan/ubsan_handlers.cpp
@@ -894,21 +894,6 @@ void __ubsan_handle_cfi_bad_type(CFICheckFailData *Data, ValueHandle Vtable,
894 894
895} // namespace __ubsan 895} // namespace __ubsan
896 896
897void __ubsan::__ubsan_handle_cfi_bad_icall(CFIBadIcallData *CallData,
898 ValueHandle Function) {
899 GET_REPORT_OPTIONS(false);
900 CFICheckFailData Data = {CFITCK_ICall, CallData->Loc, CallData->Type};
901 handleCFIBadIcall(&Data, Function, Opts);
902}
903
904void __ubsan::__ubsan_handle_cfi_bad_icall_abort(CFIBadIcallData *CallData,
905 ValueHandle Function) {
906 GET_REPORT_OPTIONS(true);
907 CFICheckFailData Data = {CFITCK_ICall, CallData->Loc, CallData->Type};
908 handleCFIBadIcall(&Data, Function, Opts);
909 Die();
910}
911
912void __ubsan::__ubsan_handle_cfi_check_fail(CFICheckFailData *Data, 897void __ubsan::__ubsan_handle_cfi_check_fail(CFICheckFailData *Data,
913 ValueHandle Value, 898 ValueHandle Value,
914 uptr ValidVtable) { 899 uptr ValidVtable) {
diff --git a/libsanitizer/ubsan/ubsan_handlers.h b/libsanitizer/ubsan/ubsan_handlers.h
index 9f412353fc0..219fb15de55 100644
--- a/libsanitizer/ubsan/ubsan_handlers.h
+++ b/libsanitizer/ubsan/ubsan_handlers.h
@@ -215,20 +215,12 @@ enum CFITypeCheckKind : unsigned char {
215 CFITCK_VMFCall, 215 CFITCK_VMFCall,
216}; 216};
217 217
218struct CFIBadIcallData {
219 SourceLocation Loc;
220 const TypeDescriptor &Type;
221};
222
223struct CFICheckFailData { 218struct CFICheckFailData {
224 CFITypeCheckKind CheckKind; 219 CFITypeCheckKind CheckKind;
225 SourceLocation Loc; 220 SourceLocation Loc;
226 const TypeDescriptor &Type; 221 const TypeDescriptor &Type;
227}; 222};
228 223
229/// \brief Handle control flow integrity failure for indirect function calls.
230RECOVERABLE(cfi_bad_icall, CFIBadIcallData *Data, ValueHandle Function)
231
232/// \brief Handle control flow integrity failures. 224/// \brief Handle control flow integrity failures.
233RECOVERABLE(cfi_check_fail, CFICheckFailData *Data, ValueHandle Function, 225RECOVERABLE(cfi_check_fail, CFICheckFailData *Data, ValueHandle Function,
234 uptr VtableIsValid) 226 uptr VtableIsValid)
diff --git a/libsanitizer/ubsan/ubsan_platform.h b/libsanitizer/ubsan/ubsan_platform.h
index ad3e883f0f3..d2cc2e10bd2 100644
--- a/libsanitizer/ubsan/ubsan_platform.h
+++ b/libsanitizer/ubsan/ubsan_platform.h
@@ -12,7 +12,6 @@
12#ifndef UBSAN_PLATFORM_H 12#ifndef UBSAN_PLATFORM_H
13#define UBSAN_PLATFORM_H 13#define UBSAN_PLATFORM_H
14 14
15#ifndef CAN_SANITIZE_UB
16// Other platforms should be easy to add, and probably work as-is. 15// Other platforms should be easy to add, and probably work as-is.
17#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) || \ 16#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) || \
18 defined(__NetBSD__) || defined(__DragonFly__) || \ 17 defined(__NetBSD__) || defined(__DragonFly__) || \
@@ -22,6 +21,5 @@
22#else 21#else
23# define CAN_SANITIZE_UB 0 22# define CAN_SANITIZE_UB 0
24#endif 23#endif
25#endif //CAN_SANITIZE_UB
26 24
27#endif 25#endif