Libsanitizer: merge from trunk
authorMartin Liska <mliska@suse.cz>
Thu, 7 Nov 2019 09:33:54 +0000 (10:33 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Thu, 7 Nov 2019 09:33:54 +0000 (09:33 +0000)
2019-11-07  Martin Liska  <mliska@suse.cz>

* merge.sh: Update to use llvm-project git repository.
* all source files: Merge from upstream
82588e05cc32bb30807e480abd4e689b0dee132a.

From-SVN: r277909

30 files changed:
libsanitizer/ChangeLog
libsanitizer/MERGE
libsanitizer/asan/asan_allocator.cpp
libsanitizer/asan/asan_globals.cpp
libsanitizer/asan/asan_interceptors.h
libsanitizer/asan/asan_interface.inc
libsanitizer/asan/asan_interface_internal.h
libsanitizer/asan/asan_malloc_win.cpp
libsanitizer/asan/asan_mapping.h
libsanitizer/include/sanitizer/asan_interface.h
libsanitizer/include/sanitizer/netbsd_syscall_hooks.h
libsanitizer/lsan/lsan_allocator.cpp
libsanitizer/merge.sh
libsanitizer/sanitizer_common/sanitizer_flags.inc
libsanitizer/sanitizer_common/sanitizer_linux.cpp
libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cpp
libsanitizer/sanitizer_common/sanitizer_mac.cpp
libsanitizer/sanitizer_common/sanitizer_platform.h
libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cpp
libsanitizer/sanitizer_common/sanitizer_platform_limits_netbsd.h
libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
libsanitizer/sanitizer_common/sanitizer_stacktrace.cpp
libsanitizer/sanitizer_common/sanitizer_syscalls_netbsd.inc
libsanitizer/tsan/tsan_mman.cpp
libsanitizer/tsan/tsan_rtl_ppc64.S
libsanitizer/ubsan/ubsan_flags.cpp
libsanitizer/ubsan/ubsan_handlers.cpp
libsanitizer/ubsan/ubsan_handlers.h
libsanitizer/ubsan/ubsan_platform.h

index aa3bb295a297174e5d336b1a4174f454424d016f..7054bce53bcccf51c6c4530926cd350fd8c91799 100644 (file)
@@ -1,3 +1,9 @@
+2019-11-07  Martin Liska  <mliska@suse.cz>
+
+       * merge.sh: Update to use llvm-project git repository.
+       * all source files: Merge from upstream
+       82588e05cc32bb30807e480abd4e689b0dee132a.
+
 2019-11-05  Martin Liska  <mliska@suse.cz>
 
        * ubsan/ubsan_flags.cpp (InitializeFlags): Trunk decided to print
index b7bf2529910987419ff3980c0415e1223a8b0abe..49ee2c3bab80107f1245f2a86c4663f3e5c12e53 100644 (file)
@@ -1,4 +1,4 @@
-375507
+82588e05cc32bb30807e480abd4e689b0dee132a
 
-The first line of this file holds the svn revision number of the
+The first line of this file holds the git revision number of the
 last merge done from the master library sources.
index c9e9f5a93d0d123c48bb0e8b62a2218813ca3e69..65c51fbafdd0c1c0bbfbdfd784cf8aedcae05224 100644 (file)
@@ -246,6 +246,7 @@ struct Allocator {
   AllocatorCache fallback_allocator_cache;
   QuarantineCache fallback_quarantine_cache;
 
+  uptr max_user_defined_malloc_size;
   atomic_uint8_t rss_limit_exceeded;
 
   // ------------------- Options --------------------------
@@ -280,6 +281,10 @@ struct Allocator {
     SetAllocatorMayReturnNull(options.may_return_null);
     allocator.InitLinkerInitialized(options.release_to_os_interval_ms);
     SharedInitCode(options);
+    max_user_defined_malloc_size = common_flags()->max_allocation_size_mb
+                                       ? common_flags()->max_allocation_size_mb
+                                             << 20
+                                       : kMaxAllowedMallocSize;
   }
 
   bool RssLimitExceeded() {
@@ -394,6 +399,16 @@ struct Allocator {
     return right_chunk;
   }
 
+  bool UpdateAllocationStack(uptr addr, BufferedStackTrace *stack) {
+    AsanChunk *m = GetAsanChunkByAddr(addr);
+    if (!m) return false;
+    if (m->chunk_state != CHUNK_ALLOCATED) return false;
+    if (m->Beg() != addr) return false;
+    atomic_store((atomic_uint32_t *)&m->alloc_context_id, StackDepotPut(*stack),
+                 memory_order_relaxed);
+    return true;
+  }
+
   // -------------------- Allocation/Deallocation routines ---------------
   void *Allocate(uptr size, uptr alignment, BufferedStackTrace *stack,
                  AllocType alloc_type, bool can_fill) {
@@ -435,14 +450,16 @@ struct Allocator {
       using_primary_allocator = false;
     }
     CHECK(IsAligned(needed_size, min_alignment));
-    if (size > kMaxAllowedMallocSize || needed_size > kMaxAllowedMallocSize) {
+    if (size > kMaxAllowedMallocSize || needed_size > kMaxAllowedMallocSize ||
+        size > max_user_defined_malloc_size) {
       if (AllocatorMayReturnNull()) {
         Report("WARNING: AddressSanitizer failed to allocate 0x%zx bytes\n",
                (void*)size);
         return nullptr;
       }
-      ReportAllocationSizeTooBig(size, needed_size, kMaxAllowedMallocSize,
-                                 stack);
+      uptr malloc_limit =
+          Min(kMaxAllowedMallocSize, max_user_defined_malloc_size);
+      ReportAllocationSizeTooBig(size, needed_size, malloc_limit, stack);
     }
 
     AsanThread *t = GetCurrentThread();
@@ -1105,6 +1122,11 @@ void __sanitizer_purge_allocator() {
   instance.Purge(&stack);
 }
 
+int __asan_update_allocation_context(void* addr) {
+  GET_STACK_TRACE_MALLOC;
+  return instance.UpdateAllocationStack((uptr)addr, &stack);
+}
+
 #if !SANITIZER_SUPPORTS_WEAK_HOOKS
 // Provide default (no-op) implementation of malloc hooks.
 SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_malloc_hook,
index e045c31cd1c38ec4258a1857ced145934b2aa90c..9d7dbc6f264cea7b80a71a91da37cfa0cfbbd0db 100644 (file)
@@ -154,6 +154,23 @@ static void CheckODRViolationViaIndicator(const Global *g) {
   }
 }
 
+// Check ODR violation for given global G by checking if it's already poisoned.
+// We use this method in case compiler doesn't use private aliases for global
+// variables.
+static void CheckODRViolationViaPoisoning(const Global *g) {
+  if (__asan_region_is_poisoned(g->beg, g->size_with_redzone)) {
+    // This check may not be enough: if the first global is much larger
+    // the entire redzone of the second global may be within the first global.
+    for (ListOfGlobals *l = list_of_all_globals; l; l = l->next) {
+      if (g->beg == l->g->beg &&
+          (flags()->detect_odr_violation >= 2 || g->size != l->g->size) &&
+          !IsODRViolationSuppressed(g->name))
+        ReportODRViolation(g, FindRegistrationSite(g),
+                           l->g, FindRegistrationSite(l->g));
+    }
+  }
+}
+
 // Clang provides two different ways for global variables protection:
 // it can poison the global itself or its private alias. In former
 // case we may poison same symbol multiple times, that can help us to
@@ -199,6 +216,8 @@ static void RegisterGlobal(const Global *g) {
     // where two globals with the same name are defined in different modules.
     if (UseODRIndicator(g))
       CheckODRViolationViaIndicator(g);
+    else
+      CheckODRViolationViaPoisoning(g);
   }
   if (CanPoisonMemory())
     PoisonRedZones(*g);
index b7a85fedbdfd4d69a1abf0d5cb0a4ced2d183079..344a64bd83d330553bca41f066b004092b6632df 100644 (file)
@@ -80,12 +80,7 @@ void InitializePlatformInterceptors();
 #if ASAN_HAS_EXCEPTIONS && !SANITIZER_WINDOWS && !SANITIZER_SOLARIS && \
     !SANITIZER_NETBSD
 # define ASAN_INTERCEPT___CXA_THROW 1
-# if ! defined(ASAN_HAS_CXA_RETHROW_PRIMARY_EXCEPTION) \
-     || ASAN_HAS_CXA_RETHROW_PRIMARY_EXCEPTION
-#   define ASAN_INTERCEPT___CXA_RETHROW_PRIMARY_EXCEPTION 1
-# else
-#   define ASAN_INTERCEPT___CXA_RETHROW_PRIMARY_EXCEPTION 0
-# endif
+# define ASAN_INTERCEPT___CXA_RETHROW_PRIMARY_EXCEPTION 1
 # if defined(_GLIBCXX_SJLJ_EXCEPTIONS) || (SANITIZER_IOS && defined(__arm__))
 #  define ASAN_INTERCEPT__UNWIND_SJLJ_RAISEEXCEPTION 1
 # else
index 7c341f22e15f4b37e03ea8c118ddfcfe06d6040a..9480104398276ae6963375de0eb54e9ef3747654 100644 (file)
@@ -164,6 +164,7 @@ INTERFACE_FUNCTION(__sanitizer_unaligned_load64)
 INTERFACE_FUNCTION(__sanitizer_unaligned_store16)
 INTERFACE_FUNCTION(__sanitizer_unaligned_store32)
 INTERFACE_FUNCTION(__sanitizer_unaligned_store64)
+INTERFACE_FUNCTION(__asan_update_allocation_context)
 INTERFACE_WEAK_FUNCTION(__asan_default_options)
 INTERFACE_WEAK_FUNCTION(__asan_default_suppressions)
 INTERFACE_WEAK_FUNCTION(__asan_on_error)
index c83aa11d741a17126577d3966a2322bd2d8c7f16..f14cbbcb76a35856f377cdd28c1ecf3e7b267c2f 100644 (file)
@@ -251,6 +251,9 @@ extern "C" {
   const char* __asan_default_suppressions();
 
   SANITIZER_INTERFACE_ATTRIBUTE void __asan_handle_vfork(void *sp);
+
+  SANITIZER_INTERFACE_ATTRIBUTE int __asan_update_allocation_context(
+      void *addr);
 }  // extern "C"
 
 #endif  // ASAN_INTERFACE_INTERNAL_H
index 13c6f652119bb9ed5e7121e6cd4adb56c63123ff..4b76d4ebd3eb4ed1c1a9d897b4585a2d420b9694 100644 (file)
@@ -35,11 +35,8 @@ constexpr unsigned long HEAP_REALLOC_IN_PLACE_ONLY = 0x00000010;
 constexpr unsigned long HEAP_ALLOCATE_SUPPORTED_FLAGS = (HEAP_ZERO_MEMORY);
 constexpr unsigned long HEAP_ALLOCATE_UNSUPPORTED_FLAGS =
     (~HEAP_ALLOCATE_SUPPORTED_FLAGS);
-constexpr unsigned long HEAP_FREE_SUPPORTED_FLAGS = (0);
 constexpr unsigned long HEAP_FREE_UNSUPPORTED_FLAGS =
     (~HEAP_ALLOCATE_SUPPORTED_FLAGS);
-constexpr unsigned long HEAP_REALLOC_SUPPORTED_FLAGS =
-    (HEAP_REALLOC_IN_PLACE_ONLY | HEAP_ZERO_MEMORY);
 constexpr unsigned long HEAP_REALLOC_UNSUPPORTED_FLAGS =
     (~HEAP_ALLOCATE_SUPPORTED_FLAGS);
 
index 09be904270cedbb1bed9736dd3a616463180c83b..41fb49ee46d460774a487c638b2c58531b8ac8d0 100644 (file)
@@ -163,7 +163,7 @@ static const u64 kDefaultShort64bitShadowOffset =
 static const u64 kAArch64_ShadowOffset64 = 1ULL << 36;
 static const u64 kMIPS32_ShadowOffset32 = 0x0aaa0000;
 static const u64 kMIPS64_ShadowOffset64 = 1ULL << 37;
-static const u64 kPPC64_ShadowOffset64 = 1ULL << 41;
+static const u64 kPPC64_ShadowOffset64 = 1ULL << 44;
 static const u64 kSystemZ_ShadowOffset64 = 1ULL << 52;
 static const u64 kSPARC64_ShadowOffset64 = 1ULL << 43;  // 0x80000000000
 static const u64 kFreeBSD_ShadowOffset32 = 1ULL << 30;  // 0x40000000
index ab2dc97ed24ab51cc6374160acd47feefc158ab8..6af93aad6512ff646ba77bca9df3bab3ed45aff3 100644 (file)
@@ -315,6 +315,10 @@ void *__asan_addr_is_in_fake_stack(void *fake_stack, void *addr, void **beg,
 /// functions like <c>_exit()</c> and <c>execl()</c>.
 void __asan_handle_no_return(void);
 
+/// Update allocation stack trace for the given allocation to the current stack
+/// trace. Returns 1 if successfull, 0 if not.
+int __asan_update_allocation_context(void* addr);
+
 #ifdef __cplusplus
 }  // extern "C"
 #endif
index 27780e0d419f6d324f75119c6770a7f0e970e564..174b4bf06de6ca71171d0ec4ed32e2a61f626712 100644 (file)
@@ -20,8 +20,8 @@
 // DO NOT EDIT! THIS FILE HAS BEEN GENERATED!
 //
 // Generated with: generate_netbsd_syscalls.awk
-// Generated date: 2018-10-30
-// Generated from: syscalls.master,v 1.293 2018/07/31 13:00:13 rjs Exp
+// Generated date: 2019-11-01
+// Generated from: syscalls.master,v 1.296 2019/09/22 22:59:39 christos Exp
 //
 //===----------------------------------------------------------------------===//
 #ifndef SANITIZER_NETBSD_SYSCALL_HOOKS_H
 #define __sanitizer_syscall_post_uuidgen(res, store, count)                    \
   __sanitizer_syscall_post_impl_uuidgen(res, (long long)(store),               \
                                         (long long)(count))
-#define __sanitizer_syscall_pre_getvfsstat(buf, bufsize, flags)                \
-  __sanitizer_syscall_pre_impl_getvfsstat(                                     \
+#define __sanitizer_syscall_pre_compat_90_getvfsstat(buf, bufsize, flags)      \
+  __sanitizer_syscall_pre_impl_compat_90_getvfsstat(                           \
       (long long)(buf), (long long)(bufsize), (long long)(flags))
-#define __sanitizer_syscall_post_getvfsstat(res, buf, bufsize, flags)          \
-  __sanitizer_syscall_post_impl_getvfsstat(                                    \
+#define __sanitizer_syscall_post_compat_90_getvfsstat(res, buf, bufsize,       \
+                                                      flags)                   \
+  __sanitizer_syscall_post_impl_compat_90_getvfsstat(                          \
       res, (long long)(buf), (long long)(bufsize), (long long)(flags))
-#define __sanitizer_syscall_pre_statvfs1(path, buf, flags)                     \
-  __sanitizer_syscall_pre_impl_statvfs1((long long)(path), (long long)(buf),   \
-                                        (long long)(flags))
-#define __sanitizer_syscall_post_statvfs1(res, path, buf, flags)               \
-  __sanitizer_syscall_post_impl_statvfs1(res, (long long)(path),               \
-                                         (long long)(buf), (long long)(flags))
-#define __sanitizer_syscall_pre_fstatvfs1(fd, buf, flags)                      \
-  __sanitizer_syscall_pre_impl_fstatvfs1((long long)(fd), (long long)(buf),    \
-                                         (long long)(flags))
-#define __sanitizer_syscall_post_fstatvfs1(res, fd, buf, flags)                \
-  __sanitizer_syscall_post_impl_fstatvfs1(                                     \
+#define __sanitizer_syscall_pre_compat_90_statvfs1(path, buf, flags)           \
+  __sanitizer_syscall_pre_impl_compat_90_statvfs1(                             \
+      (long long)(path), (long long)(buf), (long long)(flags))
+#define __sanitizer_syscall_post_compat_90_statvfs1(res, path, buf, flags)     \
+  __sanitizer_syscall_post_impl_compat_90_statvfs1(                            \
+      res, (long long)(path), (long long)(buf), (long long)(flags))
+#define __sanitizer_syscall_pre_compat_90_fstatvfs1(fd, buf, flags)            \
+  __sanitizer_syscall_pre_impl_compat_90_fstatvfs1(                            \
+      (long long)(fd), (long long)(buf), (long long)(flags))
+#define __sanitizer_syscall_post_compat_90_fstatvfs1(res, fd, buf, flags)      \
+  __sanitizer_syscall_post_impl_compat_90_fstatvfs1(                           \
       res, (long long)(fd), (long long)(buf), (long long)(flags))
 #define __sanitizer_syscall_pre_compat_30_fhstatvfs1(fhp, buf, flags)          \
   __sanitizer_syscall_pre_impl_compat_30_fhstatvfs1(                           \
 #define __sanitizer_syscall_post___fhopen40(res, fhp, fh_size, flags)          \
   __sanitizer_syscall_post_impl___fhopen40(                                    \
       res, (long long)(fhp), (long long)(fh_size), (long long)(flags))
-#define __sanitizer_syscall_pre___fhstatvfs140(fhp, fh_size, buf, flags)       \
-  __sanitizer_syscall_pre_impl___fhstatvfs140(                                 \
+#define __sanitizer_syscall_pre_compat_90_fhstatvfs1(fhp, fh_size, buf, flags) \
+  __sanitizer_syscall_pre_impl_compat_90_fhstatvfs1(                           \
       (long long)(fhp), (long long)(fh_size), (long long)(buf),                \
       (long long)(flags))
-#define __sanitizer_syscall_post___fhstatvfs140(res, fhp, fh_size, buf, flags) \
-  __sanitizer_syscall_post_impl___fhstatvfs140(                                \
+#define __sanitizer_syscall_post_compat_90_fhstatvfs1(res, fhp, fh_size, buf,  \
+                                                      flags)                   \
+  __sanitizer_syscall_post_impl_compat_90_fhstatvfs1(                          \
       res, (long long)(fhp), (long long)(fh_size), (long long)(buf),           \
       (long long)(flags))
 #define __sanitizer_syscall_pre_compat_50___fhstat40(fhp, fh_size, sb)         \
                                                       clock_id)                \
   __sanitizer_syscall_post_impl_clock_getcpuclockid2(                          \
       res, (long long)(idtype), (long long)(id), (long long)(clock_id))
+#define __sanitizer_syscall_pre___getvfsstat90(buf, bufsize, flags)            \
+  __sanitizer_syscall_pre_impl___getvfsstat90(                                 \
+      (long long)(buf), (long long)(bufsize), (long long)(flags))
+#define __sanitizer_syscall_post___getvfsstat90(res, buf, bufsize, flags)      \
+  __sanitizer_syscall_post_impl___getvfsstat90(                                \
+      res, (long long)(buf), (long long)(bufsize), (long long)(flags))
+#define __sanitizer_syscall_pre___statvfs190(path, buf, flags)                 \
+  __sanitizer_syscall_pre_impl___statvfs190(                                   \
+      (long long)(path), (long long)(buf), (long long)(flags))
+#define __sanitizer_syscall_post___statvfs190(res, path, buf, flags)           \
+  __sanitizer_syscall_post_impl___statvfs190(                                  \
+      res, (long long)(path), (long long)(buf), (long long)(flags))
+#define __sanitizer_syscall_pre___fstatvfs190(fd, buf, flags)                  \
+  __sanitizer_syscall_pre_impl___fstatvfs190(                                  \
+      (long long)(fd), (long long)(buf), (long long)(flags))
+#define __sanitizer_syscall_post___fstatvfs190(res, fd, buf, flags)            \
+  __sanitizer_syscall_post_impl___fstatvfs190(                                 \
+      res, (long long)(fd), (long long)(buf), (long long)(flags))
+#define __sanitizer_syscall_pre___fhstatvfs190(fhp, fh_size, buf, flags)       \
+  __sanitizer_syscall_pre_impl___fhstatvfs190(                                 \
+      (long long)(fhp), (long long)(fh_size), (long long)(buf),                \
+      (long long)(flags))
+#define __sanitizer_syscall_post___fhstatvfs190(res, fhp, fh_size, buf, flags) \
+  __sanitizer_syscall_post_impl___fhstatvfs190(                                \
+      res, (long long)(fhp), (long long)(fh_size), (long long)(buf),           \
+      (long long)(flags))
+
+/* Compat with older releases */
+#define __sanitizer_syscall_pre_getvfsstat                                     \
+  __sanitizer_syscall_pre_compat_90_getvfsstat
+#define __sanitizer_syscall_post_getvfsstat                                    \
+  __sanitizer_syscall_post_compat_90_getvfsstat
+
+#define __sanitizer_syscall_pre_statvfs1                                       \
+  __sanitizer_syscall_pre_compat_90_statvfs1
+#define __sanitizer_syscall_post_statvfs1                                      \
+  __sanitizer_syscall_post_compat_90_statvfs1
+
+#define __sanitizer_syscall_pre_fstatvfs1                                      \
+  __sanitizer_syscall_pre_compat_90_fstatvfs1
+#define __sanitizer_syscall_post_fstatvfs1                                     \
+  __sanitizer_syscall_post_compat_90_fstatvfs1
+
+#define __sanitizer_syscall_pre___fhstatvfs140                                 \
+  __sanitizer_syscall_pre_compat_90_fhstatvfs1
+#define __sanitizer_syscall_post___fhstatvfs140                                \
+  __sanitizer_syscall_post_compat_90_fhstatvfs1
 
 #ifdef __cplusplus
 extern "C" {
@@ -4066,19 +4115,27 @@ void __sanitizer_syscall_post_impl_fsync_range(long long res, long long fd,
 void __sanitizer_syscall_pre_impl_uuidgen(long long store, long long count);
 void __sanitizer_syscall_post_impl_uuidgen(long long res, long long store,
                                            long long count);
-void __sanitizer_syscall_pre_impl_getvfsstat(long long buf, long long bufsize,
-                                             long long flags);
-void __sanitizer_syscall_post_impl_getvfsstat(long long res, long long buf,
-                                              long long bufsize,
-                                              long long flags);
-void __sanitizer_syscall_pre_impl_statvfs1(long long path, long long buf,
-                                           long long flags);
-void __sanitizer_syscall_post_impl_statvfs1(long long res, long long path,
-                                            long long buf, long long flags);
-void __sanitizer_syscall_pre_impl_fstatvfs1(long long fd, long long buf,
-                                            long long flags);
-void __sanitizer_syscall_post_impl_fstatvfs1(long long res, long long fd,
-                                             long long buf, long long flags);
+void __sanitizer_syscall_pre_impl_compat_90_getvfsstat(long long buf,
+                                                       long long bufsize,
+                                                       long long flags);
+void __sanitizer_syscall_post_impl_compat_90_getvfsstat(long long res,
+                                                        long long buf,
+                                                        long long bufsize,
+                                                        long long flags);
+void __sanitizer_syscall_pre_impl_compat_90_statvfs1(long long path,
+                                                     long long buf,
+                                                     long long flags);
+void __sanitizer_syscall_post_impl_compat_90_statvfs1(long long res,
+                                                      long long path,
+                                                      long long buf,
+                                                      long long flags);
+void __sanitizer_syscall_pre_impl_compat_90_fstatvfs1(long long fd,
+                                                      long long buf,
+                                                      long long flags);
+void __sanitizer_syscall_post_impl_compat_90_fstatvfs1(long long res,
+                                                       long long fd,
+                                                       long long buf,
+                                                       long long flags);
 void __sanitizer_syscall_pre_impl_compat_30_fhstatvfs1(long long fhp,
                                                        long long buf,
                                                        long long flags);
@@ -4304,14 +4361,15 @@ void __sanitizer_syscall_pre_impl___fhopen40(long long fhp, long long fh_size,
 void __sanitizer_syscall_post_impl___fhopen40(long long res, long long fhp,
                                               long long fh_size,
                                               long long flags);
-void __sanitizer_syscall_pre_impl___fhstatvfs140(long long fhp,
-                                                 long long fh_size,
-                                                 long long buf,
-                                                 long long flags);
-void __sanitizer_syscall_post_impl___fhstatvfs140(long long res, long long fhp,
-                                                  long long fh_size,
-                                                  long long buf,
-                                                  long long flags);
+void __sanitizer_syscall_pre_impl_compat_90_fhstatvfs1(long long fhp,
+                                                       long long fh_size,
+                                                       long long buf,
+                                                       long long flags);
+void __sanitizer_syscall_post_impl_compat_90_fhstatvfs1(long long res,
+                                                        long long fhp,
+                                                        long long fh_size,
+                                                        long long buf,
+                                                        long long flags);
 void __sanitizer_syscall_pre_impl_compat_50___fhstat40(long long fhp,
                                                        long long fh_size,
                                                        long long sb);
@@ -4721,6 +4779,29 @@ void __sanitizer_syscall_post_impl_clock_getcpuclockid2(long long res,
                                                         long long idtype,
                                                         long long id,
                                                         long long clock_id);
+void __sanitizer_syscall_pre_impl___getvfsstat90(long long buf,
+                                                 long long bufsize,
+                                                 long long flags);
+void __sanitizer_syscall_post_impl___getvfsstat90(long long res, long long buf,
+                                                  long long bufsize,
+                                                  long long flags);
+void __sanitizer_syscall_pre_impl___statvfs190(long long path, long long buf,
+                                               long long flags);
+void __sanitizer_syscall_post_impl___statvfs190(long long res, long long path,
+                                                long long buf, long long flags);
+void __sanitizer_syscall_pre_impl___fstatvfs190(long long fd, long long buf,
+                                                long long flags);
+void __sanitizer_syscall_post_impl___fstatvfs190(long long res, long long fd,
+                                                 long long buf,
+                                                 long long flags);
+void __sanitizer_syscall_pre_impl___fhstatvfs190(long long fhp,
+                                                 long long fh_size,
+                                                 long long buf,
+                                                 long long flags);
+void __sanitizer_syscall_post_impl___fhstatvfs190(long long res, long long fhp,
+                                                  long long fh_size,
+                                                  long long buf,
+                                                  long long flags);
 
 #ifdef __cplusplus
 } // extern "C"
index 66a81ab350e5f9b979667cb6b4d7746a069277a4..d86c3921395cb2bcb8d263c4171b4fbba10b2ffd 100644 (file)
@@ -36,10 +36,17 @@ static const uptr kMaxAllowedMallocSize = 8UL << 30;
 
 static Allocator allocator;
 
+static uptr max_malloc_size;
+
 void InitializeAllocator() {
   SetAllocatorMayReturnNull(common_flags()->allocator_may_return_null);
   allocator.InitLinkerInitialized(
       common_flags()->allocator_release_to_os_interval_ms);
+  if (common_flags()->max_allocation_size_mb)
+    max_malloc_size = Min(common_flags()->max_allocation_size_mb << 20,
+                          kMaxAllowedMallocSize);
+  else
+    max_malloc_size = kMaxAllowedMallocSize;
 }
 
 void AllocatorThreadFinish() {
@@ -72,14 +79,14 @@ static void *ReportAllocationSizeTooBig(uptr size, const StackTrace &stack) {
     Report("WARNING: LeakSanitizer failed to allocate 0x%zx bytes\n", size);
     return nullptr;
   }
-  ReportAllocationSizeTooBig(size, kMaxAllowedMallocSize, &stack);
+  ReportAllocationSizeTooBig(size, max_malloc_size, &stack);
 }
 
 void *Allocate(const StackTrace &stack, uptr size, uptr alignment,
                bool cleared) {
   if (size == 0)
     size = 1;
-  if (size > kMaxAllowedMallocSize)
+  if (size > max_malloc_size)
     return ReportAllocationSizeTooBig(size, stack);
   void *p = allocator.Allocate(GetAllocatorCache(), size, alignment);
   if (UNLIKELY(!p)) {
@@ -117,7 +124,7 @@ void Deallocate(void *p) {
 void *Reallocate(const StackTrace &stack, void *p, uptr new_size,
                  uptr alignment) {
   RegisterDeallocation(p);
-  if (new_size > kMaxAllowedMallocSize) {
+  if (new_size > max_malloc_size) {
     allocator.Deallocate(GetAllocatorCache(), p);
     return ReportAllocationSizeTooBig(new_size, stack);
   }
index 2f74fbef260fdfaf146121477f3f38c371597a3f..dfa7bf3d196b5960c8e49da24dff47ca53bec014 100755 (executable)
@@ -8,13 +8,12 @@ VCS=${1:-svn}
 
 get_upstream() {
   rm -rf upstream
-  #cp -rf orig upstream
-  svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk upstream
+  git clone https://github.com/llvm/llvm-project.git upstream
 }
 
 get_current_rev() {
   cd upstream
-  svn info | grep Revision | grep -o '[0-9]*'
+  git rev-parse HEAD
 }
 
 list_files() {
@@ -85,6 +84,6 @@ rm -rf upstream
 cat << EOF > MERGE
 $CUR_REV
 
-The first line of this file holds the svn revision number of the
+The first line of this file holds the git revision number of the
 last merge done from the master library sources.
 EOF
index 7d592bdcb61fcefbe6d5d35b0dbab6354306024e..065258a5a6e1343ae2d433a024cb3eebb94def94 100644 (file)
@@ -132,6 +132,9 @@ COMMON_FLAG(uptr, soft_rss_limit_mb, 0,
             " until the RSS goes below the soft limit."
             " This limit does not affect memory allocations other than"
             " malloc/new.")
+COMMON_FLAG(uptr, max_allocation_size_mb, 0,
+            "If non-zero, malloc/new calls larger than this size will return "
+            "nullptr (or crash if allocator_may_return_null=false).")
 COMMON_FLAG(bool, heap_profile, false, "Experimental heap profiler, asan-only")
 COMMON_FLAG(s32, allocator_release_to_os_interval_ms,
             ((bool)SANITIZER_FUCHSIA || (bool)SANITIZER_WINDOWS) ? -1 : 5000,
index 0b53da6c349f281b302c98977f6b619f83e4ab04..3807a79b1cdb9f1922af9386380132ed9167ca40 100644 (file)
@@ -407,7 +407,10 @@ uptr internal_unlink(const char *path) {
 }
 
 uptr internal_rename(const char *oldpath, const char *newpath) {
-#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS || SANITIZER_OPENBSD
+#if defined(__riscv)
+  return internal_syscall(SYSCALL(renameat2), AT_FDCWD, (uptr)oldpath, AT_FDCWD,
+                          (uptr)newpath, 0);
+#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS || SANITIZER_OPENBSD
   return internal_syscall(SYSCALL(renameat), AT_FDCWD, (uptr)oldpath, AT_FDCWD,
                           (uptr)newpath);
 #else
@@ -1972,6 +1975,11 @@ static void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
 # endif
   *bp = ucontext->uc_mcontext.gregs[11];
   *sp = ucontext->uc_mcontext.gregs[15];
+#elif defined(__riscv)
+  ucontext_t *ucontext = (ucontext_t*)context;
+  *pc = ucontext->uc_mcontext.__gregs[REG_PC];
+  *bp = ucontext->uc_mcontext.__gregs[REG_S0];
+  *sp = ucontext->uc_mcontext.__gregs[REG_SP];
 #else
 # error "Unsupported arch"
 #endif
index e09d568d8024863f7d97861cb2d9e246740083a5..cd503718205a18807445b65c126296005d3ecd77 100644 (file)
@@ -698,13 +698,9 @@ u32 GetNumberOfCPUs() {
 #elif SANITIZER_SOLARIS
   return sysconf(_SC_NPROCESSORS_ONLN);
 #else
-#if defined(CPU_COUNT)
   cpu_set_t CPUs;
   CHECK_EQ(sched_getaffinity(0, sizeof(cpu_set_t), &CPUs), 0);
   return CPU_COUNT(&CPUs);
-#else
-  return 1;
-#endif
 #endif
 }
 
index b971ad058e9f6d8cf78defe7eb130f6b9cf66273..ea4bd02aa92e4580bcf4f1c49a540722d70af9b7 100644 (file)
@@ -37,7 +37,7 @@
 extern char **environ;
 #endif
 
-#if defined(__has_include) && __has_include(<os/trace.h>) && defined(__BLOCKS__)
+#if defined(__has_include) && __has_include(<os/trace.h>)
 #define SANITIZER_OS_TRACE 1
 #include <os/trace.h>
 #else
index b45c975358db76409186cafd5bdbf49c936462f9..c68bfa25875585818721029b099bd4da4cddcb78 100644 (file)
 #define SANITIZER_SIGN_EXTENDED_ADDRESSES 0
 #endif
 
-// The AArch64 linux port uses the canonical syscall set as mandated by
-// the upstream linux community for all new ports. Other ports may still
-// use legacy syscalls.
+// The AArch64 and RISC-V linux ports use the canonical syscall set as
+// mandated by the upstream linux community for all new ports. Other ports
+// may still use legacy syscalls.
 #ifndef SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
-# if defined(__aarch64__) && SANITIZER_LINUX
+# if (defined(__aarch64__) || defined(__riscv)) && SANITIZER_LINUX
 # define SANITIZER_USES_CANONICAL_LINUX_SYSCALLS 1
 # else
 # define SANITIZER_USES_CANONICAL_LINUX_SYSCALLS 0
index 7c1a21d6ccb322a9e4016ea5decc6b4b68937865..c51327e1269e081cb0e231b75cbce71b62601e88 100644 (file)
 
 // With old kernels (and even new kernels on powerpc) asm/stat.h uses types that
 // are not defined anywhere in userspace headers. Fake them. This seems to work
-// fine with newer headers, too.  Beware that with <sys/stat.h>, struct stat
-// takes the form of struct stat64 on 32-bit platforms if _FILE_OFFSET_BITS=64.
-// Also, for some platforms (e.g. mips) there are additional members in the
-// <sys/stat.h> struct stat:s.
+// fine with newer headers, too.
 #include <linux/posix_types.h>
-#if defined(__x86_64__)
+#if defined(__x86_64__) ||  defined(__mips__)
 #include <sys/stat.h>
 #else
 #define ino_t __kernel_ino_t
@@ -68,7 +65,7 @@ namespace __sanitizer {
 
 #if !defined(__powerpc64__) && !defined(__x86_64__) && !defined(__aarch64__)\
                             && !defined(__mips__) && !defined(__s390__)\
-                            && !defined(__sparc__)
+                            && !defined(__sparc__) && !defined(__riscv)
 COMPILER_CHECK(struct___old_kernel_stat_sz == sizeof(struct __old_kernel_stat));
 #endif
 
index 4fb3b8c0e06f1b268e4a09059d97d7fb0bb3df82..419d830c69efe70039b59f50b212fe21bb792371 100644 (file)
@@ -354,7 +354,13 @@ struct __sanitizer_addrinfo {
   int ai_family;
   int ai_socktype;
   int ai_protocol;
+#if defined(__sparc__) && defined(_LP64)
+  int __ai_pad0;
+#endif
   unsigned ai_addrlen;
+#if defined(__alpha__) || (defined(__i386__) && defined(_LP64))
+  int __ai_pad0;
+#endif
   char *ai_canonname;
   void *ai_addr;
   struct __sanitizer_addrinfo *ai_next;
index 9852e6ba78794ea81958bbdfad8625e3dd67f477..b4f8f67b664c7b67ea348f04b85eb99230cac73a 100644 (file)
@@ -230,7 +230,7 @@ namespace __sanitizer {
   // has been removed from glibc 2.28.
 #if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
   || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
-  || defined(__x86_64__)
+  || defined(__x86_64__) || (defined(__riscv) && __riscv_xlen == 64)
 #define SIZEOF_STRUCT_USTAT 32
 #elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
   || defined(__powerpc__) || defined(__s390__) || defined(__sparc__)
index 738bc3fd721689b5f84eab01c0355e2be3e56c52..7789bc5887a470456e501f36755e31702b220070 100644 (file)
@@ -82,7 +82,7 @@ const unsigned struct_kernel_stat64_sz = 104;
 #elif defined(__mips__)
 const unsigned struct_kernel_stat_sz = SANITIZER_ANDROID
                                            ? FIRST_32_SECOND_64(104, 128)
-                                           : FIRST_32_SECOND_64(144, 216);
+                                           : FIRST_32_SECOND_64(160, 216);
 const unsigned struct_kernel_stat64_sz = 104;
 #elif defined(__s390__) && !defined(__s390x__)
 const unsigned struct_kernel_stat_sz = 64;
@@ -98,6 +98,9 @@ const unsigned struct_kernel_stat64_sz = 144;
 const unsigned struct___old_kernel_stat_sz = 0;
 const unsigned struct_kernel_stat_sz = 64;
 const unsigned struct_kernel_stat64_sz = 104;
+#elif defined(__riscv) && __riscv_xlen == 64
+const unsigned struct_kernel_stat_sz = 128;
+const unsigned struct_kernel_stat64_sz = 104;
 #endif
 struct __sanitizer_perf_event_attr {
   unsigned type;
index ce75cbe5d265094329e3f770e5f0ed19b9a455f4..ef14fb704eed394acf0be36505eaae5f952fa6d2 100644 (file)
@@ -60,8 +60,8 @@ static inline uhwptr *GetCanonicFrame(uptr bp,
   // Nope, this does not look right either. This means the frame after next does
   // not have a valid frame pointer, but we can still extract the caller PC.
   // Unfortunately, there is no way to decide between GCC and LLVM frame
-  // layouts. Assume GCC.
-  return bp_prev - 1;
+  // layouts. Assume LLVM.
+  return bp_prev;
 #else
   return (uhwptr*)bp;
 #endif
@@ -84,21 +84,14 @@ void BufferedStackTrace::UnwindFast(uptr pc, uptr bp, uptr stack_top,
          IsAligned((uptr)frame, sizeof(*frame)) &&
          size < max_depth) {
 #ifdef __powerpc__
-    // PowerPC ABIs specify that the return address is saved on the
-    // *caller's* stack frame.  Thus we must dereference the back chain
-    // to find the caller frame before extracting it.
+    // PowerPC ABIs specify that the return address is saved at offset
+    // 16 of the *caller's* stack frame.  Thus we must dereference the
+    // back chain to find the caller frame before extracting it.
     uhwptr *caller_frame = (uhwptr*)frame[0];
     if (!IsValidFrame((uptr)caller_frame, stack_top, bottom) ||
         !IsAligned((uptr)caller_frame, sizeof(uhwptr)))
       break;
-    // For most ABIs the offset where the return address is saved is two
-    // register sizes.  The exception is the SVR4 ABI, which uses an
-    // offset of only one register size.
-#ifdef _CALL_SYSV
-    uhwptr pc1 = caller_frame[1];
-#else
     uhwptr pc1 = caller_frame[2];
-#endif
 #elif defined(__s390__)
     uhwptr pc1 = frame[14];
 #else
index 21b521669630698f0dbf4de0fa44d59c275e64ac..69e59871874133a33420165c9062be2b78217c0a 100644 (file)
@@ -42,8 +42,8 @@
 // DO NOT EDIT! THIS FILE HAS BEEN GENERATED!
 //
 // Generated with: generate_netbsd_syscalls.awk
-// Generated date: 2018-10-30
-// Generated from: syscalls.master,v 1.293 2018/07/31 13:00:13 rjs Exp
+// Generated date: 2019-11-01
+// Generated from: syscalls.master,v 1.296 2019/09/22 22:59:39 christos Exp
 //
 //===----------------------------------------------------------------------===//
 
@@ -2433,30 +2433,31 @@ PRE_SYSCALL(uuidgen)(void *store_, long long count_) { /* Nothing to do */ }
 POST_SYSCALL(uuidgen)(long long res, void *store_, long long count_) {
   /* Nothing to do */
 }
-PRE_SYSCALL(getvfsstat)(void *buf_, long long bufsize_, long long flags_) {
+PRE_SYSCALL(compat_90_getvfsstat)
+(void *buf_, long long bufsize_, long long flags_) {
   /* Nothing to do */
 }
-POST_SYSCALL(getvfsstat)
+POST_SYSCALL(compat_90_getvfsstat)
 (long long res, void *buf_, long long bufsize_, long long flags_) {
   /* Nothing to do */
 }
-PRE_SYSCALL(statvfs1)(void *path_, void *buf_, long long flags_) {
+PRE_SYSCALL(compat_90_statvfs1)(void *path_, void *buf_, long long flags_) {
   const char *path = (const char *)path_;
   if (path) {
     PRE_READ(path, __sanitizer::internal_strlen(path) + 1);
   }
 }
-POST_SYSCALL(statvfs1)
+POST_SYSCALL(compat_90_statvfs1)
 (long long res, void *path_, void *buf_, long long flags_) {
   const char *path = (const char *)path_;
   if (path) {
     POST_READ(path, __sanitizer::internal_strlen(path) + 1);
   }
 }
-PRE_SYSCALL(fstatvfs1)(long long fd_, void *buf_, long long flags_) {
+PRE_SYSCALL(compat_90_fstatvfs1)(long long fd_, void *buf_, long long flags_) {
   /* Nothing to do */
 }
-POST_SYSCALL(fstatvfs1)
+POST_SYSCALL(compat_90_fstatvfs1)
 (long long res, long long fd_, void *buf_, long long flags_) {
   /* Nothing to do */
 }
@@ -2853,13 +2854,13 @@ PRE_SYSCALL(__fhopen40)(void *fhp_, long long fh_size_, long long flags_) {
 }
 POST_SYSCALL(__fhopen40)
 (long long res, void *fhp_, long long fh_size_, long long flags_) {}
-PRE_SYSCALL(__fhstatvfs140)
+PRE_SYSCALL(compat_90_fhstatvfs1)
 (void *fhp_, long long fh_size_, void *buf_, long long flags_) {
   if (fhp_) {
     PRE_READ(fhp_, fh_size_);
   }
 }
-POST_SYSCALL(__fhstatvfs140)
+POST_SYSCALL(compat_90_fhstatvfs1)
 (long long res, void *fhp_, long long fh_size_, void *buf_, long long flags_) {}
 PRE_SYSCALL(compat_50___fhstat40)(void *fhp_, long long fh_size_, void *sb_) {
   if (fhp_) {
@@ -3768,6 +3769,41 @@ POST_SYSCALL(clock_getcpuclockid2)
 (long long res, long long idtype_, long long id_, void *clock_id_) {
   /* Nothing to do */
 }
+PRE_SYSCALL(__getvfsstat90)(void *buf_, long long bufsize_, long long flags_) {
+  /* Nothing to do */
+}
+POST_SYSCALL(__getvfsstat90)
+(long long res, void *buf_, long long bufsize_, long long flags_) {
+  /* Nothing to do */
+}
+PRE_SYSCALL(__statvfs190)(void *path_, void *buf_, long long flags_) {
+  const char *path = (const char *)path_;
+  if (path) {
+    PRE_READ(path, __sanitizer::internal_strlen(path) + 1);
+  }
+}
+POST_SYSCALL(__statvfs190)
+(long long res, void *path_, void *buf_, long long flags_) {
+  const char *path = (const char *)path_;
+  if (path) {
+    POST_READ(path, __sanitizer::internal_strlen(path) + 1);
+  }
+}
+PRE_SYSCALL(__fstatvfs190)(long long fd_, void *buf_, long long flags_) {
+  /* Nothing to do */
+}
+POST_SYSCALL(__fstatvfs190)
+(long long res, long long fd_, void *buf_, long long flags_) {
+  /* Nothing to do */
+}
+PRE_SYSCALL(__fhstatvfs190)
+(void *fhp_, long long fh_size_, void *buf_, long long flags_) {
+  if (fhp_) {
+    PRE_READ(fhp_, fh_size_);
+  }
+}
+POST_SYSCALL(__fhstatvfs190)
+(long long res, void *fhp_, long long fh_size_, void *buf_, long long flags_) {}
 #undef SYS_MAXSYSARGS
 } // extern "C"
 
index 1b2c0549d39990d6260c7940cdc3f791103086d3..743e67bf2f7d96f910d46efd888a8b9130d264b8 100644 (file)
@@ -113,9 +113,16 @@ ScopedGlobalProcessor::~ScopedGlobalProcessor() {
   gp->mtx.Unlock();
 }
 
+static constexpr uptr kMaxAllowedMallocSize = 1ull << 40;
+static uptr max_user_defined_malloc_size;
+
 void InitializeAllocator() {
   SetAllocatorMayReturnNull(common_flags()->allocator_may_return_null);
   allocator()->Init(common_flags()->allocator_release_to_os_interval_ms);
+  max_user_defined_malloc_size = common_flags()->max_allocation_size_mb
+                                     ? common_flags()->max_allocation_size_mb
+                                           << 20
+                                     : kMaxAllowedMallocSize;
 }
 
 void InitializeAllocatorLate() {
@@ -150,15 +157,17 @@ static void SignalUnsafeCall(ThreadState *thr, uptr pc) {
   OutputReport(thr, rep);
 }
 
-static constexpr uptr kMaxAllowedMallocSize = 1ull << 40;
 
 void *user_alloc_internal(ThreadState *thr, uptr pc, uptr sz, uptr align,
                           bool signal) {
-  if (sz >= kMaxAllowedMallocSize || align >= kMaxAllowedMallocSize) {
+  if (sz >= kMaxAllowedMallocSize || align >= kMaxAllowedMallocSize ||
+      sz > max_user_defined_malloc_size) {
     if (AllocatorMayReturnNull())
       return nullptr;
+    uptr malloc_limit =
+        Min(kMaxAllowedMallocSize, max_user_defined_malloc_size);
     GET_STACK_TRACE_FATAL(thr, pc);
-    ReportAllocationSizeTooBig(sz, kMaxAllowedMallocSize, &stack);
+    ReportAllocationSizeTooBig(sz, malloc_limit, &stack);
   }
   void *p = allocator()->Allocate(&thr->proc()->alloc_cache, sz, align);
   if (UNLIKELY(!p)) {
index 9e533a71a9c477ecae59f09ab431b2664554d998..8285e21aa1ec7a797dfcf4840ee5a7851106b497 100644 (file)
@@ -1,6 +1,5 @@
 #include "tsan_ppc_regs.h"
 
-        .machine altivec
         .section .text
         .hidden __tsan_setjmp
         .globl _setjmp
index 80de2a6d10169c2f58bc855ef11918bca3f58981..721c2273f133a3b4f7158b7e7297d7e9078eaffa 100644 (file)
@@ -54,7 +54,6 @@ void InitializeFlags() {
   {
     CommonFlags cf;
     cf.CopyFrom(*common_flags());
-    cf.print_summary = false;
     cf.external_symbolizer_path = GetFlag("UBSAN_SYMBOLIZER_PATH");
     OverrideCommonFlags(cf);
   }
index 0ddbb50c26cc3da00980867be7811ab5e3f41a1b..3f9da75a12a8d34386977ba9e959eda2af27f298 100644 (file)
@@ -819,21 +819,6 @@ void __ubsan_handle_cfi_bad_type(CFICheckFailData *Data, ValueHandle Vtable,
 
 }  // namespace __ubsan
 
-void __ubsan::__ubsan_handle_cfi_bad_icall(CFIBadIcallData *CallData,
-                                           ValueHandle Function) {
-  GET_REPORT_OPTIONS(false);
-  CFICheckFailData Data = {CFITCK_ICall, CallData->Loc, CallData->Type};
-  handleCFIBadIcall(&Data, Function, Opts);
-}
-
-void __ubsan::__ubsan_handle_cfi_bad_icall_abort(CFIBadIcallData *CallData,
-                                                 ValueHandle Function) {
-  GET_REPORT_OPTIONS(true);
-  CFICheckFailData Data = {CFITCK_ICall, CallData->Loc, CallData->Type};
-  handleCFIBadIcall(&Data, Function, Opts);
-  Die();
-}
-
 void __ubsan::__ubsan_handle_cfi_check_fail(CFICheckFailData *Data,
                                             ValueHandle Value,
                                             uptr ValidVtable) {
index eba1cf918fc34796fdaaf0d458984e197758e43c..22ca96422381c104798588f64c5ae370f3ef2f07 100644 (file)
@@ -207,20 +207,12 @@ enum CFITypeCheckKind : unsigned char {
   CFITCK_VMFCall,
 };
 
-struct CFIBadIcallData {
-  SourceLocation Loc;
-  const TypeDescriptor &Type;
-};
-
 struct CFICheckFailData {
   CFITypeCheckKind CheckKind;
   SourceLocation Loc;
   const TypeDescriptor &Type;
 };
 
-/// \brief Handle control flow integrity failure for indirect function calls.
-RECOVERABLE(cfi_bad_icall, CFIBadIcallData *Data, ValueHandle Function)
-
 /// \brief Handle control flow integrity failures.
 RECOVERABLE(cfi_check_fail, CFICheckFailData *Data, ValueHandle Function,
             uptr VtableIsValid)
index 58aabbe67b5c25e0b47b03a848182691de2252a7..71d7fb18c9b3a5e94039e3843113050f31fa1c9f 100644 (file)
@@ -12,7 +12,6 @@
 #ifndef UBSAN_PLATFORM_H
 #define UBSAN_PLATFORM_H
 
-#ifndef CAN_SANITIZE_UB
 // Other platforms should be easy to add, and probably work as-is.
 #if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) ||        \
     defined(__NetBSD__) || defined(__OpenBSD__) || \
@@ -22,6 +21,5 @@
 #else
 # define CAN_SANITIZE_UB 0
 #endif
-#endif //CAN_SANITIZE_UB
 
 #endif