Skip to content

Commit

Permalink
erts: Fix assert in erts_add_taint for static NIFs
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 authored and sverker committed Jan 20, 2025
1 parent 412bff5 commit a14c946
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 @@ -4375,7 +4375,8 @@ void erts_add_taint(Eterm mod_atom)
#endif
struct tainted_module_t *first, *t;

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

first = (struct tainted_module_t*) erts_atomic_read_nob(&first_taint);
Expand Down

0 comments on commit a14c946

Please sign in to comment.