author | Jim Chen <nchen@mozilla.com> |
Mon, 28 Jul 2014 13:30:22 -0400 | |
changeset 196370 | 60a248ab5036b1988ffc2a49ba4da1e25f3a05ab |
parent 196369 | 4592de6b1b145fb6c548f509f0ee28cf565879a1 |
child 196371 | fa87806142d488701617e7d50758be0dbbd8cc0a |
push id | 46863 |
push user | nchen@mozilla.com |
push date | Mon, 28 Jul 2014 17:30:47 +0000 |
treeherder | mozilla-inbound@fa87806142d4 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | snorp |
bugs | 1016629 |
milestone | 34.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/xpcom/threads/ThreadStackHelper.cpp +++ b/xpcom/threads/ThreadStackHelper.cpp @@ -607,17 +607,17 @@ ThreadStackHelper::FillStackBuffer() // availableBufferSize < 0 if we needed a larger buffer than we reserved. // Calculate a new reserve size for next time. if (availableBufferSize < 0) { mMaxBufferSize = reservedBufferSize - availableBufferSize; } #endif } -void +MOZ_ASAN_BLACKLIST void ThreadStackHelper::FillThreadContext(void* aContext) { #ifdef MOZ_THREADSTACKHELPER_NATIVE if (!mContextToFill) { return; } #if defined(XP_LINUX) @@ -752,16 +752,27 @@ ThreadStackHelper::FillThreadContext(voi #ifndef MOZ_THREADSTACKHELPER_STACK_GROWS_DOWN // If if the stack grows upwards, and we need to recalculate our // stack copy's base address. Subtract sizeof(void*) so that the // location pointed to by sp is included. sp -= stackSize - sizeof(void*); #endif +#ifndef MOZ_ASAN memcpy(mContextToFill->mStack, reinterpret_cast<void*>(sp), stackSize); +#else + // ASan will flag memcpy for access outside of stack frames, + // so roll our own memcpy here. + intptr_t* dst = reinterpret_cast<intptr_t*>(&mContextToFill->mStack[0]); + const intptr_t* src = reinterpret_cast<intptr_t*>(sp); + for (intptr_t len = stackSize; len > 0; len -= sizeof(*src)) { + *(dst++) = *(src++); + } +#endif + mContextToFill->mStackBase = uintptr_t(sp); mContextToFill->mStackSize = stackSize; mContextToFill->mValid = true; #endif // MOZ_THREADSTACKHELPER_NATIVE } } // namespace mozilla