Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
1133-erts-Fix-potential-lock-order-conflict-in-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1133-erts-Fix-potential-lock-order-conflict-in-NIF-monito.patch of Package erlang
From 520edad65567eb03cd170135cbddaf440d64983d Mon Sep 17 00:00:00 2001 From: Sverker Eriksson <sverker@erlang.org> Date: Mon, 28 Oct 2024 20:00:26 +0100 Subject: [PATCH] erts: Fix potential lock order conflict in NIF monitor down callbacks by releasing main lock of the exiting process. --- erts/emulator/beam/erl_process.c | 2 ++ erts/emulator/test/nif_SUITE_data/nif_SUITE.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c index c2ca5a03f3..6c95146f60 100644 --- a/erts/emulator/beam/erl_process.c +++ b/erts/emulator/beam/erl_process.c @@ -13483,7 +13483,9 @@ erts_proc_exit_handle_monitor(ErtsMonitor *mon, void *vctxt, Sint reds) break; } case ERTS_MON_TYPE_RESOURCE: + erts_proc_unlock(c_p, ERTS_PROC_LOCK_MAIN); erts_fire_nif_monitor(mon); + erts_proc_lock(c_p, ERTS_PROC_LOCK_MAIN); mon = NULL; break; case ERTS_MON_TYPE_DIST_PORT: diff --git a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c index 7a47c2ea99..e8e485a32c 100644 --- a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c +++ b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c @@ -2855,6 +2855,16 @@ static void monitor_resource_down(ErlNifEnv* env, void* obj, ErlNifPid* pid, enif_send(env, &rsrc->receiver, msg_env, msg); if (msg_env) enif_free_env(msg_env); + + /* OTP-19330 GH-8983: + * Verify calling enif_whereis_pid/port in down callback + * without lock order violation. */ + { + ErlNifPid pid; + ErlNifPid port; + enif_whereis_pid(env, atom_null, &pid); + enif_whereis_port(env, atom_null, &port); + } } static ERL_NIF_TERM alloc_monitor_resource_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) -- 2.43.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor