Changeset 58393 in webkit


Ignore:
Timestamp:
Apr 28, 2010 2:06:20 AM (14 years ago)
Author:
Simon Hausmann
Message:

JSC's currentThreadStackBase is not reentrant on some platforms
https://bugs.webkit.org/show_bug.cgi?id=37195

Patch by Simon Hausmann <simon.hausmann@nokia.com>, Kent Hansen <kent.hansen@nokia.com> on 2010-04-28
Reviewed by Darin Adler.

This function needs to be reentrant to avoid memory corruption on platforms where
the implementation uses global variables.

This patch adds a mutex lock where necessary and makes the Symbian implementation
reentrant.

  • runtime/Collector.cpp:

(JSC::currentThreadStackBaseMutex):
(JSC::currentThreadStackBase):

Location:
trunk/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r58392 r58393  
     12010-04-28  Simon Hausmann  <simon.hausmann@nokia.com>, Kent Hansen <kent.hansen@nokia.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        JSC's currentThreadStackBase is not reentrant on some platforms
     6        https://bugs.webkit.org/show_bug.cgi?id=37195
     7
     8        This function needs to be reentrant to avoid memory corruption on platforms where
     9        the implementation uses global variables.
     10
     11        This patch adds a mutex lock where necessary and makes the Symbian implementation
     12        reentrant.
     13
     14        * runtime/Collector.cpp:
     15        (JSC::currentThreadStackBaseMutex):
     16        (JSC::currentThreadStackBase):
     17
    1182010-04-28  Thiago Macieira <thiago.macieira@nokia.com>
    219
  • trunk/JavaScriptCore/runtime/Collector.cpp

    r58134 r58393  
    559559    return reinterpret_cast<void*>(pTib->StackBase);
    560560#elif OS(QNX)
     561    AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex);
     562    MutexLocker locker(mutex);
    561563    return currentThreadStackBaseQNX();
    562564#elif OS(SOLARIS)
     
    570572    return stack.ss_sp;
    571573#elif OS(SYMBIAN)
    572     static void* stackBase = 0;
    573     if (stackBase == 0) {
    574         TThreadStackInfo info;
    575         RThread thread;
    576         thread.StackInfo(info);
    577         stackBase = (void*)info.iBase;
    578     }
    579     return (void*)stackBase;
     574    TThreadStackInfo info;
     575    RThread thread;
     576    thread.StackInfo(info);
     577    return (void*)info.iBase;
    580578#elif OS(HAIKU)
    581579    thread_info threadInfo;
     
    583581    return threadInfo.stack_end;
    584582#elif OS(UNIX)
     583    AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex);
     584    MutexLocker locker(mutex);
    585585    static void* stackBase = 0;
    586586    static size_t stackSize = 0;
     
    605605    return static_cast<char*>(stackBase) + stackSize;
    606606#elif OS(WINCE)
     607    AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex);
     608    MutexLocker locker(mutex);
    607609    if (g_stackBase)
    608610        return g_stackBase;
Note: See TracChangeset for help on using the changeset viewer.