Backported fix for overflow in PCRE and several minor fixes

This commit is contained in:
Peter Lemenkov 2010-04-19 11:06:13 +00:00
parent 17390d5905
commit f69201d8f4
14 changed files with 300 additions and 133 deletions

View File

@ -3,7 +3,7 @@
Name: erlang
Version: %{ver}
Release: %{rel}.6%{?dist}.1
Release: %{rel}.8%{?dist}
Summary: General-purpose programming language and runtime environment
Group: Development/Languages
@ -12,11 +12,13 @@ URL: http://www.erlang.org
Source: http://www.erlang.org/download/otp_src_%{ver}-%{rel}.tar.gz
Source1: http://www.erlang.org/download/otp_doc_html_%{ver}-%{rel}.tar.gz
Source2: http://www.erlang.org/download/otp_doc_man_%{ver}-%{rel}.tar.gz
Patch0: otp-links.patch
Patch1: otp-install.patch
Patch2: otp-rpath.patch
Patch3: otp-sslrpath.patch
Patch6: otp-ssl_missing_libs.patch
Patch1: otp-R12B-5-0001-Do-not-create-links-instead-of-real-files.patch
Patch2: otp-R12B-5-0002-Fix-symlinking-of-epmd.patch
Patch3: otp-R12B-5-0003-Do-not-format-man-pages.patch
Patch4: otp-R12B-5-0004-Remove-rpath.patch
Patch5: otp-R12B-5-0005-Fix-missing-ssl-libraries-in-EPEL.patch
Patch6: otp-R12B-5-0006-Fix-shared-libraries-installation.patch
Patch7: otp-R12B-5-0007-Fix-check-for-compile-workspace-overflow.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: ncurses-devel
@ -52,11 +54,14 @@ Documentation for Erlang.
%prep
%setup -q -n otp_src_%{ver}-%{rel}
%patch0 -p1 -b .links
%patch1 -p1 -b .install
%patch2 -p1 -b .rpath
#%patch3 -p1 -b .sslrpath
%patch6 -p0 -b .keyutils
%patch1 -p1 -b .links
%patch2 -p1 -b .fyx_epmd_symlink
%patch3 -p1 -b .manpages
%patch4 -p1 -b .rpath_removal
%patch5 -p1 -b .missing_ssl_libraries
%patch6 -p1 -b .so_lib_install_fix
%patch7 -p1 -b .pcre_buffer_overflow
# enable dynamic linking for ssl
sed -i 's|SSL_DYNAMIC_ONLY=no|SSL_DYNAMIC_ONLY=yes|' erts/configure
@ -68,14 +73,13 @@ sed -i 's|@RX_LD@|gcc -shared|' lib/common_test/c_src/Makefile.in
sed -i 's|@RX_LDFLAGS@||' lib/common_test/c_src/Makefile.in
%build
# WARN: --enable-dynamic-ssl-lib needed for preventing strange messages about missing dependencies on EPEL
# see https://bugzilla.redhat.com/show_bug.cgi?id=458646 and https://bugzilla.redhat.com/show_bug.cgi?id=499525
# see https://bugzilla.redhat.com/458646 and https://bugzilla.redhat.com/499525
%ifarch sparcv9 sparc64
CFLAGS="-mcpu=ultrasparc -fno-strict-aliasing" ./configure --enable-dynamic-ssl-lib --prefix=%{_prefix} --exec-prefix=%{_prefix} --bindir=%{_bindir} --libdir=%{_libdir}
CFLAGS="$RPM_OPT_FLAGS -mcpu=ultrasparc -fno-strict-aliasing" %configure --enable-dynamic-ssl-lib
%else
CFLAGS="-fno-strict-aliasing" ./configure --enable-dynamic-ssl-lib --prefix=%{_prefix} --exec-prefix=%{_prefix} --bindir=%{_bindir} --libdir=%{_libdir}
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" %configure --enable-dynamic-ssl-lib
%endif
chmod -R u+w .
make
@ -131,8 +135,14 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Thu May 7 2009 Peter Lemenkov <lemenkov@gmail.com> - R12B-5.6
- added accidentally removed --enable-dynamic-ssl-lib
* Mon Apr 19 2010 Peter Lemenkov <lemenkov@gmail.com> - R12B-5.8
- Patches rebased
- Added patches 6,7 from trunk
- Use %%configure
* Tue Apr 21 2009 Debarshi Ray <rishi@fedoraproject.org> R12B-5.7
- Updated rpath patch.
- Fixed configure to respect $RPM_OPT_FLAGS.
* Sun Mar 1 2009 Gerard Milmeister <gemi@bluewin.ch> - R12B-5.6
- new release R12B-5

