Changeset 207646 in webkit
- Timestamp:
- Oct 20, 2016, 5:15:31 PM (8 years ago)
- Location:
- trunk/Source/bmalloc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/bmalloc/ChangeLog
r206380 r207646 1 2016-10-20 Mark Lam <mark.lam@apple.com> 2 3 bmalloc api should crash on failure to allocate when !isBmallocEnabled. 4 https://bugs.webkit.org/show_bug.cgi?id=163766 5 6 Reviewed by Keith Miller and Filip Pizlo. 7 8 We want to crash in bmalloc on failure to allocate even when !isBmallocEnabled. 9 This is so that failures to allocate memory will manifest as crashes with a 10 unique signature (i.e. as a SIGTRAP on release builds, or as a write to illegal 11 address 0xbbadbeef on debug builds) and the crash will manifest inside bmalloc. 12 This distinguishes allocation failures from other crashing bugs that manifest as 13 SIGSEGVs due to random pointer dereferences in the clients of bmalloc. 14 15 * bmalloc/Allocator.cpp: 16 (bmalloc::Allocator::allocateImpl): 17 (bmalloc::Allocator::reallocate): 18 (bmalloc::Allocator::allocateSlowCase): 19 1 20 2016-09-26 Yoshiaki Jitsukawa <Yoshiaki.Jitsukawa@sony.com> 2 21 -
trunk/Source/bmalloc/bmalloc/Allocator.cpp
r205462 r207646 81 81 if (!m_isBmallocEnabled) { 82 82 void* result = nullptr; 83 if (posix_memalign(&result, alignment, size)) 83 if (posix_memalign(&result, alignment, size)) { 84 if (crashOnFailure) 85 BCRASH(); 84 86 return nullptr; 87 } 85 88 return result; 86 89 } … … 101 104 void* Allocator::reallocate(void* object, size_t newSize) 102 105 { 103 if (!m_isBmallocEnabled) 104 return realloc(object, newSize); 106 if (!m_isBmallocEnabled) { 107 void* result = realloc(object, newSize); 108 if (!result) 109 BCRASH(); 110 return result; 111 } 105 112 106 113 size_t oldSize = 0; … … 187 194 void* Allocator::allocateSlowCase(size_t size) 188 195 { 189 if (!m_isBmallocEnabled) 190 return malloc(size); 196 if (!m_isBmallocEnabled) { 197 void* result = malloc(size); 198 if (!result) 199 BCRASH(); 200 return result; 201 } 191 202 192 203 if (size <= maskSizeClassMax) {
Note:
See TracChangeset
for help on using the changeset viewer.