Verify that tryLargeZeroedMemalignVirtual()'s aligned size and alignment values are...
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2018 00:13:21 +0000 (00:13 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2018 00:13:21 +0000 (00:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=192682
<rdar://problem/37751522>

Reviewed by Saam Barati.

* bmalloc/bmalloc.cpp:
(bmalloc::api::tryLargeZeroedMemalignVirtual):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239185 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/bmalloc/ChangeLog
Source/bmalloc/bmalloc/bmalloc.cpp

index 9fef771..dceb4fb 100644 (file)
@@ -1,3 +1,14 @@
+2018-12-13  Mark Lam  <mark.lam@apple.com>
+
+        Verify that tryLargeZeroedMemalignVirtual()'s aligned size and alignment values are valid.
+        https://bugs.webkit.org/show_bug.cgi?id=192682
+        <rdar://problem/37751522>
+
+        Reviewed by Saam Barati.
+
+        * bmalloc/bmalloc.cpp:
+        (bmalloc::api::tryLargeZeroedMemalignVirtual):
+
 2018-11-21  Dominik Infuehr  <dinfuehr@igalia.com>
 
         Enable JIT on ARM/Linux
index 1e5efb9..620dbfc 100644 (file)
@@ -39,13 +39,15 @@ void freeOutOfLine(void* object, HeapKind kind)
     free(object, kind);
 }
 
-void* tryLargeZeroedMemalignVirtual(size_t alignment, size_t size, HeapKind kind)
+void* tryLargeZeroedMemalignVirtual(size_t requiredAlignment, size_t requestedSize, HeapKind kind)
 {
-    BASSERT(isPowerOfTwo(alignment));
+    RELEASE_BASSERT(isPowerOfTwo(requiredAlignment));
 
     size_t pageSize = vmPageSize();
-    alignment = roundUpToMultipleOf(pageSize, alignment);
-    size = roundUpToMultipleOf(pageSize, size);
+    size_t alignment = roundUpToMultipleOf(pageSize, requiredAlignment);
+    size_t size = roundUpToMultipleOf(pageSize, requestedSize);
+    RELEASE_BASSERT(alignment >= requiredAlignment);
+    RELEASE_BASSERT(size >= requestedSize);
 
     kind = mapToActiveHeapKind(kind);
     Heap& heap = PerProcess<PerHeapKind<Heap>>::get()->at(kind);