View File

@ -1,3 +1,4 @@
erlang-R12B-3_2_fc9:EL-5:erlang-R12B-3.2.fc9.src.rpm:1218402033
erlang-R12B-5_6_fc10:EL-5:erlang-R12B-5.6.fc10.src.rpm:1240063042
erlang-R12B-5_6_fc10_1:EL-5:erlang-R12B-5.6.fc10.1.src.rpm:1241692887
erlang-R12B-5_8_fc12:EL-5:erlang-R12B-5.8.fc12.src.rpm:1271675150

View File

@ -0,0 +1,27 @@
From c99976fbfdef713f66b8235b8b5346b51efc7b76 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Mon, 19 Apr 2010 13:31:43 +0400
Subject: [PATCH 1/7] Do not create links instead of real files
---
Makefile.in | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index e65bfc5..fb1f90d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -675,10 +675,6 @@ install.Install:
# Install erlang base public files
#
install.bin:
- for file in $(ERL_BASE_PUB_FILES); do \
- rm -f $(BINDIR)/$$file; \
- ${LN_S} $(ERLANG_BINDIR)/$$file $(BINDIR)/$$file; \
- done
#
# Directories needed before we can install
--
1.6.6.1

View File

@ -0,0 +1,25 @@
From 27c1838e985581f07972c6d069f9b682ec9e07b5 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Mon, 19 Apr 2010 13:33:50 +0400
Subject: [PATCH 2/7] Fix symlinking of epmd
---
erts/etc/unix/Install.src | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/erts/etc/unix/Install.src b/erts/etc/unix/Install.src
index 6568766..a6acfeb 100644
--- a/erts/etc/unix/Install.src
+++ b/erts/etc/unix/Install.src
@@ -87,7 +87,7 @@ if [ -h epmd ]; then
/bin/rm -f epmd
fi
-ln -s $ERL_ROOT/erts-%I_VSN%/bin/epmd epmd
+ln -s ../erts-%I_VSN%/bin/epmd epmd
cp -p $ERL_ROOT/erts-%I_VSN%/bin/run_erl .
cp -p $ERL_ROOT/erts-%I_VSN%/bin/to_erl .
--
1.6.6.1

View File

@ -0,0 +1,34 @@
From 5e704c7ad11d10904d136c5687b045f4f9ac8c96 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Mon, 19 Apr 2010 13:35:14 +0400
Subject: [PATCH 3/7] Do not format man-pages
---
erts/etc/unix/Install.src | 14 +-------------
1 files changed, 1 insertions(+), 13 deletions(-)
diff --git a/erts/etc/unix/Install.src b/erts/etc/unix/Install.src
index a6acfeb..5f7caac 100644
--- a/erts/etc/unix/Install.src
+++ b/erts/etc/unix/Install.src
@@ -136,16 +136,4 @@ if [ "X$TARGET" != "Xsunos5" -a -d $ERL_ROOT/usr/lib ]; then
(ranlib $library) > /dev/null 2>&1
done
fi
-
-
-#
-# Fixing the man pages
-#
-
-if [ -d $ERL_ROOT/man ]
-then
- cd $ERL_ROOT
- ./misc/format_man_pages $ERL_ROOT
-fi
-
-
+exit 0
--
1.6.6.1

View File

