diff options
author | Rickard Green <[email protected]> | 2010-06-14 12:08:33 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2010-06-14 16:05:48 +0200 |
commit | 76faa5cf71b568068e1558c3050a3f0a8f7b4587 (patch) | |
tree | a42598ebffa303261be0873aa44fd6656443afe6 /erts/emulator/beam | |
parent | 898af6ed06747be1a0c62e0283696b703b0da68b (diff) | |
download | otp-76faa5cf71b568068e1558c3050a3f0a8f7b4587.tar.gz otp-76faa5cf71b568068e1558c3050a3f0a8f7b4587.tar.bz2 otp-76faa5cf71b568068e1558c3050a3f0a8f7b4587.zip |
OTP-8710 Fix emulator crash caused by setting CPU topology
A user defined CPU topology set via a call to <seealso
marker="erlang#system_flag_cpu_topology">erlang:system_flag(cpu_topology,
CPUTopology)</seealso> was not properly verified, and could in worst case
cause an emulator crash. The emulator crash could only occur when a user
defined CPU topology already existed and was redefined.
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r-- | erts/emulator/beam/erl_process.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c index bae17d1569..41031f5468 100644 --- a/erts/emulator/beam/erl_process.c +++ b/erts/emulator/beam/erl_process.c @@ -3787,11 +3787,11 @@ verify_topology(erts_cpu_topology_t *cpudata, int size) /* Verify logical ids */ logical = erts_alloc(ERTS_ALC_T_TMP, sizeof(int)*size); - for (i = 0; i < user_cpudata_size; i++) - logical[i] = user_cpudata[i].logical; + for (i = 0; i < size; i++) + logical[i] = cpudata[i].logical; - qsort(logical, user_cpudata_size, sizeof(int), int_cmp); - for (i = 0; i < user_cpudata_size-1; i++) { + qsort(logical, size, sizeof(int), int_cmp); + for (i = 0; i < size-1; i++) { if (logical[i] == logical[i+1]) { erts_free(ERTS_ALC_T_TMP, logical); return ERTS_INIT_CPU_TOPOLOGY_NOT_UNIQUE_LIDS; @@ -3804,13 +3804,13 @@ verify_topology(erts_cpu_topology_t *cpudata, int size) /* Verify unique entities */ - for (i = 1; i < user_cpudata_size; i++) { - if (user_cpudata[i-1].processor == user_cpudata[i].processor - && user_cpudata[i-1].node == user_cpudata[i].node - && (user_cpudata[i-1].processor_node - == user_cpudata[i].processor_node) - && user_cpudata[i-1].core == user_cpudata[i].core - && user_cpudata[i-1].thread == user_cpudata[i].thread) { + for (i = 1; i < size; i++) { + if (cpudata[i-1].processor == cpudata[i].processor + && cpudata[i-1].node == cpudata[i].node + && (cpudata[i-1].processor_node + == cpudata[i].processor_node) + && cpudata[i-1].core == cpudata[i].core + && cpudata[i-1].thread == cpudata[i].thread) { return ERTS_INIT_CPU_TOPOLOGY_NOT_UNIQUE_ENTITIES; } } |