Skip to content

Commit

Permalink
Merge r180649 - ASan does not like JSC::MachineThreads::tryCopyOtherT…
Browse files Browse the repository at this point in the history
…hreadStack.

<https://webkit.org/b/141672>

Reviewed by Alexey Proskuryakov.

ASan does not like the fact that we memcpy the stack for GC scans.  So,
we're working around this by using our own memcpy (asanUnsafeMemcpy)
implementation that we can tell ASan to ignore.

Source/JavaScriptCore:

* heap/MachineStackMarker.cpp:
(JSC::asanUnsafeMemcpy):

Tools:

Also removed the previous added directive to ignore *tryCopyOtherThreadStack*
which isn't effective for working around this issue.

* asan/webkit-asan-ignore.txt:
  • Loading branch information
Mark Lam authored and carlosgcampos committed Feb 27, 2015
1 parent 5a6365e commit ba9cd3b
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,17 @@
2015-02-25 Mark Lam <mark.lam@apple.com>

ASan does not like JSC::MachineThreads::tryCopyOtherThreadStack.
<https://webkit.org/b/141672>

Reviewed by Alexey Proskuryakov.

ASan does not like the fact that we memcpy the stack for GC scans. So,
we're working around this by using our own memcpy (asanUnsafeMemcpy)
implementation that we can tell ASan to ignore.

* heap/MachineStackMarker.cpp:
(JSC::asanUnsafeMemcpy):

2015-02-15 Sam Weinig <sam@webkit.org>

Add experimental <attachment> element support
Expand Down
20 changes: 20 additions & 0 deletions Source/JavaScriptCore/heap/MachineStackMarker.cpp
Expand Up @@ -443,6 +443,26 @@ static std::pair<void*, size_t> otherThreadStack(void* stackBase, const Platform
return std::make_pair(begin, static_cast<char*>(end) - static_cast<char*>(begin));
}

#if ASAN_ENABLED
void asanUnsafeMemcpy(void* dst, const void* src, size_t);
void asanUnsafeMemcpy(void* dst, const void* src, size_t size)
{
size_t dstAsSize = reinterpret_cast<size_t>(dst);
size_t srcAsSize = reinterpret_cast<size_t>(src);
RELEASE_ASSERT(dstAsSize == WTF::roundUpToMultipleOf<sizeof(intptr_t)>(dstAsSize));
RELEASE_ASSERT(srcAsSize == WTF::roundUpToMultipleOf<sizeof(intptr_t)>(srcAsSize));
RELEASE_ASSERT(size == WTF::roundUpToMultipleOf<sizeof(intptr_t)>(size));

intptr_t* dstPtr = reinterpret_cast<intptr_t*>(dst);
const intptr_t* srcPtr = reinterpret_cast<const intptr_t*>(src);
size /= sizeof(intptr_t);
while (size--)
*dstPtr++ = *srcPtr++;
}

#define memcpy asanUnsafeMemcpy
#endif

// This function must not call malloc(), free(), or any other function that might
// acquire a lock. Since 'thread' is suspended, trying to acquire a lock
// will deadlock if 'thread' holds that lock.
Expand Down
25 changes: 25 additions & 0 deletions Tools/ChangeLog
@@ -1,3 +1,28 @@
2015-02-25 Mark Lam <mark.lam@apple.com>

ASan does not like JSC::MachineThreads::tryCopyOtherThreadStack.
<https://webkit.org/b/141672>

Reviewed by Alexey Proskuryakov.

ASan does not like the fact that we memcpy the stack for GC scans. So,
we're working around this by using our own memcpy (asanUnsafeMemcpy)
implementation that we can tell ASan to ignore.

Also removed the previous added directive to ignore *tryCopyOtherThreadStack*
which isn't effective for working around this issue.

* asan/webkit-asan-ignore.txt:

2015-02-17 Dana Burkart <dburkart@apple.com>

ASan does not like JSC::MachineThreads::tryCopyOtherThreadStack
https://bugs.webkit.org/show_bug.cgi?id=141672

Reviewed by David Kilzer.

* asan/webkit-asan-ignore.txt:

2015-02-17 Carlos Garcia Campos <cgarcia@igalia.com>

Unreviewed. Fix GTK+ make distcheck.
Expand Down
1 change: 1 addition & 0 deletions Tools/asan/webkit-asan-ignore.txt
Expand Up @@ -4,3 +4,4 @@ fun:*DFG*prepareOSREntry*
# FIXME (rdar://problem/19379214): Register::jsValue() only needs to be blacklisted when
# called from prepareOSREntry(), but there is currently no way to express this in a blacklist.
fun:*JSC*Register*jsValue*
fun:*asanUnsafeMemcpy*

0 comments on commit ba9cd3b

Please sign in to comment.