[compiler-rt] r322793 - [Sanitizers] Changes in Hwasan allocator missed in D42198.

Alex Shlyapnikov via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 17 16:23:46 PST 2018


Author: alekseyshl
Date: Wed Jan 17 16:23:46 2018
New Revision: 322793

URL: http://llvm.org/viewvc/llvm-project?rev=322793&view=rev
Log:
[Sanitizers] Changes in Hwasan allocator missed in D42198.

Converting a few failure handler calls missed in D42198.

Modified:
    compiler-rt/trunk/lib/hwasan/hwasan_allocator.cc

Modified: compiler-rt/trunk/lib/hwasan/hwasan_allocator.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/hwasan/hwasan_allocator.cc?rev=322793&r1=322792&r2=322793&view=diff
==============================================================================
--- compiler-rt/trunk/lib/hwasan/hwasan_allocator.cc (original)
+++ compiler-rt/trunk/lib/hwasan/hwasan_allocator.cc Wed Jan 17 16:23:46 2018
@@ -247,7 +247,7 @@ void *hwasan_malloc(uptr size, StackTrac
 
 void *hwasan_calloc(uptr nmemb, uptr size, StackTrace *stack) {
   if (UNLIKELY(CheckForCallocOverflow(size, nmemb)))
-    return SetErrnoOnNull(Allocator::FailureHandler::OnBadRequest());
+    return SetErrnoOnNull(ReturnNullOrDieOnFailure::OnBadRequest());
   return SetErrnoOnNull(HwasanAllocate(stack, nmemb * size, sizeof(u64), true));
 }
 
@@ -269,7 +269,7 @@ void *hwasan_pvalloc(uptr size, StackTra
   uptr PageSize = GetPageSizeCached();
   if (UNLIKELY(CheckForPvallocOverflow(size, PageSize))) {
     errno = errno_ENOMEM;
-    return Allocator::FailureHandler::OnBadRequest();
+    return ReturnNullOrDieOnFailure::OnBadRequest();
   }
   // pvalloc(0) should allocate one page.
   size = size ? RoundUpTo(size, PageSize) : PageSize;
@@ -279,7 +279,7 @@ void *hwasan_pvalloc(uptr size, StackTra
 void *hwasan_aligned_alloc(uptr alignment, uptr size, StackTrace *stack) {
   if (UNLIKELY(!CheckAlignedAllocAlignmentAndSize(alignment, size))) {
     errno = errno_EINVAL;
-    return Allocator::FailureHandler::OnBadRequest();
+    return ReturnNullOrDieOnFailure::OnBadRequest();
   }
   return SetErrnoOnNull(HwasanAllocate(stack, size, alignment, false));
 }
@@ -287,7 +287,7 @@ void *hwasan_aligned_alloc(uptr alignmen
 void *hwasan_memalign(uptr alignment, uptr size, StackTrace *stack) {
   if (UNLIKELY(!IsPowerOfTwo(alignment))) {
     errno = errno_EINVAL;
-    return Allocator::FailureHandler::OnBadRequest();
+    return ReturnNullOrDieOnFailure::OnBadRequest();
   }
   return SetErrnoOnNull(HwasanAllocate(stack, size, alignment, false));
 }
@@ -295,7 +295,7 @@ void *hwasan_memalign(uptr alignment, up
 int hwasan_posix_memalign(void **memptr, uptr alignment, uptr size,
                         StackTrace *stack) {
   if (UNLIKELY(!CheckPosixMemalignAlignment(alignment))) {
-    Allocator::FailureHandler::OnBadRequest();
+    ReturnNullOrDieOnFailure::OnBadRequest();
     return errno_EINVAL;
   }
   void *ptr = HwasanAllocate(stack, size, alignment, false);




More information about the llvm-commits mailing list