From 93d6a3c8b6aabdf7916800b40302323ecf619cb1 Mon Sep 17 00:00:00 2001 From: klzgrad Date: Mon, 13 May 2024 19:08:53 +0800 Subject: [PATCH] musl: allocator: Fix hanging in qemu-user It causes hanging in pthread_getattr_np() under qemu-user, see https://www.openwall.com/lists/musl/2017/06/15/9. --- src/base/allocator/partition_alloc_support.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/base/allocator/partition_alloc_support.cc b/src/base/allocator/partition_alloc_support.cc index e4a68b351d..f7338aae1a 100644 --- a/src/base/allocator/partition_alloc_support.cc +++ b/src/base/allocator/partition_alloc_support.cc @@ -1109,8 +1109,12 @@ void PartitionAllocSupport::ReconfigureAfterFeatureListInit( UmaHistogramCounts100("Memory.PartitionAlloc.PartitionRoot.ExtrasSize", int(extras_size)); +#if !defined(__MUSL__) + // This call causes hanging in pthread_getattr_np() under qemu-user, see + // https://www.openwall.com/lists/musl/2017/06/15/9. partition_alloc::internal::StackTopRegistry::Get().NotifyThreadCreated( partition_alloc::internal::GetStackTop()); +#endif allocator_shim::internal::PartitionAllocMalloc::Allocator() ->EnableThreadCacheIfSupported();