aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2019-02-12 16:46:33 +0100
committerLukas Larsson <[email protected]>2019-02-22 11:12:54 +0100
commitbf7c722bd3b30e04a56c2d369fd9f5501a8316d0 (patch)
tree64bc891786d71282e653224153799dc03eff28d8 /erts
parentc0c6f6b137e91f626157389733d1510c192002cf (diff)
downloadotp-bf7c722bd3b30e04a56c2d369fd9f5501a8316d0.tar.gz
otp-bf7c722bd3b30e04a56c2d369fd9f5501a8316d0.tar.bz2
otp-bf7c722bd3b30e04a56c2d369fd9f5501a8316d0.zip
erts: Fix so that externals with creation 0 compare equal to all
The special creation of 0 is used by internally created externals, such as when list_to_pid is called. This creation should compare equal to all externals creations of that external. If it does not we can end up in very strange scenarios. For instance: > P = spawn(OtherNode, fun() -> die end). <8303.60.0> > link(<8303.60.0>). true > flush(). ok OTP-15613
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/erl_monitor_link.c3
-rw-r--r--erts/emulator/beam/erl_node_tables.c5
-rw-r--r--erts/emulator/beam/utils.c3
3 files changed, 7 insertions, 4 deletions
diff --git a/erts/emulator/beam/erl_monitor_link.c b/erts/emulator/beam/erl_monitor_link.c
index 3dabd79190..1c6b4afaa3 100644
--- a/erts/emulator/beam/erl_monitor_link.c
+++ b/erts/emulator/beam/erl_monitor_link.c
@@ -191,7 +191,8 @@ ml_cmp_keys(Eterm key1, Eterm key2)
if (n1->sysname != n2->sysname)
return n1->sysname < n2->sysname ? -1 : 1;
ASSERT(n1->creation != n2->creation);
- return n1->creation < n2->creation ? -1 : 1;
+ if (n1->creation != 0 && n2->creation != 0)
+ return n1->creation < n2->creation ? -1 : 1;
}
ndw1 = external_thing_data_words(et1);
diff --git a/erts/emulator/beam/erl_node_tables.c b/erts/emulator/beam/erl_node_tables.c
index 8fe5c3c690..afafaf48dc 100644
--- a/erts/emulator/beam/erl_node_tables.c
+++ b/erts/emulator/beam/erl_node_tables.c
@@ -802,8 +802,9 @@ node_table_hash(void *venp)
static int
node_table_cmp(void *venp1, void *venp2)
{
- return ((((ErlNode *) venp1)->sysname == ((ErlNode *) venp2)->sysname
- && ((ErlNode *) venp1)->creation == ((ErlNode *) venp2)->creation)
+ return ((((ErlNode *) venp1)->sysname == ((ErlNode *) venp2)->sysname) &&
+ ((((ErlNode *) venp1)->creation == ((ErlNode *) venp2)->creation) ||
+ (((ErlNode *) venp1)->creation == 0 || ((ErlNode *) venp2)->creation == 0))
? 0
: 1);
}
diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c
index 3fa09e39f2..36a492f00d 100644
--- a/erts/emulator/beam/utils.c
+++ b/erts/emulator/beam/utils.c
@@ -2701,7 +2701,8 @@ Sint erts_cmp_compound(Eterm a, Eterm b, int exact, int eq_only)
if((AN)->sysname != (BN)->sysname) \
RETURN_NEQ(erts_cmp_atoms((AN)->sysname, (BN)->sysname)); \
ASSERT((AN)->creation != (BN)->creation); \
- RETURN_NEQ(((AN)->creation < (BN)->creation) ? -1 : 1); \
+ if ((AN)->creation != 0 && (BN)->creation != 0) \
+ RETURN_NEQ(((AN)->creation < (BN)->creation) ? -1 : 1); \
} \
} while (0)