commit 9644b501e7751272a99f855d7f4a4bc59d04fe5c
Author: Dan Horák <dan(a)danny.cz>
Date: Tue Nov 19 11:06:09 2013 +0100
- Fix segfault due memory corruption when reading topology info (#958953)
...ory_corruption_when_reading_topology_info.patch | 48 ++++++++++++++++++++
erlang.spec | 12 +++++-
2 files changed, 59 insertions(+), 1 deletions(-)
---
diff --git a/erlang-14B04-Fix_memory_corruption_when_reading_topology_info.patch
b/erlang-14B04-Fix_memory_corruption_when_reading_topology_info.patch
new file mode 100644
index 0000000..2b3e0ac
--- /dev/null
+++ b/erlang-14B04-Fix_memory_corruption_when_reading_topology_info.patch
@@ -0,0 +1,48 @@
+From 8c34a2dc70070cca8d97ad3c0f2dfbec1a0d82d8 Mon Sep 17 00:00:00 2001
+From: Sverker Eriksson <sverker(a)erlang.org>
+Date: Thu, 15 Mar 2012 16:42:40 +0100
+Subject: [PATCH] erts: Fix memory corruption when reading topology info
+
+If the number of processors actually found while reading sysfs
+is lower than the configured value, we realloc() the cpuinfo array
+to the smaller size, but we then iterate it using the original
+configured size, thus corrupting memory beyond the allocated
+block.
+---
+ erts/lib_src/common/erl_misc_utils.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/erts/lib_src/common/erl_misc_utils.c b/erts/lib_src/common/erl_misc_utils.c
+index 4806311..162c908 100644
+--- a/erts/lib_src/common/erl_misc_utils.c
++++ b/erts/lib_src/common/erl_misc_utils.c
+@@ -727,7 +727,7 @@ struct erts_cpu_info_t_ {
+
+ prev = NULL;
+ this = &cpuinfo->topology[0];
+- last = &cpuinfo->topology[cpuinfo->configured-1];
++ last = &cpuinfo->topology[cpuinfo->topology_size-1];
+ while (1) {
+ if (processor == this->processor) {
+ if (node != this->node)
+@@ -939,7 +939,7 @@ struct erts_cpu_info_t_ {
+
+ if (res > 1) {
+ prev = this++;
+- last = &cpuinfo->topology[cpuinfo->configured-1];
++ last = &cpuinfo->topology[cpuinfo->topology_size-1];
+
+ while (1) {
+ this->thread = ((this->node == prev->node
+@@ -1094,7 +1094,7 @@ struct erts_cpu_info_t_ {
+
+ if (res > 1) {
+ prev = this++;
+- last = &cpuinfo->topology[cpuinfo->configured-1];
++ last = &cpuinfo->topology[cpuinfo->topology_size-1];
+
+ while (1) {
+ this->thread = ((this->node == prev->node
+--
+1.8.4
+
diff --git a/erlang.spec b/erlang.spec
index 3694e83..d333bf0 100644
--- a/erlang.spec
+++ b/erlang.spec
@@ -25,7 +25,7 @@
Name: erlang
Version: %{upstream_ver}
-Release: %{upstream_rel_for_rpm}.2%{?dist}
+Release: %{upstream_rel_for_rpm}.3%{?dist}
Summary: General-purpose programming language and runtime environment
Group: Development/Languages
@@ -86,6 +86,10 @@ Patch9:
otp-0009-Ugly-workaround-for-java-1.5.0-gcj-which-doesn-t-sup.patch
Patch10: otp-0010-Remove-rpath-from-esock_ssl.patch
# end of autogenerated patch tag list
+# additional patches
+#
https://github.com/erlang/otp/commit/8c34a2dc70070cca8d97ad3c0f2dfbec1a0d...
+Patch100: erlang-14B04-Fix_memory_corruption_when_reading_topology_info.patch
+
# BuildRoot not strictly needed since F10, but keep it for spec file robustness
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
@@ -1008,6 +1012,9 @@ Erlang mode for XEmacs (source lisp files).
%patch10 -p1 -b .Remove_rpath_from_esock_ssl
# end of autogenerated prep patch list
+# additional patches
+%patch100 -p1 -b .Fix_memory_corruption_when_reading_topology_info
+
# remove shipped zlib sources
rm -f erts/emulator/zlib/*.[ch]
@@ -2318,6 +2325,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Tue Nov 19 2013 Dan Horák <dan[at]danny.cz> - R14B-04.3
+- Fix segfault due memory corruption when reading topology info (#958953)
+
* Sat Mar 02 2013 Peter Lemenkov <lemenkov(a)gmail.com> - R14B-04.2
- Add neccessary BuildRequires for SCTP (see rhbz #908530)
- Fixed erts provides