@ -0,0 +1,65 @@
From 03e261ee3152f3c45b23886e143c28bf2953f78d Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Mon, 19 Apr 2010 13:36:36 +0400
Subject: [PATCH 4/7] Remove rpath
---
lib/crypto/c_src/Makefile.in | 2 +-
lib/crypto/priv/Makefile | 2 +-
lib/ssl/c_src/Makefile.in | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/crypto/c_src/Makefile.in b/lib/crypto/c_src/Makefile.in
index fb9ebae..eddcd0a 100644
--- a/lib/crypto/c_src/Makefile.in
+++ b/lib/crypto/c_src/Makefile.in
@@ -80,7 +80,7 @@ ifeq ($(HOST_OS),)
HOST_OS := $(shell $(ERL_TOP)/erts/autoconf/config.guess)
endif
DYNAMIC_CRYPTO_LIB=@SSL_DYNAMIC_ONLY@
-LD_R_FLAG=@DED_LD_FLAG_RUNTIME_LIBRARY_PATH@
+LD_R_FLAG=
ifeq ($(strip $(LD_R_FLAG)),)
LD_R_OPT =
else
diff --git a/lib/crypto/priv/Makefile b/lib/crypto/priv/Makefile
index b8acdac..2c2989a 100644
--- a/lib/crypto/priv/Makefile
+++ b/lib/crypto/priv/Makefile
@@ -60,7 +60,7 @@ OBJS = $(OBJDIR)/crypto_drv.o
# ----------------------------------------------------
$(SO_DRIVER): $(OBJS)
- $(SO_LD) $(SO_LDFLAGS) -L$(SO_SSL_LIBDIR) -Wl,-R$(SO_SSL_LIBDIR) \
+ $(SO_LD) $(SO_LDFLAGS) -L$(SO_SSL_LIBDIR) \
-o $@ $^ -lcrypto
$(DLL_DRIVER): $(OBJS)
diff --git a/lib/ssl/c_src/Makefile.in b/lib/ssl/c_src/Makefile.in
index 57b2929..6fc1140 100644
--- a/lib/ssl/c_src/Makefile.in
+++ b/lib/ssl/c_src/Makefile.in
@@ -104,7 +104,7 @@ else
SSL_MAKEFILE =
endif
-CC_R_FLAG=@CFLAG_RUNTIME_LIBRARY_PATH@
+CC_R_FLAG=
ifeq ($(findstring @,$(CC_R_FLAG)),@)
# Old erts configure used which hasn't replaced @CFLAG_RUNTIME_LIBRARY_PATH@;
# we try our best here instead...
@@ -113,9 +113,9 @@ ifeq ($(findstring darwin,$(TARGET)),darwin) # darwin: no flag
CC_R_FLAG =
else
ifeq ($(findstring osf,$(TARGET)),osf) # osf1: -Wl,-rpath,
-CC_R_FLAG = -Wl,-rpath,
+CC_R_FLAG =
else # Default: -Wl,-R
-CC_R_FLAG = -Wl,-R
+CC_R_FLAG =
endif
endif
endif
--
1.6.6.1

View File

@ -0,0 +1,25 @@
From eb824c996de021797b6a4dcce233e5ddb54b8059 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Mon, 19 Apr 2010 13:39:17 +0400
Subject: [PATCH 5/7] Fix missing ssl-libraries in EPEL
---
lib/ssl/c_src/Makefile.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/ssl/c_src/Makefile.in b/lib/ssl/c_src/Makefile.in
index 6fc1140..9bdc2ad 100644
--- a/lib/ssl/c_src/Makefile.in
+++ b/lib/ssl/c_src/Makefile.in
@@ -40,7 +40,7 @@ VSN=$(SSL_VSN)
CC = @CC@
LD = @LD@
SHELL = /bin/sh
-LIBS = @LIBS@
+LIBS = @LIBS@ -lkeyutils -lselinux
PLAIN_CFLAGS = @CFLAGS@
# ----------------------------------------------------
--
1.6.6.1

View File

@ -0,0 +1,41 @@
From 43a522c155f9cdf60f741d10cee9b99402143437 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Mon, 19 Apr 2010 13:44:40 +0400
Subject: [PATCH 6/7] Fix shared libraries installation
Several shared libraries (asn1_erl_drv.so, megaco_flex_scanner_drv_mt.so,
megaco_flex_scanner_drv.so) were installed as data files previously.
---
lib/asn1/c_src/Makefile.in | 2 +-
lib/megaco/src/flex/Makefile.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/asn1/c_src/Makefile.in b/lib/asn1/c_src/Makefile.in
index e1aad44..73325bb 100644
--- a/lib/asn1/c_src/Makefile.in
+++ b/lib/asn1/c_src/Makefile.in
@@ -131,7 +131,7 @@ include $(ERL_TOP)/make/otp_release_targets.mk
release_spec: opt
$(INSTALL_DIR) $(RELSYSDIR)/priv/lib
- $(INSTALL_DATA) $(SHARED_OBJ_FILES) $(RELSYSDIR)/priv/lib
+ $(INSTALL_PROGRAM) $(SHARED_OBJ_FILES) $(RELSYSDIR)/priv/lib
$(INSTALL_DIR) $(RELSYSDIR)/c_src
$(INSTALL_DATA) $(C_FILES) $(RELSYSDIR)/c_src
diff --git a/lib/megaco/src/flex/Makefile.in b/lib/megaco/src/flex/Makefile.in
index 127f8b2..88c0876 100644
--- a/lib/megaco/src/flex/Makefile.in
+++ b/lib/megaco/src/flex/Makefile.in
@@ -219,7 +219,7 @@ release_spec: opt
$(INSTALL_DATA) $(TARGET_FILES) $(RELSYSDIR)/ebin
ifeq ($(ENABLE_MEGACO_FLEX_SCANNER),true)
$(INSTALL_DATA) $(FLEX_FILES) $(RELSYSDIR)/src/flex
- $(INSTALL_DATA) $(SOLIBS) $(RELSYSDIR)/priv/lib
+ $(INSTALL_PROGRAM) $(SOLIBS) $(RELSYSDIR)/priv/lib
endif
--
1.6.6.1

