From 43c3016e8f8d305e83e761a0b0e31d3a8f894f5b Mon Sep 17 00:00:00 2001 From: Rickard Green Date: Mon, 9 Jan 2023 22:15:39 +0100 Subject: [erts] Prevent execution of a process while dirty signal handling is done Previous fix in 294a063233c27d966919bcf50c5a0ac53f78779b prevents a process from simultaneously handle signals by itself when a dirty signal handler is handling signals for the process. This does, however, not prevent other operations operating on the signal queue (such as recv-marker operations) from executing simultaneously as the dirty signal handling is ongoing. This fix prevents a newly scheduled process from executing at all until any dirty signal handling has completed. --- erts/emulator/beam/erl_process.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'erts/emulator/beam/erl_process.c') diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c index 65a6e1c6ad..5fa66e7e94 100644 --- a/erts/emulator/beam/erl_process.c +++ b/erts/emulator/beam/erl_process.c @@ -9876,6 +9876,13 @@ Process *erts_schedule(ErtsSchedulerData *esdp, Process *p, int calls) } else { /* On normal scheduler */ + + /* + * Check if a dirty signal handler is handling signals for + * us and if so, wait for it to complete before continuing... + */ + state = erts_proc_sig_check_wait_dirty_handle_signals(p, state); + if (state & ERTS_PSFLG_RUNNING_SYS) { if (state & (ERTS_PSFLG_SIG_Q|ERTS_PSFLG_SIG_IN_Q)) { int local_only = (!!(p->sig_qs.flags & FS_LOCAL_SIGS_ONLY) -- cgit v1.2.1