Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c09c1834385f2eac98a7131b10a73369046dc429
https://github.com/WebKit/WebKit/commit/c09c1834385f2eac98a7131b10a73369046dc429
Author: David Kilzer <[email protected]>
Date: 2026-07-23 (Thu, 23 Jul 2026)
Changed paths:
M Configurations/Sanitizers.xcconfig
M Source/WTF/wtf/FastMalloc.h
M Source/WTF/wtf/PlatformUse.h
M Source/WTF/wtf/SequesteredImmortalHeap.cpp
M Source/bmalloc/libpas/src/libpas/pas_config.h
M Source/bmalloc/libpas/src/libpas/pas_platform.h
Log Message:
-----------
[TSan][Xcode] USE(LIBPAS) and USE(TZONE_MALLOC) should be disabled when
bmalloc falls back to the system allocator under TSan
<https://bugs.webkit.org/show_bug.cgi?id=319644>
<rdar://182463168>
Reviewed by Marcus Plutowski.
bmalloc falls back to the system allocator under ThreadSanitizer
(`BUSE(SYSTEM_MALLOC)` via `BTSAN_ENABLED`), which disables
`BUSE(LIBPAS)` and `BUSE(TZONE)`. The WTF and libpas allocator
switches had no matching TSan condition, so they disagreed with
bmalloc throughout the Xcode ThreadSanitizer build. Give WTF's
`USE(SYSTEM_MALLOC)` a ThreadSanitizer branch so `USE(TZONE_MALLOC)`
and `USE(LIBPAS)` agree; otherwise `TZoneMalloc.h` #errors "TZones
enabled in WTF, but not enabled in bmalloc" and WTF/JavaScriptCore
reference libpas entry points bmalloc no longer provides. This is
the Xcode companion to the CMake `mac-tsan` fix (313486@main), which
the Xcode driver does not pick up.
Disable Memory Tagging Extension (MTE) under ThreadSanitizer via a
new `PAS_TSAN_ENABLED`, mirroring `PAS_ASAN_ENABLED`. MTE is a libpas
feature, so once libpas is disabled the MTE paths in `pas_mte.h` and
`pas_zero_memory.h` dereference the now-undeclared `g_config` on
arm64e internal-SDK builds.
Gate `SequesteredImmortalHeap::installScavenger()` on `USE(LIBPAS)`.
It installs a callback into libpas's scavenger, which does not exist
under the system allocator, but the surrounding code is gated on
`USE(PROTECTED_JIT)` rather than `USE(LIBPAS)`.
Define `__SANITIZE_THREAD__` for the Swift Clang importer under TSan,
mirroring the existing ASan `__SANITIZE_ADDRESS__` flag. The importer
does not receive `-fsanitize=thread`, so C++ headers it imports for
Swift/C++ interop would compute `USE(TZONE_MALLOC)` differently than
the instrumented C++ compile and emit undefined TZone references (for
example in WebGPU's Swift sources). Also add the compact-unwind
workaround to `TestIPC` since it needs it now.
No new tests since this is a build configuration fix.
* Configurations/Sanitizers.xcconfig:
* Source/WTF/wtf/FastMalloc.h:
* Source/WTF/wtf/PlatformUse.h:
* Source/WTF/wtf/SequesteredImmortalHeap.cpp:
(WTF::SequesteredImmortalHeap::installScavenger):
* Source/bmalloc/libpas/src/libpas/pas_config.h:
* Source/bmalloc/libpas/src/libpas/pas_platform.h:
Canonical link: https://commits.webkit.org/317837@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications