File 0677-erts-Fix-no-locking-in-export_table_sz-during-crash-.patch of Package erlang

From 5372d0eaf80855c455f86511a4ab4036480ab670 Mon Sep 17 00:00:00 2001
From: Sverker Eriksson <sverker@erlang.org>
Date: Tue, 28 May 2024 19:18:02 +0200
Subject: [PATCH] erts: Fix no locking in export_table_sz() during crash dump

---
 erts/emulator/beam/export.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/erts/emulator/beam/export.c b/erts/emulator/beam/export.c
index fdaf1a15a5..dbe83ba1f4 100644
--- a/erts/emulator/beam/export.c
+++ b/erts/emulator/beam/export.c
@@ -364,13 +364,18 @@ int export_list_size(ErtsCodeIndex code_ix)
 
 int export_table_sz(void)
 {
+    const int lock = !ERTS_IS_CRASH_DUMPING;
     int i, bytes = 0;
 
-    export_staging_lock();
+    if (lock) {
+        export_staging_lock();
+    }
     for (i=0; i<ERTS_NUM_CODE_IX; i++) {
 	bytes += index_table_sz(&export_tables[i]);
     }
-    export_staging_unlock();
+    if (lock) {
+        export_staging_unlock();
+    }
     return bytes;
 }
 int export_entries_sz(void)
-- 
2.35.3

openSUSE Build Service is sponsored by