RESOLVED FIXED 216318
WebKit should support building with clang ThreadSanitizer enabled
https://bugs.webkit.org/show_bug.cgi?id=216318
Summary WebKit should support building with clang ThreadSanitizer enabled
David Kilzer (:ddkilzer)
Reported 2020-09-09 10:34:33 PDT
WebKit should support building with clang ThreadSanitizer (TSan) enabled. The biggest challenge here is to instrument WebKit's custom locking mechanisms so TSan is able to reason correctly about threaded memory accesses. Also need to make it easy to make it easy to build with TSan enabled like we do with ASan using `set-webkit-configuration --[no-]asan`. <rdar://problem/31615729>
Attachments
WIP Patch v1 (8.68 KB, patch)
2020-09-09 10:38 PDT, David Kilzer (:ddkilzer)
ddkilzer: review-
ews-feeder: commit-queue-
WIP Patch v2 (28.99 KB, patch)
2020-09-09 16:21 PDT, David Kilzer (:ddkilzer)
ews-feeder: commit-queue-
WIP Patch v3 (29.80 KB, patch)
2020-09-09 18:35 PDT, David Kilzer (:ddkilzer)
no flags
Patch v4 (24.31 KB, patch)
2020-09-13 11:18 PDT, David Kilzer (:ddkilzer)
no flags
David Kilzer (:ddkilzer)
Comment 1 2020-09-09 10:38:41 PDT
Created attachment 408340 [details] WIP Patch v1 This is a WIP that implements basic TSan instrumentation for malloc::Mutex and WTF::Lock classes. It does not provide a way to enable TSan when building yet, though one can enable ASan and change ENABLE_ADDRESS_SANITIZER=YES to ENABLE_THREAD_SANITIZER=YES in Tools/asan/asan.xcconfig for Apple platforms.
David Kilzer (:ddkilzer)
Comment 2 2020-09-09 16:21:14 PDT
Created attachment 408381 [details] WIP Patch v2 This adds build support with `make TSAN=YES` and `set-webkit-configuration --[no-]tsan`. It also fixes the build errors from "WIP Patch v1". Still not complete since we need to instrument more WTF lock classes. (I wonder if we can get away with just instrumenting the WTF::Locker class, too.) Also, I'm not sure if we should instrument malloc::Mutex or not. We may just end up tossing the bmalloc changes in this patch.
David Kilzer (:ddkilzer)
Comment 3 2020-09-09 18:35:52 PDT
Created attachment 408391 [details] WIP Patch v3 Fix style issues and make builds.
David Kilzer (:ddkilzer)
Comment 4 2020-09-13 11:18:43 PDT
Created attachment 408656 [details] Patch v4
EWS
Comment 5 2020-09-15 19:53:41 PDT
Committed r267130: <https://trac.webkit.org/changeset/267130> All reviewed patches have been landed. Closing bug and clearing flags on attachment 408656 [details].
Note You need to log in before you can comment on or make changes to this bug.