Title: [180649] trunk
Revision
180649
Author
mark....@apple.com
Date
2015-02-25 16:24:25 -0800 (Wed, 25 Feb 2015)

Log Message

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.

Source/_javascript_Core:

* 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:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (180648 => 180649)


--- trunk/Source/_javascript_Core/ChangeLog	2015-02-26 00:18:49 UTC (rev 180648)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-02-26 00:24:25 UTC (rev 180649)
@@ -1,3 +1,17 @@
+2015-02-25  Mark Lam  <mark....@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-25  Benjamin Poulain  <bpoul...@apple.com>
 
         CodeBlock crashes when dumping op_push_name_scope

Modified: trunk/Source/_javascript_Core/heap/MachineStackMarker.cpp (180648 => 180649)


--- trunk/Source/_javascript_Core/heap/MachineStackMarker.cpp	2015-02-26 00:18:49 UTC (rev 180648)
+++ trunk/Source/_javascript_Core/heap/MachineStackMarker.cpp	2015-02-26 00:24:25 UTC (rev 180649)
@@ -410,6 +410,26 @@
     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.

Modified: trunk/Tools/ChangeLog (180648 => 180649)


--- trunk/Tools/ChangeLog	2015-02-26 00:18:49 UTC (rev 180648)
+++ trunk/Tools/ChangeLog	2015-02-26 00:24:25 UTC (rev 180649)
@@ -1,3 +1,19 @@
+2015-02-25  Mark Lam  <mark....@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-25  Benjamin Poulain  <bpoul...@apple.com>
 
         CodeBlock crashes when dumping op_push_name_scope

Modified: trunk/Tools/asan/webkit-asan-ignore.txt (180648 => 180649)


--- trunk/Tools/asan/webkit-asan-ignore.txt	2015-02-26 00:18:49 UTC (rev 180648)
+++ trunk/Tools/asan/webkit-asan-ignore.txt	2015-02-26 00:24:25 UTC (rev 180649)
@@ -4,4 +4,4 @@
 # 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:*JSC*MachineThreads*tryCopyOtherThreadStack*
+fun:*asanUnsafeMemcpy*
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to