[compiler-rt] [scudo][fuchsia] Give dispatched VMOs a (temporary) name (PR #97578)

Fabio D'Urso via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 06:58:08 PDT 2024


https://github.com/fabio-d created https://github.com/llvm/llvm-project/pull/97578

Instead of leaving them unnamed. Subsequent remap() calls will
set the actual final name.


>From 3f70ee96d3504c8fb031b1a7e499621ba2055a31 Mon Sep 17 00:00:00 2001
From: Fabio D'Urso <fdurso at google.com>
Date: Wed, 3 Jul 2024 15:54:22 +0200
Subject: [PATCH] [scudo][fuchsia] Give dispatched VMOs a (temporary) name

Instead of leaving them unnamed. Subsequent remap() calls will
set the actual final name.
---
 compiler-rt/lib/scudo/standalone/mem_map_fuchsia.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/compiler-rt/lib/scudo/standalone/mem_map_fuchsia.cpp b/compiler-rt/lib/scudo/standalone/mem_map_fuchsia.cpp
index fc793abf44cda..9d6df2bc69996 100644
--- a/compiler-rt/lib/scudo/standalone/mem_map_fuchsia.cpp
+++ b/compiler-rt/lib/scudo/standalone/mem_map_fuchsia.cpp
@@ -91,12 +91,15 @@ static bool IsNoMemError(zx_status_t Status) {
   return Status == ZX_ERR_NO_MEMORY || Status == ZX_ERR_NO_RESOURCES;
 }
 
+// Note: this constructor is only called by ReservedMemoryFuchsia::dispatch.
 MemMapFuchsia::MemMapFuchsia(uptr Base, uptr Capacity)
     : MapAddr(Base), WindowBase(Base), WindowSize(Capacity) {
   // Create the VMO.
   zx_status_t Status = _zx_vmo_create(Capacity, 0, &Vmo);
   if (UNLIKELY(Status != ZX_OK))
     dieOnError(Status, "zx_vmo_create", Capacity);
+
+  setVmoName(Vmo, "scudo:dispatched");
 }
 
 bool MemMapFuchsia::mapImpl(UNUSED uptr Addr, uptr Size, const char *Name,



More information about the llvm-commits mailing list