aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-06-26 10:30:54 +0200
committerBjörn Gustavsson <[email protected]>2017-06-26 10:50:33 +0200
commitf405b07bc6136c76a016da67dc65e5c7ec9d8f9f (patch)
treecac72d10b734fc0712997e06959518be5291579b /erts/emulator
parentbd2752e3d2ec91572e4d0c2fb35951f8f6bdc9f6 (diff)
downloadotp-f405b07bc6136c76a016da67dc65e5c7ec9d8f9f.tar.gz
otp-f405b07bc6136c76a016da67dc65e5c7ec9d8f9f.tar.bz2
otp-f405b07bc6136c76a016da67dc65e5c7ec9d8f9f.zip
Eliminate potential unsafe use of general destination
a3407eaa2104d6 eliminated the -gen_dest flag for macros in ops.tab. It turns out that the new implementation (taking the address of the X or X destination register) is unsafe if the destination is a Y register and there can be a GC. The problem is that the address to the Y register will change if there is a GC. Fortunately, the few instructions in OTP 20 that have a general destinations are safe. The put_list_ssd instruction never does a GC. The bit syntax instructions that may do a GC will always store the result to an X register. To be completely sure, rewrite the destination register from 'd' to 'x' for the bit syntax instructions. That means that a bit syntax instruction with a Y register destionation will abort the loading if it is encountered.
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/ops.tab8
1 files changed, 4 insertions, 4 deletions
diff --git a/erts/emulator/beam/ops.tab b/erts/emulator/beam/ops.tab
index cdf9cb58b9..44613c7d85 100644
--- a/erts/emulator/beam/ops.tab
+++ b/erts/emulator/beam/ops.tab
@@ -1174,9 +1174,9 @@ bs_get_binary2 Fail=f Ms=x Live=u Sz=sq Unit=u Flags=u Dst=d => \
%macro: i_bs_get_binary2 BsGetBinary_2 -fail_action
%macro: i_bs_get_binary_all2 BsGetBinaryAll_2 -fail_action
-i_bs_get_binary_imm2 f x I I I d
-i_bs_get_binary2 f x I s I d
-i_bs_get_binary_all2 f x I I d
+i_bs_get_binary_imm2 f x I I I x
+i_bs_get_binary2 f x I s I x
+i_bs_get_binary_all2 f x I I x
i_bs_get_binary_all_reuse x f I
# Fetching float from binaries.
@@ -1186,7 +1186,7 @@ bs_get_float2 Fail=f Ms=x Live=u Sz=s Unit=u Flags=u Dst=d => \
bs_get_float2 Fail=f Ms=x Live=u Sz=q Unit=u Flags=u Dst=d => jump Fail
%macro: i_bs_get_float2 BsGetFloat2 -fail_action
-i_bs_get_float2 f x I s I d
+i_bs_get_float2 f x I s I x
# Miscellanous