Changeset 193648 in webkit


Ignore:
Timestamp:
Dec 7, 2015 1:35:02 PM (8 years ago)
Author:
berto@igalia.com
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:
Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r193640 r193648  
     12015-12-07  Alberto Garcia  <berto@igalia.com>
     2
     3        Crashes on PPC64 due to mprotect() on address not aligned to the page size
     4        https://bugs.webkit.org/show_bug.cgi?id=130237
     5
     6        Reviewed by Mark Lam.
     7
     8        Make sure that commitSize is at least as big as the page size.
     9
     10        * interpreter/JSStack.cpp:
     11        (JSC::commitSize):
     12        (JSC::JSStack::JSStack):
     13        (JSC::JSStack::growSlowCase):
     14        * interpreter/JSStack.h:
     15
    1162015-12-06  Filip Pizlo  <fpizlo@apple.com>
    217
  • 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())
  • trunk/Source/JavaScriptCore/interpreter/JSStack.h

    r189515 r193648  
    6868        };
    6969
    70         static const size_t commitSize = 16 * 1024;
    7170        // Allow 8k of excess registers before we start trying to reap the stack
    7271        static const ptrdiff_t maxExcessCapacity = 8 * 1024;
Note: See TracChangeset for help on using the changeset viewer.