Changeset 237059 in webkit


Ignore:
Timestamp:
Oct 11, 2018, 6:32:19 PM (6 years ago)
Author:
yusukesuzuki@slowstart.org
Message:

Use currentStackPointer more
https://bugs.webkit.org/show_bug.cgi?id=190503

Reviewed by Saam Barati.

Source/JavaScriptCore:

  • runtime/VM.cpp:

(JSC::VM::committedStackByteCount):

Source/WTF:

Use WTF::currentStackPointer more in WebKit to adopt ASAN detect_stack_use_after_return option.

  • wtf/StackBounds.cpp:

(WTF::testStackDirection2):
(WTF::testStackDirection):

  • wtf/ThreadingPthreads.cpp:

(WTF::Thread::signalHandlerSuspendResume):
(WTF::getApproximateStackPointer): Deleted.

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r237054 r237059  
     12018-10-11  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
     2
     3        Use currentStackPointer more
     4        https://bugs.webkit.org/show_bug.cgi?id=190503
     5
     6        Reviewed by Saam Barati.
     7
     8        * runtime/VM.cpp:
     9        (JSC::VM::committedStackByteCount):
     10
    1112018-10-08  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
    212
  • trunk/Source/JavaScriptCore/runtime/VM.cpp

    r236381 r237059  
    11581158    // committed. So, we use the current stack usage as an estimate.
    11591159    ASSERT(Thread::current().stack().isGrowingDownward());
    1160     int8_t* current = reinterpret_cast<int8_t*>(&current);
    1161     int8_t* high = reinterpret_cast<int8_t*>(Thread::current().stack().origin());
     1160    uint8_t* current = bitwise_cast<uint8_t*>(currentStackPointer());
     1161    uint8_t* high = bitwise_cast<uint8_t*>(Thread::current().stack().origin());
    11621162    return high - current;
    11631163#else
  • trunk/Source/WTF/ChangeLog

    r237052 r237059  
     12018-10-11  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
     2
     3        Use currentStackPointer more
     4        https://bugs.webkit.org/show_bug.cgi?id=190503
     5
     6        Reviewed by Saam Barati.
     7
     8        Use WTF::currentStackPointer more in WebKit to adopt ASAN detect_stack_use_after_return option.
     9
     10        * wtf/StackBounds.cpp:
     11        (WTF::testStackDirection2):
     12        (WTF::testStackDirection):
     13        * wtf/ThreadingPthreads.cpp:
     14        (WTF::Thread::signalHandlerSuspendResume):
     15        (WTF::getApproximateStackPointer): Deleted.
     16
    1172018-10-11  Ross Kirsling  <ross.kirsling@sony.com>
    218
  • trunk/Source/WTF/wtf/StackBounds.cpp

    r236962 r237059  
    5151}
    5252#else
    53 static NEVER_INLINE NOT_TAIL_CALLED StackBounds::StackDirection testStackDirection2(volatile const int* pointer)
    54 {
    55     volatile int stackValue = 42;
    56     return (pointer < &stackValue) ? StackBounds::StackDirection::Upward : StackBounds::StackDirection::Downward;
     53static NEVER_INLINE NOT_TAIL_CALLED StackBounds::StackDirection testStackDirection2(volatile const uint8_t* pointer)
     54{
     55    volatile uint8_t* stackValue = bitwise_cast<uint8_t*>(currentStackPointer());
     56    return (pointer < stackValue) ? StackBounds::StackDirection::Upward : StackBounds::StackDirection::Downward;
    5757}
    5858
     
    6060{
    6161    NO_TAIL_CALLS();
    62     volatile int stackValue = 42;
    63     return testStackDirection2(&stackValue);
     62    volatile uint8_t* stackValue = bitwise_cast<uint8_t*>(currentStackPointer());
     63    return testStackDirection2(stackValue);
    6464}
    6565
  • trunk/Source/WTF/wtf/ThreadingPthreads.cpp

    r235935 r237059  
    110110static std::atomic<Thread*> targetThread { nullptr };
    111111
    112 IGNORE_GCC_WARNINGS_BEGIN("return-local-addr")
    113 IGNORE_CLANG_WARNINGS_BEGIN("return-stack-address")
    114 
    115 static NEVER_INLINE void* getApproximateStackPointer()
    116 {
    117     volatile uintptr_t stackLocation;
    118     stackLocation = bitwise_cast<uintptr_t>(&stackLocation);
    119     return bitwise_cast<void*>(stackLocation);
    120 }
    121 
    122 IGNORE_CLANG_WARNINGS_END
    123 IGNORE_GCC_WARNINGS_END
    124 
    125112void Thread::signalHandlerSuspendResume(int, siginfo_t*, void* ucontext)
    126113{
     
    138125    }
    139126
    140     void* approximateStackPointer = getApproximateStackPointer();
     127    void* approximateStackPointer = currentStackPointer();
    141128    if (!thread->m_stack.contains(approximateStackPointer)) {
    142129        // This happens if we use an alternative signal stack.
Note: See TracChangeset for help on using the changeset viewer.