Skip to content

Commit 96f5cf5

Browse files
committed
Relax invariants checked by erts_add_taint before initialization
Debug builds configured with static NIFs are currently not usable since they abort during startup. The abort is caused by a check in erts_add_taint that makes sense once the runtime has started but might not be meaningful before the runtime has been started, notably during static NIF initialization. This change adds an additional check that allows erts_add_taint to proceed when called during runtime initialization. With this check, a debug with static NIFs can complete the startup process.
1 parent e4f8905 commit 96f5cf5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

erts/emulator/beam/erl_nif.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4438,7 +4438,8 @@ void erts_add_taint(Eterm mod_atom)
44384438
struct tainted_module_t *first, *t;
44394439

44404440
ERTS_LC_ASSERT(erts_lc_rwmtx_is_rwlocked(&erts_driver_list_lock)
4441-
|| erts_has_code_mod_permission());
4441+
|| erts_has_code_mod_permission()
4442+
|| !erts_initialized);
44424443

44434444
first = (struct tainted_module_t*) erts_atomic_read_nob(&first_taint);
44444445
for (t=first ; t; t=t->next) {

0 commit comments

Comments
 (0)