[vm] Avoid allocating via vm_map under TSAN.

TSAN is missing an interceptor for mach_vm_map.

TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/61445
Change-Id: Ia3c27a6afd6617843ec9ce336372d2058d498a7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/448256
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak
2025-09-10 07:43:49 -07:00
committed by Commit Queue
parent de0f3697f7
commit 30bf31a690
+4 -1
View File
@@ -36,6 +36,7 @@
#endif
#include "platform/assert.h"
#include "platform/thread_sanitizer.h"
#include "platform/utils.h"
#include "vm/heap/pages.h"
#include "vm/isolate.h"
@@ -113,8 +114,10 @@ static void* GenericMapAligned(void* hint,
intptr_t alignment,
intptr_t allocated_size,
int map_flags) {
#if defined(DART_HOST_OS_MACOS)
#if defined(DART_HOST_OS_MACOS) && !defined(USING_THREAD_SANITIZER)
// Allocate aligned memory in one step when possible.
// vm_map doesn't support MAP_JIT.
// tsan is missing an interceptor for mach_vm_map.
if ((map_flags & MAP_JIT) == 0) {
vm_address_t address = 0;
vm_prot_t cur_prot = 0;