Changeset 249613 in webkit
- Timestamp:
- Sep 7, 2019, 8:01:31 AM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r249612 r249613 1 2019-09-07 Mark Lam <mark.lam@apple.com> 2 3 performJITMemcpy() source buffer should not be in the Gigacage. 4 https://bugs.webkit.org/show_bug.cgi?id=201577 5 <rdar://problem/55142606> 6 7 Reviewed by Michael Saboff. 8 9 Add a RELEASE_ASSERT in performJITMemcpy() to ensure that the passed in source 10 buffer is not in the Gigacage. 11 12 * jit/ExecutableAllocator.h: 13 (JSC::performJITMemcpy): 14 1 15 2019-09-07 Mark Lam <mark.lam@apple.com> 2 16 -
trunk/Source/JavaScriptCore/jit/ExecutableAllocator.h
r249449 r249613 32 32 #include <limits> 33 33 #include <wtf/Assertions.h> 34 #include <wtf/Gigacage.h> 34 35 #include <wtf/Lock.h> 35 36 #include <wtf/MetaAllocatorHandle.h> … … 125 126 static ALWAYS_INLINE void* performJITMemcpy(void *dst, const void *src, size_t n) 126 127 { 128 RELEASE_ASSERT(!Gigacage::contains(src)); 127 129 #if CPU(ARM64) 128 130 static constexpr size_t instructionSize = sizeof(unsigned); -
trunk/Source/WTF/ChangeLog
r249608 r249613 1 2019-09-07 Mark Lam <mark.lam@apple.com> 2 3 performJITMemcpy() source buffer should not be in the Gigacage. 4 https://bugs.webkit.org/show_bug.cgi?id=201577 5 <rdar://problem/55142606> 6 7 Reviewed by Michael Saboff. 8 9 * wtf/Gigacage.h: 10 (Gigacage::contains): 11 1 12 2019-09-06 Mark Lam <mark.lam@apple.com> 2 13 -
trunk/Source/WTF/wtf/Gigacage.h
r249608 r249613 70 70 } 71 71 72 ALWAYS_INLINE bool contains(const void*) { return false; } 72 73 ALWAYS_INLINE bool isEnabled(Kind) { return false; } 73 74 ALWAYS_INLINE size_t mask(Kind) { return 0; } -
trunk/Source/bmalloc/ChangeLog
r249608 r249613 1 2019-09-07 Mark Lam <mark.lam@apple.com> 2 3 performJITMemcpy() source buffer should not be in the Gigacage. 4 https://bugs.webkit.org/show_bug.cgi?id=201577 5 <rdar://problem/55142606> 6 7 Reviewed by Michael Saboff. 8 9 1. Add the Gigacage start address and totalSize to the Config. 10 2. Add a contains() function that uses the start address and totalSize to check 11 if a given pointer is in the Gigacage's address range. 12 13 * bmalloc/Gigacage.cpp: 14 (Gigacage::ensureGigacage): 15 (Gigacage::verifyGigacageIsEnabled): 16 * bmalloc/Gigacage.h: 17 (Gigacage::contains): 18 1 19 2019-09-06 Mark Lam <mark.lam@apple.com> 2 20 -
trunk/Source/bmalloc/bmalloc/Gigacage.cpp
r249608 r249613 78 78 // bounds, the access is guaranteed to land somewhere else in the cage or inside the runway. 79 79 // If this were less than 32GB, those OOB accesses could reach outside of the cage. 80 constexpr size_t gigacageRunway = 32llu * 1024 * 1024 * 1024;80 constexpr size_t gigacageRunway = 32llu * bmalloc::Sizes::GB; 81 81 82 82 alignas(configSizeToProtect) Config g_gigacageConfig; … … 233 233 } 234 234 } 235 235 236 g_gigacageConfig.start = base; 237 g_gigacageConfig.totalSize = totalSize; 236 238 vmDeallocatePhysicalPages(base, totalSize); 237 239 g_gigacageConfig.isEnabled = true; … … 297 299 for (size_t i = 0; i < NumberOfKinds; ++i) 298 300 isEnabled = isEnabled && g_gigacageConfig.basePtrs[i]; 301 isEnabled = isEnabled && g_gigacageConfig.start; 302 isEnabled = isEnabled && g_gigacageConfig.totalSize; 299 303 return isEnabled; 300 304 } -
trunk/Source/bmalloc/bmalloc/Gigacage.h
r249608 r249613 129 129 bool ensureGigacageHasBeenCalled; 130 130 131 void* start; 132 size_t totalSize; 131 133 void* basePtrs[NumberOfKinds]; 132 134 }; … … 231 233 } 232 234 235 BINLINE bool contains(const void* ptr) 236 { 237 auto* start = reinterpret_cast<const uint8_t*>(g_gigacageConfig.start); 238 auto* p = reinterpret_cast<const uint8_t*>(ptr); 239 return static_cast<size_t>(p - start) < g_gigacageConfig.totalSize; 240 } 241 233 242 BEXPORT bool shouldBeEnabled(); 234 243 … … 243 252 BINLINE size_t size(Kind) { BCRASH(); return 0; } 244 253 BINLINE void ensureGigacage() { } 254 BINLINE bool contains(const void*) { return false; } 245 255 BINLINE bool isEnabled() { return false; } 246 256 BINLINE bool isCaged(Kind, const void*) { return true; }
Note:
See TracChangeset
for help on using the changeset viewer.