Skip to content

Commit

Permalink
Relax invariants checked by erts_add_taint before initialization
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lexprfuncall committed Jan 16, 2025
1 parent e4f8905 commit 96f5cf5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion erts/emulator/beam/erl_nif.c
Original file line number Diff line number Diff line change
Expand Up @@ -4438,7 +4438,8 @@ void erts_add_taint(Eterm mod_atom)
struct tainted_module_t *first, *t;

ERTS_LC_ASSERT(erts_lc_rwmtx_is_rwlocked(&erts_driver_list_lock)
|| erts_has_code_mod_permission());
|| erts_has_code_mod_permission()
|| !erts_initialized);

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

0 comments on commit 96f5cf5

Please sign in to comment.