summaryrefslogtreecommitdiff
path: root/erts/preloaded/src/erts_internal.erl
diff options
context:
space:
mode:
authorRickard Green <rickard@erlang.org>2019-10-17 16:23:56 +0200
committerRickard Green <rickard@erlang.org>2019-10-29 19:53:35 +0100
commit4a59ebeb43184fb9dcdb3d2b4aeb454a2caed700 (patch)
treee4a515c0082f5d0bbb5df5396264115004b01190 /erts/preloaded/src/erts_internal.erl
parentdb6059a9217767a6e42e93cec05089c0ec977d20 (diff)
downloaderlang-4a59ebeb43184fb9dcdb3d2b4aeb454a2caed700.tar.gz
Fix release of literal areas
Literal areas could get prematurely removed and accessed from the exit reason of a terminated process, or accessed from the heap of a process executing dirty while terminating.
Diffstat (limited to 'erts/preloaded/src/erts_internal.erl')
-rw-r--r--erts/preloaded/src/erts_internal.erl11
1 files changed, 10 insertions, 1 deletions
diff --git a/erts/preloaded/src/erts_internal.erl b/erts/preloaded/src/erts_internal.erl
index 26fb1458af..6bbbf63ba6 100644
--- a/erts/preloaded/src/erts_internal.erl
+++ b/erts/preloaded/src/erts_internal.erl
@@ -45,7 +45,7 @@
-export([check_process_code/3]).
-export([check_dirty_process_code/2]).
-export([is_process_executing_dirty/1]).
--export([release_literal_area_switch/0]).
+-export([release_literal_area_switch/0, wait_release_literal_area_switch/1]).
-export([purge_module/2]).
-export([flush_monitor_messages/3]).
@@ -301,6 +301,15 @@ is_process_executing_dirty(_Pid) ->
release_literal_area_switch() ->
erlang:nif_error(undefined).
+-spec wait_release_literal_area_switch(WaitMsg) -> 'true' | 'false' when
+ WaitMsg :: term().
+
+wait_release_literal_area_switch(WaitMsg) ->
+ %% release_literal_area_switch() traps to here
+ %% when it needs to wait
+ receive WaitMsg -> ok end,
+ erts_internal:release_literal_area_switch().
+
-spec purge_module(Module, Op) -> boolean() when
Module :: module(),
Op :: 'prepare' | 'prepare_on_load' | 'abort' | 'complete'.