View File

@ -0,0 +1,55 @@
From 4c90a8bb06e8bed4b62e15b78b461edb0e606df5 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Mon, 19 Apr 2010 13:45:41 +0400
Subject: [PATCH 7/7] Fix check for compile workspace overflow
Patch from:
http://vcs.pcre.org/viewvc/code/trunk/pcre_compile.c?r1=504&r2=505&view=patch
Test case:
N = 819, re:compile([lists:duplicate(N, $(), lists:duplicate(N, $))]).
Compiling large regular expressions could overflow the workspace
buffer. Modify the test to check for a value smaller than the buffer
size.
---
erts/emulator/pcre/pcre_compile.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/erts/emulator/pcre/pcre_compile.c b/erts/emulator/pcre/pcre_compile.c
index 5d2be9a..08ce2b0 100644
--- a/erts/emulator/pcre/pcre_compile.c
+++ b/erts/emulator/pcre/pcre_compile.c
@@ -91,6 +91,11 @@ is 4 there is plenty of room. */
#define COMPILE_WORK_SIZE (4096)
+/* The overrun tests check for a slightly smaller size so that they detect the
+overrun before it actually does run off the end of the data block. */
+
+#define WORK_SIZE_CHECK (COMPILE_WORK_SIZE - 100)
+
/* Table for handling escaped characters in the range '0'-'z'. Positive returns
are simple data values; negative values are for special things like \d and so
@@ -2444,7 +2449,7 @@ for (;; ptr++)
#ifdef DEBUG
if (code > cd->hwm) cd->hwm = code; /* High water info */
#endif
- if (code > cd->start_workspace + COMPILE_WORK_SIZE) /* Check for overrun */
+ if (code > cd->start_workspace + WORK_SIZE_CHECK) /* Check for overrun */
{
*errorcodeptr = ERR52;
goto FAILED;
@@ -2493,7 +2498,7 @@ for (;; ptr++)
/* In the real compile phase, just check the workspace used by the forward
reference list. */
- else if (cd->hwm > cd->start_workspace + COMPILE_WORK_SIZE)
+ else if (cd->hwm > cd->start_workspace + WORK_SIZE_CHECK)
{
*errorcodeptr = ERR52;
goto FAILED;
--
1.6.6.1

View File

@ -1,29 +0,0 @@
--- otp_src_R9C-0/erts/etc/unix/Install.src.install 2003-10-17 12:52:14.000000000 +0200
+++ otp_src_R9C-0/erts/etc/unix/Install.src 2003-10-17 14:26:49.000000000 +0200
@@ -84,7 +84,7 @@
/bin/rm -f epmd
fi
-ln -s $ERL_ROOT/erts-%I_VSN%/bin/epmd epmd
+ln -s ../erts-%I_VSN%/bin/epmd epmd
cp -p $ERL_ROOT/erts-%I_VSN%/bin/run_erl .
cp -p $ERL_ROOT/erts-%I_VSN%/bin/to_erl .
@@ -145,16 +145,4 @@
(ranlib $library) > /dev/null 2>&1
done
fi
-
-
-#
-# Fixing the man pages
-#
-
-if [ -d $ERL_ROOT/man ]
-then
- cd $ERL_ROOT
- ./misc/format_man_pages $ERL_ROOT
-fi
-
-
+exit 0

View File

@ -1,13 +0,0 @@
--- otp_src_R11B-0/Makefile.in.links 2006-05-12 16:43:44.000000000 +0200
+++ otp_src_R11B-0/Makefile.in 2006-05-18 20:27:56.000000000 +0200
@@ -545,10 +545,6 @@
# Install erlang base public files
#
install.bin:
- for file in $(ERL_BASE_PUB_FILES); do \
- rm -f $(BINDIR)/$$file; \
- ${LN_S} $(ERLANG_BINDIR)/$$file $(BINDIR)/$$file; \
- done
#
# Directories needed before we can install

View File

@ -1,39 +0,0 @@
diff -up otp_src_R12B-4/lib/crypto/c_src/Makefile.in.rpath otp_src_R12B-4/lib/crypto/c_src/Makefile.in
--- otp_src_R12B-4/lib/crypto/c_src/Makefile.in.rpath 2008-10-25 22:20:42.000000000 +0200
+++ otp_src_R12B-4/lib/crypto/c_src/Makefile.in 2008-10-25 22:20:59.000000000 +0200
@@ -80,7 +80,7 @@ ifeq ($(HOST_OS),)
HOST_OS := $(shell $(ERL_TOP)/erts/autoconf/config.guess)
endif
DYNAMIC_CRYPTO_LIB=@SSL_DYNAMIC_ONLY@
-LD_R_FLAG=@DED_LD_FLAG_RUNTIME_LIBRARY_PATH@
+LD_R_FLAG=
ifeq ($(strip $(LD_R_FLAG)),)
LD_R_OPT =
else
diff -up otp_src_R12B-4/lib/crypto/priv/Makefile.rpath otp_src_R12B-4/lib/crypto/priv/Makefile
--- otp_src_R12B-4/lib/crypto/priv/Makefile.rpath 2008-10-25 22:21:11.000000000 +0200
+++ otp_src_R12B-4/lib/crypto/priv/Makefile 2008-10-25 22:21:33.000000000 +0200
@@ -60,7 +60,7 @@ OBJS = $(OBJDIR)/crypto_drv.o
# ----------------------------------------------------
$(SO_DRIVER): $(OBJS)
- $(SO_LD) $(SO_LDFLAGS) -L$(SO_SSL_LIBDIR) -Wl,-R$(SO_SSL_LIBDIR) \
+ $(SO_LD) $(SO_LDFLAGS) -L$(SO_SSL_LIBDIR) \
-o $@ $^ -lcrypto
$(DLL_DRIVER): $(OBJS)
diff -up otp_src_R12B-4/lib/ssl/c_src/Makefile.in.rpath otp_src_R12B-4/lib/ssl/c_src/Makefile.in
--- otp_src_R12B-4/lib/ssl/c_src/Makefile.in.rpath 2008-10-25 22:21:51.000000000 +0200
+++ otp_src_R12B-4/lib/ssl/c_src/Makefile.in 2008-10-25 22:22:21.000000000 +0200
@@ -111,9 +111,9 @@ ifeq ($(findstring darwin,$(TARGET)),dar
CC_R_FLAG =
else
ifeq ($(findstring osf,$(TARGET)),osf) # osf1: -Wl,-rpath,
-CC_R_FLAG = -Wl,-rpath,
+CC_R_FLAG =
else # Default: -Wl,-R
-CC_R_FLAG = -Wl,-R
+CC_R_FLAG =
endif
endif
endif

View File

@ -1,11 +0,0 @@
--- lib/ssl/c_src/Makefile.in 2008-03-27 13:43:04.000000000 +0300
+++ lib/ssl/c_src/Makefile.in 2008-03-27 14:03:27.000000000 +0300
@@ -38,7 +38,7 @@
CC = @CC@
LD = @LD@
SHELL = /bin/sh
-LIBS = @LIBS@
+LIBS = @LIBS@ -lkeyutils -lselinux
PLAIN_CFLAGS = @CFLAGS@
# ----------------------------------------------------

View File

@ -1,24 +0,0 @@
diff -up otp_src_R12B-4/lib/ssl/c_src/Makefile.in.sslrpath otp_src_R12B-4/lib/ssl/c_src/Makefile.in
--- otp_src_R12B-4/lib/ssl/c_src/Makefile.in.sslrpath 2008-10-26 00:00:37.000000000 +0200
+++ otp_src_R12B-4/lib/ssl/c_src/Makefile.in 2008-10-26 00:01:09.000000000 +0200
@@ -102,7 +102,7 @@ else
SSL_MAKEFILE =
endif
-CC_R_FLAG=@CFLAG_RUNTIME_LIBRARY_PATH@
+CC_R_FLAG=
ifeq ($(findstring @,$(CC_R_FLAG)),@)
# Old erts configure used which hasn't replaced @CFLAG_RUNTIME_LIBRARY_PATH@;
# we try our best here instead...
@@ -111,9 +111,9 @@ ifeq ($(findstring darwin,$(TARGET)),dar
CC_R_FLAG =
else
ifeq ($(findstring osf,$(TARGET)),osf) # osf1: -Wl,-rpath,
-CC_R_FLAG = -Wl,-rpath,
+CC_R_FLAG =
else # Default: -Wl,-R
-CC_R_FLAG = -Wl,-R
+CC_R_FLAG =
endif
endif
endif