Ignore:
Timestamp:
Dec 7, 2015, 1:35:02 PM (10 years ago)
Author:
[email protected]
Message:

Crashes on PPC64 due to mprotect() on address not aligned to the page size
https://bugs.webkit.org/show_bug.cgi?id=130237

Reviewed by Mark Lam.

Make sure that commitSize is at least as big as the page size.

  • interpreter/JSStack.cpp:

(JSC::commitSize):
(JSC::JSStack::JSStack):
(JSC::JSStack::growSlowCase):

  • interpreter/JSStack.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/JSStack.cpp

    r189515 r193648  
    4141static size_t committedBytesCount = 0;
    4242
     43static size_t commitSize()
     44{
     45    static size_t size = 0;
     46    if (!size)
     47        size = std::max(16 * 1024, getpagesize());
     48    return size;
     49}
     50
    4351static StaticLock stackStatisticsMutex;
    4452#endif // !ENABLE(JIT)
     
    5664    ASSERT(capacity && isPageAligned(capacity));
    5765
    58     m_reservation = PageReservation::reserve(WTF::roundUpToMultipleOf(commitSize, capacity), OSAllocator::JSVMStackPages);
     66    m_reservation = PageReservation::reserve(WTF::roundUpToMultipleOf(commitSize(), capacity), OSAllocator::JSVMStackPages);
    5967    setStackLimit(highAddress());
    6068    m_commitTop = highAddress();
     
    9098    // return false.
    9199    ptrdiff_t delta = reinterpret_cast<char*>(m_commitTop) - reinterpret_cast<char*>(newTopOfStackWithReservedZone);
    92     delta = WTF::roundUpToMultipleOf(commitSize, delta);
     100    delta = WTF::roundUpToMultipleOf(commitSize(), delta);
    93101    Register* newCommitTop = m_commitTop - (delta / sizeof(Register));
    94102    if (newCommitTop < reservationTop())
Note: See TracChangeset for help on using the changeset viewer.