Compare commits

..

2 commits

Author SHA1 Message Date
Peter Lemenkov
65440d429f Add missing dependency
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
2016-02-19 18:56:16 +03:00
Peter Lemenkov
37f1ff68a1 Fix segfault on ix86 (rhbz#1240487)
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
2016-02-10 15:07:19 +03:00
22 changed files with 3334 additions and 2527 deletions

64
.gitignore vendored
View file

@ -1,7 +1,57 @@
/*.src.rpm
/*~
/otp-OTP-*.tar.gz
/otp_doc_html_R*.tar.gz
/otp_doc_man_R*.tar.gz
/otp_src_R*.readme
/otp_src_R*.tar.gz
otp_src_R14A.tar.gz
/otp_src_R14B.tar.gz
/otp_doc_html_R14B.tar.gz
/otp_doc_man_R14B.tar.gz
/otp_doc_html_R14B01.tar.gz
/otp_doc_man_R14B01.tar.gz
/otp_src_R14B01.tar.gz
/otp_doc_html_R14B02.tar.gz
/otp_doc_man_R14B02.tar.gz
/otp_src_R14B02.tar.gz
/otp_src_R14B03.tar.gz
/otp_doc_html_R14B03.tar.gz
/otp_doc_man_R14B03.tar.gz
/otp_src_R14B04.tar.gz
/otp_doc_html_R14B04.tar.gz
/otp_doc_man_R14B04.tar.gz
/otp_doc_html_R15B.tar.gz
/otp_doc_man_R15B.tar.gz
/otp_src_R15B.tar.gz
/otp_doc_html_R15B01.tar.gz
/otp_doc_man_R15B01.tar.gz
/otp_src_R15B01.tar.gz
/otp_doc_html_R15B02.tar.gz
/otp_doc_man_R15B02.tar.gz
/otp_src_R15B02.tar.gz
/otp_doc_html_R15B03-1.tar.gz
/otp_doc_man_R15B03-1.tar.gz
/otp_src_R15B03-1.readme
/otp_src_R15B03-1.tar.gz
/otp_doc_html_R16A_RELEASE_CANDIDATE.tar.gz
/otp_doc_man_R16A_RELEASE_CANDIDATE.tar.gz
/otp_src_R16A_RELEASE_CANDIDATE.tar.gz
/otp_src_R16A_RELEASE_CANDIDATE.readme
/otp_src_R16B.tar.gz
/otp_doc_html_R16B.tar.gz
/otp_doc_man_R16B.tar.gz
/otp_src_R16B01.tar.gz
/otp_doc_html_R16B01.tar.gz
/otp_doc_man_R16B01.tar.gz
/otp_src_R16B01.readme
/otp_src_R16B02.tar.gz
/otp_doc_html_R16B02.tar.gz
/otp_doc_man_R16B02.tar.gz
/otp_src_R16B02.readme
/otp_src_R16B03.tar.gz
/otp_doc_html_R16B03.tar.gz
/otp_doc_man_R16B03.tar.gz
/otp_src_R16B03.readme
/otp_src_R16B03-1.readme
/otp_doc_html_R16B03-1.tar.gz
/otp_doc_man_R16B03-1.tar.gz
/otp_src_R16B03-1.tar.gz
/otp-OTP-17.2.1.tar.gz
/otp-OTP-17.2.2.tar.gz
/otp-OTP-17.3.3.tar.gz
/otp-OTP-17.3.4.tar.gz
/otp-OTP-17.4.tar.gz

View file

@ -2,7 +2,7 @@
Description=Erlang Port Mapper Daemon Activation Socket
[Socket]
ListenStream=4369
ListenStream=127.0.0.1:4369
Accept=false
[Install]

View file

@ -2,7 +2,7 @@
Description=Erlang Port Mapper Daemon Activation Socket
[Socket]
ListenStream=%I
ListenStream=%i:4369
Accept=false
[Install]

File diff suppressed because it is too large Load diff

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Do not format man-pages and do not install miscellaneous
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/erts/etc/common/Makefile.in b/erts/etc/common/Makefile.in
index 42af9c87dc..c017e0a4ed 100644
index 0cf965f..94e82a8 100644
--- a/erts/etc/common/Makefile.in
+++ b/erts/etc/common/Makefile.in
@@ -552,10 +552,6 @@ endif
@@ -550,10 +550,6 @@ endif
ifneq ($(INSTALL_TOP_BIN),)
$(INSTALL_PROGRAM) $(INSTALL_TOP_BIN) "$(RELEASE_PATH)"
endif
@ -21,10 +21,10 @@ index 42af9c87dc..c017e0a4ed 100644
$(INSTALL_DIR) "$(RELEASE_PATH)/erts-$(VSN)/src"
$(INSTALL_DATA) $(INSTALL_SRC) "$(RELEASE_PATH)/erts-$(VSN)/src"
diff --git a/erts/etc/unix/Install.src b/erts/etc/unix/Install.src
index b00dd09f1a..2147774f50 100644
index 8eb1db7..9e340bb 100644
--- a/erts/etc/unix/Install.src
+++ b/erts/etc/unix/Install.src
@@ -143,14 +143,5 @@ cp -p ../releases/%I_SYSTEM_VSN%/start_*.boot .
@@ -140,14 +140,5 @@ cp -p ../releases/%I_SYSTEM_VSN%/start_*.boot .
cp -p ../releases/%I_SYSTEM_VSN%/no_dot_erlang.boot .
cp -p $Name.boot start.boot
cp -p ../releases/%I_SYSTEM_VSN%/$Name.script start.script

View file

@ -5,15 +5,28 @@ Subject: [PATCH] Remove rpath
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/lib/crypto/c_src/Makefile.in b/lib/crypto/c_src/Makefile.in
index aedc9e7a13..b27c2aa01b 100644
index 8c92b5b..5b36c19 100644
--- a/lib/crypto/c_src/Makefile.in
+++ b/lib/crypto/c_src/Makefile.in
@@ -147,7 +147,7 @@ endif
endif
@@ -89,7 +89,7 @@ endif
DYNAMIC_CRYPTO_LIB=@SSL_DYNAMIC_ONLY@
ifeq ($(DYNAMIC_OR_WIN_CRYPTO_LIB),yes)
ifeq ($(DYNAMIC_CRYPTO_LIB),yes)
-SSL_DED_LD_RUNTIME_LIBRARY_PATH = @SSL_DED_LD_RUNTIME_LIBRARY_PATH@
+SSL_DED_LD_RUNTIME_LIBRARY_PATH =
CRYPTO_LINK_LIB=$(SSL_DED_LD_RUNTIME_LIBRARY_PATH) -L$(SSL_LIBDIR) -l$(SSL_CRYPTO_LIBNAME)
EXTRA_FLAGS = -DHAVE_DYNAMIC_CRYPTO_LIB
else
diff --git a/lib/crypto/priv/Makefile b/lib/crypto/priv/Makefile
index 0989f14..0d29444 100644
--- a/lib/crypto/priv/Makefile
+++ b/lib/crypto/priv/Makefile
@@ -60,7 +60,7 @@ OBJS = $(OBJDIR)/crypto.o
# ----------------------------------------------------
$(SO_NIFLIB): $(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_NIFLIB): $(OBJS)

View file

@ -14,46 +14,86 @@ https://bugzilla.redhat.com/818419
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/lib/asn1/c_src/Makefile b/lib/asn1/c_src/Makefile
index 82a6b6e87a..5f2fe8ba7d 100644
index a7cd03f..6da4d75 100644
--- a/lib/asn1/c_src/Makefile
+++ b/lib/asn1/c_src/Makefile
@@ -137,8 +137,6 @@ include $(ERL_TOP)/make/otp_release_targets.mk
release_spec: opt
$(INSTALL_DIR) "$(RELSYSDIR)/priv/lib"
@@ -142,8 +142,6 @@ release_spec: opt
ifneq ($(findstring ose,$(TARGET)),ose)
$(INSTALL_PROGRAM) $(NIF_SHARED_OBJ_FILE) "$(RELSYSDIR)/priv/lib"
endif
- $(INSTALL_DIR) "$(RELSYSDIR)/c_src"
- $(INSTALL_DATA) *.c "$(RELSYSDIR)/c_src"
release_docs_spec:
diff --git a/lib/crypto/c_src/Makefile.in b/lib/crypto/c_src/Makefile.in
index 5b36c19..470821e 100644
--- a/lib/crypto/c_src/Makefile.in
+++ b/lib/crypto/c_src/Makefile.in
@@ -199,14 +199,10 @@ docs:
include $(ERL_TOP)/make/otp_release_targets.mk
release_spec: opt
- $(INSTALL_DIR) "$(RELSYSDIR)/priv/obj"
$(INSTALL_DIR) "$(RELSYSDIR)/priv/lib"
- $(INSTALL_DATA) $(NIF_MAKEFILE) "$(RELSYSDIR)/priv/obj"
ifneq ($(findstring ose,$(TARGET)),ose)
- $(INSTALL_PROGRAM) $(CRYPTO_OBJS) "$(RELSYSDIR)/priv/obj"
$(INSTALL_PROGRAM) $(NIF_LIB) "$(RELSYSDIR)/priv/lib"
ifeq ($(DYNAMIC_CRYPTO_LIB),yes)
- $(INSTALL_PROGRAM) $(CALLBACK_OBJS) "$(RELSYSDIR)/priv/obj"
$(INSTALL_PROGRAM) $(CALLBACK_LIB) "$(RELSYSDIR)/priv/lib"
endif
endif
diff --git a/lib/erl_interface/src/Makefile.in b/lib/erl_interface/src/Makefile.in
index fa1ea3cd39..b977b6afe5 100644
index 7c09b60..2c14f9e 100644
--- a/lib/erl_interface/src/Makefile.in
+++ b/lib/erl_interface/src/Makefile.in
@@ -715,13 +715,11 @@ ifeq (@DYNAMIC_LIB@, yes)
endif
@@ -904,14 +904,14 @@ ifneq ($(EXE_TARGETS),)
$(INSTALL_PROGRAM) $(EXE_TARGETS) "$(RELSYSDIR)/bin"
endif
$(INSTALL_DATA) $(EXTRA) "$(RELSYSDIR)/src"
- $(INSTALL_DATA) connect/*.[ch] "$(RELSYSDIR)/src/connect"
- $(INSTALL_DATA) decode/*.[ch] "$(RELSYSDIR)/src/decode"
- $(INSTALL_DATA) encode/*.[ch] "$(RELSYSDIR)/src/encode"
- $(INSTALL_DATA) epmd/*.[ch] "$(RELSYSDIR)/src/epmd"
- $(INSTALL_DATA) misc/*.[ch] "$(RELSYSDIR)/src/misc"
- $(INSTALL_DATA) global/*.[ch] "$(RELSYSDIR)/src/global"
- $(INSTALL_DATA) registry/*.[ch] "$(RELSYSDIR)/src/registry"
- $(INSTALL_DATA) legacy/*.[ch] "$(RELSYSDIR)/src/legacy"
- $(INSTALL_DATA) prog/*.[ch] "$(RELSYSDIR)/src/prog"
+ $(INSTALL_DATA) connect/*.h "$(RELSYSDIR)/src/connect"
+ $(INSTALL_DATA) decode/*.h "$(RELSYSDIR)/src/decode"
+ $(INSTALL_DATA) encode/*.h "$(RELSYSDIR)/src/encode"
+ $(INSTALL_DATA) epmd/*.h "$(RELSYSDIR)/src/epmd"
+ $(INSTALL_DATA) misc/*.h "$(RELSYSDIR)/src/misc"
+ $(INSTALL_DATA) registry/*.h "$(RELSYSDIR)/src/registry"
+ $(INSTALL_DATA) legacy/*.h "$(RELSYSDIR)/src/legacy"
+ $(INSTALL_DATA) prog/*.h "$(RELSYSDIR)/src/prog"
release_docs:
diff --git a/lib/ic/c_src/Makefile.in b/lib/ic/c_src/Makefile.in
index ed860ab..96206ae 100644
--- a/lib/ic/c_src/Makefile.in
+++ b/lib/ic/c_src/Makefile.in
@@ -144,12 +144,10 @@ $(OBJDIR)/%.o: %.c
include $(ERL_TOP)/make/otp_release_targets.mk
release_spec: opt
- $(INSTALL_DIR) "$(RELSYSDIR)/c_src"
$(INSTALL_DIR) "$(RELSYSDIR)/include"
$(INSTALL_DIR) "$(RELSYSDIR)/priv/lib"
$(INSTALL_DIR) "$(RELEASE_PATH)/usr/include"
$(INSTALL_DIR) "$(RELEASE_PATH)/usr/lib"
- $(INSTALL_DATA) ic.c ic_tmo.c "$(RELSYSDIR)/c_src"
$(INSTALL_DATA) $(IDL_FILES) $(H_FILES) "$(RELSYSDIR)/include"
$(INSTALL_DATA) $(LIBRARY) "$(RELSYSDIR)/priv/lib"
$(INSTALL_DATA) $(IDL_FILES) $(H_FILES) "$(RELEASE_PATH)/usr/include"
diff --git a/lib/megaco/src/flex/Makefile.in b/lib/megaco/src/flex/Makefile.in
index 3649e2c392..d8c5c68b99 100644
index 6111cf2..bd62e8b 100644
--- a/lib/megaco/src/flex/Makefile.in
+++ b/lib/megaco/src/flex/Makefile.in
@@ -251,7 +251,7 @@ release_spec: opt
@@ -270,7 +270,7 @@ release_spec: opt
$(INSTALL_DATA) $(ERL_FILES) $(INTERNAL_HRL_FILES) "$(RELSYSDIR)/src/flex"
$(INSTALL_DATA) $(TARGET_FILES) "$(RELSYSDIR)/ebin"
ifeq ($(ENABLE_MEGACO_FLEX_SCANNER),true)
@ -63,10 +103,10 @@ index 3649e2c392..d8c5c68b99 100644
endif
diff --git a/lib/odbc/c_src/Makefile.in b/lib/odbc/c_src/Makefile.in
index d1b26743a6..cf8faae1f5 100644
index 6572d28..c7093ae 100644
--- a/lib/odbc/c_src/Makefile.in
+++ b/lib/odbc/c_src/Makefile.in
@@ -129,11 +129,8 @@ include $(ERL_TOP)/make/otp_release_targets.mk
@@ -128,11 +128,8 @@ include $(ERL_TOP)/make/otp_release_targets.mk
release_spec: opt
ifdef EXE_TARGET
@ -79,10 +119,10 @@ index d1b26743a6..cf8faae1f5 100644
endif
diff --git a/lib/os_mon/c_src/Makefile.in b/lib/os_mon/c_src/Makefile.in
index 27b156a2c9..f11ff303b6 100644
index f84ccf7..05d194f 100644
--- a/lib/os_mon/c_src/Makefile.in
+++ b/lib/os_mon/c_src/Makefile.in
@@ -126,8 +126,6 @@ $(OBJDIR)/memsup.o: memsup.h
@@ -125,8 +125,6 @@ $(OBJDIR)/memsup.o: memsup.h
include $(ERL_TOP)/make/otp_release_targets.mk
release_spec: opt
@ -91,3 +131,31 @@ index 27b156a2c9..f11ff303b6 100644
$(INSTALL_DIR) "$(RELSYSDIR)/priv/bin"
$(INSTALL_PROGRAM) $(TARGET_FILES) "$(RELSYSDIR)/priv/bin"
diff --git a/lib/runtime_tools/c_src/Makefile.in b/lib/runtime_tools/c_src/Makefile.in
index d46b499..4309aae 100644
--- a/lib/runtime_tools/c_src/Makefile.in
+++ b/lib/runtime_tools/c_src/Makefile.in
@@ -156,10 +156,8 @@ docs:
include $(ERL_TOP)/make/otp_release_targets.mk
release_spec: opt
- $(INSTALL_DIR) "$(RELSYSDIR)/priv/obj"
$(INSTALL_DIR) "$(RELSYSDIR)/priv/lib"
ifneq ($(findstring ose,$(TARGET)),ose)
- $(INSTALL_PROGRAM) $(DYNTRACE_OBJS) "$(RELSYSDIR)/priv/obj"
$(INSTALL_PROGRAM) $(NIF_LIB) $(SOLIBS) "$(RELSYSDIR)/priv/lib"
endif
diff --git a/lib/tools/c_src/Makefile.in b/lib/tools/c_src/Makefile.in
index b1eb69f..1acfdbf 100644
--- a/lib/tools/c_src/Makefile.in
+++ b/lib/tools/c_src/Makefile.in
@@ -197,8 +197,6 @@ include ../vsn.mk
RELSYSDIR = $(RELEASE_PATH)/lib/tools-$(TOOLS_VSN)
release_spec: all
- $(INSTALL_DIR) "$(RELSYSDIR)/c_src"
- $(INSTALL_DATA) $(EMEM_SRCS) $(EMEM_HEADERS) "$(RELSYSDIR)/c_src"
ifneq ($(PROGS),)
$(INSTALL_DIR) "$(RELSYSDIR)/bin"
$(INSTALL_PROGRAM) $(PROGS) "$(RELSYSDIR)/bin"

View file

@ -4,11 +4,24 @@ Subject: [PATCH] Do not install Java sources
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/lib/ic/java_src/com/ericsson/otp/ic/Makefile b/lib/ic/java_src/com/ericsson/otp/ic/Makefile
index 273614e..5b1fb57 100644
--- a/lib/ic/java_src/com/ericsson/otp/ic/Makefile
+++ b/lib/ic/java_src/com/ericsson/otp/ic/Makefile
@@ -112,8 +112,6 @@ docs:
include $(ERL_TOP)/make/otp_release_targets.mk
release_spec: opt
- $(INSTALL_DIR) "$(RELSYSDIR)/java_src/com/ericsson/otp/ic"
- $(INSTALL_DATA) $(JAVA_FILES) "$(RELSYSDIR)/java_src/com/ericsson/otp/ic"
$(INSTALL_DIR) "$(RELSYSDIR)/priv"
$(INSTALL_DATA) $(JAVA_DEST_ROOT)$(JARFILE) "$(RELSYSDIR)/priv"
diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile b/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile
index 089cf4ab1a..404654a437 100644
index ea3ab77..e95757e 100644
--- a/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile
+++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile
@@ -123,8 +123,6 @@ release release_docs release_tests release_html:
@@ -119,8 +119,6 @@ release release_docs release_tests release_html:
$(V_at)$(MAKE) $(MFLAGS) RELEASE_PATH="$(RELEASE_PATH)" $(TARGET_MAKEFILE) $@_spec
release_spec: opt

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Do not install nteventlog and related doc-files on non-win32
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/lib/os_mon/doc/src/Makefile b/lib/os_mon/doc/src/Makefile
index 8e3882bfdc..ea999cf9c7 100644
index 08fd23e..5606cfc 100644
--- a/lib/os_mon/doc/src/Makefile
+++ b/lib/os_mon/doc/src/Makefile
@@ -31,11 +31,16 @@ APPLICATION=os_mon
@@ -35,12 +35,17 @@ RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN)
# Target Specs
# ----------------------------------------------------
XML_APPLICATION_FILES = ref_man.xml
@ -21,32 +21,33 @@ index 8e3882bfdc..ea999cf9c7 100644
XML_REF3_FILES = cpu_sup.xml \
disksup.xml \
memsup.xml \
os_mon_mib.xml \
os_sup.xml \
- nteventlog.xml
+ $(NTEVENTLOG_DOCFILE)
XML_REF6_FILES = os_mon_app.xml
XML_REF6_FILES = os_mon_app.xml
diff --git a/lib/os_mon/src/Makefile b/lib/os_mon/src/Makefile
index e28fb12548..ee32f3946f 100644
index cd2dade..4e78cf8 100644
--- a/lib/os_mon/src/Makefile
+++ b/lib/os_mon/src/Makefile
@@ -34,7 +34,13 @@ RELSYSDIR = $(RELEASE_PATH)/lib/os_mon-$(VSN)
@@ -33,8 +33,13 @@ RELSYSDIR = $(RELEASE_PATH)/lib/os_mon-$(VSN)
# ----------------------------------------------------
# Target Specs
# ----------------------------------------------------
-MODULES= disksup memsup cpu_sup os_mon os_mon_mib os_sup os_mon_sysinfo nteventlog
+ifeq ($(findstring win32,$(TARGET)),win32)
+NTEVENTLOG=nteventlog
+else
+NTEVENTLOG=
+endif
+MODULES= disksup memsup cpu_sup os_mon os_mon_mib os_sup os_mon_sysinfo \
MODULES= disksup memsup cpu_sup os_mon os_mon_mib os_sup os_mon_sysinfo \
- nteventlog
+ $(NTEVENTLOG)
INCLUDE=../include
CSRC=../c_src
@@ -78,7 +84,11 @@ docs:
@@ -78,7 +83,11 @@ docs:
# ----------------------------------------------------
$(APP_TARGET): $(APP_SRC) ../vsn.mk

View file

@ -1,32 +0,0 @@
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Wed, 2 Aug 2017 16:12:19 +0300
Subject: [PATCH] Add extra search directory
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/lib/kernel/src/code_server.erl b/lib/kernel/src/code_server.erl
index 7327636751..2e92e77598 100644
--- a/lib/kernel/src/code_server.erl
+++ b/lib/kernel/src/code_server.erl
@@ -90,11 +90,17 @@ init(Ref, Parent, [Root,Mode]) ->
IPath =
case Mode of
interactive ->
- LibDir = filename:append(Root, "lib"),
- {ok,Dirs} = erl_prim_loader:list_dir(LibDir),
- Paths = make_path(LibDir, Dirs),
+ F = fun(R) ->
+ LD = filename:append(R, "lib"),
+ case erl_prim_loader:list_dir(LD) of
+ error -> [];
+ {ok, D} -> make_path(LD, D)
+ end
+ end,
+ Paths = F(Root),
+ SharedPaths = F("/usr/share/erlang"),
UserLibPaths = get_user_lib_dirs(),
- ["."] ++ UserLibPaths ++ Paths;
+ ["."] ++ UserLibPaths ++ Paths ++ SharedPaths;
_ ->
[]
end,

File diff suppressed because it is too large Load diff

View file

@ -1,31 +0,0 @@
From: Jan Pazdziora <jpazdziora@redhat.com>
Date: Thu, 10 May 2018 18:35:02 +0200
Subject: [PATCH] Avoid forking sed to get basename.
diff --git a/erts/etc/unix/erl.src.src b/erts/etc/unix/erl.src.src
index 536fa139d9..4dcffbc4c8 100644
--- a/erts/etc/unix/erl.src.src
+++ b/erts/etc/unix/erl.src.src
@@ -49,7 +49,7 @@ else
fi
BINDIR="$ROOTDIR/erts-%VSN%/bin"
EMU=%EMULATOR%%EMULATOR_NUMBER%
-PROGNAME=`basename "$0"`
+PROGNAME=${0##*/}
export EMU
export ROOTDIR
export BINDIR
diff --git a/erts/etc/unix/start_erl.src b/erts/etc/unix/start_erl.src
index 34e0369710..62e613bba1 100644
--- a/erts/etc/unix/start_erl.src
+++ b/erts/etc/unix/start_erl.src
@@ -37,7 +37,7 @@ VSN=`awk '{print $2}' $DataFile`
BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin
EMU=beam
-PROGNAME=`echo $0 | sed 's/.*\///'`
+PROGNAME=${0##*/}
export EMU
export ROOTDIR
export BINDIR

View file

@ -0,0 +1,40 @@
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Sat, 8 Nov 2014 22:54:57 +0300
Subject: [PATCH] Split off webtool dependency from tools
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/lib/tools/src/cover_web.erl b/lib/tools/src/cover_web.erl
index 69f2f3b..9085300 100644
--- a/lib/tools/src/cover_web.erl
+++ b/lib/tools/src/cover_web.erl
@@ -50,14 +50,25 @@
%%%----------------------------------------------------------------------
%% Start webtool and webcover from erlang shell
start() ->
- webtool:start(),
- webtool:start_tools([],"app=webcover"),
+ try
+ % Disable automatic dependency picking up
+ erlang:apply(webtool, start, []),
+ erlang:apply(webtool, start_tools, [[],"app=webcover"])
+ catch
+ error:undef -> error_logger:error_msg("No erlang-webtool found.~nPlease install erlang-webtool package first.~n")
+ end,
ok.
%% Stop webtool and webcover from erlang shell
stop() ->
- webtool:stop_tools([],"app=webcover"),
- webtool:stop().
+ try
+ % Disable automatic dependency picking up
+ erlang:apply(webtool, stop_tools, [[],"app=webcover"]),
+ erlang:apply(webtool, stop, [])
+ catch
+ error:undef -> error_logger:error_msg("No erlang-webtool found.~nPlease install erlang-webtool package first.~n")
+ end,
+ ok.

View file

@ -0,0 +1,63 @@
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Sat, 8 Nov 2014 15:11:04 +0300
Subject: [PATCH] Introduce os:getenv/2
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/lib/kernel/doc/src/os.xml b/lib/kernel/doc/src/os.xml
index 2b57e75..8b85f24 100644
--- a/lib/kernel/doc/src/os.xml
+++ b/lib/kernel/doc/src/os.xml
@@ -100,6 +100,19 @@ DirOut = os:cmd("dir"), % on Win32 platform</code>
</desc>
</func>
<func>
+ <name name="getenv" arity="2"/>
+ <fsummary>Get the value of an environment variable</fsummary>
+ <desc>
+ <p>Returns the <c><anno>Value</anno></c> of the environment variable
+ <c><anno>VarName</anno></c>, or <c>DefaultValue</c> if the environment variable
+ is undefined.</p>
+ <p>If Unicode file name encoding is in effect (see the <seealso
+ marker="erts:erl#file_name_encoding">erl manual
+ page</seealso>), the strings (both <c><anno>VarName</anno></c> and
+ <c><anno>Value</anno></c>) may contain characters with codepoints > 255.</p>
+ </desc>
+ </func>
+ <func>
<name name="getpid" arity="0"/>
<fsummary>Return the process identifier of the emulator process</fsummary>
<desc>
diff --git a/lib/kernel/src/os.erl b/lib/kernel/src/os.erl
index 187fd00..8aaf13b 100644
--- a/lib/kernel/src/os.erl
+++ b/lib/kernel/src/os.erl
@@ -26,7 +26,7 @@
%%% BIFs
--export([getenv/0, getenv/1, getpid/0, putenv/2, timestamp/0, unsetenv/1]).
+-export([getenv/0, getenv/1, getenv/2, getpid/0, putenv/2, timestamp/0, unsetenv/1]).
-spec getenv() -> [string()].
@@ -39,6 +39,19 @@ getenv() -> erlang:nif_error(undef).
getenv(_) ->
erlang:nif_error(undef).
+-spec getenv(VarName, DefaultValue) -> Value when
+ VarName :: string(),
+ DefaultValue :: string(),
+ Value :: string().
+
+getenv(VarName, DefaultValue) ->
+ case os:getenv(VarName) of
+ false ->
+ DefaultValue;
+ Value ->
+ Value
+ end.
+
-spec getpid() -> Value when
Value :: string().

View file

@ -1,25 +0,0 @@
From: Francois-Denis Gonthier <neumann@lostwebsite.net>
Date: Thu, 20 Sep 2018 15:01:18 +0300
Subject: [PATCH] Load man-pages from system-wide directory
Patch allows one to use standard man path with erl -man command.
(Erlang manual pages are placed to /usr/share/man/ hierarchy
as required by Debian policy.)
diff --git a/erts/etc/common/erlexec.c b/erts/etc/common/erlexec.c
index 888df87e35..14272f06c6 100644
--- a/erts/etc/common/erlexec.c
+++ b/erts/etc/common/erlexec.c
@@ -716,8 +716,10 @@ int main(int argc, char **argv)
error("-man not supported on Windows");
#else
argv[i] = "man";
- erts_snprintf(tmpStr, sizeof(tmpStr), "%s/man", rootdir);
- set_env("MANPATH", tmpStr);
+ /*
+ * Conform to erlang-manpages content.
+ */
+ putenv(strsave("MANSECT=3erl:1:5:7"));
execvp("man", argv+i);
error("Could not execute the 'man' command.");
#endif

View file

@ -1,464 +0,0 @@
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Thu, 19 Jun 2025 13:17:52 +0200
Subject: [PATCH] Add GDB tools
* https://github.com/erlang/otp-gdb-tools
* Commit 7b864f58c534699e4124e31ecfda86041b941037.
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/erts/etc/unix/gdb-tools/README.md b/erts/etc/unix/gdb-tools/README.md
new file mode 100644
index 0000000000..8a6cf92b1d
--- /dev/null
+++ b/erts/etc/unix/gdb-tools/README.md
@@ -0,0 +1,42 @@
+# Erlang/OTP GDB Tools
+
+This repository contains GDB tools that cannot
+be part of the main Erlang/OTP repository for licensing
+reasons. The tools are used when building and debugging
+Erlang/OTP with gdb and are installed as needed by the
+Erlang/OTP build system.
+
+Right now the only tool in this repository is the jit-reader
+which is a plugin to gdb that allows it to read the stack of
+Erlang processes when using the JIT. This allows commands
+such as `backtrace` to show Erlang stackframes. For example:
+
+```
+(gdb) bt
+#0 0x00007fffa40005ee in global::call_bif_shared ()
+#1 0x00007fffa411eaac in erl_eval:eval_lc1/7 () at erl_eval.erl:929
+#2 0x00007fffa411e7bc in erl_eval:eval_lc/7 () at erl_eval.erl:917
+#3 0x00007fffa4296528 in lists:map_1/2 () at lists.erl:2082
+#4 0x00007fffa4296554 in lists:map_1/2 () at lists.erl:2082
+#5 0x00007fffa4296554 in lists:map_1/2 () at lists.erl:2082
+#6 0x00007fffa4296554 in lists:map_1/2 () at lists.erl:2082
+.....
+#98 0x00007fffa4296554 in lists:map_1/2 () at lists.erl:2082
+#99 0x00007fffa4296554 in lists:map_1/2 () at lists.erl:2082
+#100 0x00007fffa4296554 in lists:map_1/2 () at lists.erl:2082
+#101 0x00007fffa42963d4 in lists:map/2 () at lists.erl:2077
+#102 0x00007fffa411e45c in erl_eval:do_apply/7 () at erl_eval.erl:904
+#103 0x00007fffa45f4c58 in shell:exprs/7 () at shell.erl:893
+#104 0x00007fffa45f42c4 in shell:eval_exprs/7 () at shell.erl:849
+#105 0x00007fffa45f3dac in shell:eval_loop/4 () at shell.erl:834
+#106 0x00007fffa40024b8 in erts_beamasm:normal_exit/0-CodeInfoPrologue ()
+Backtrace stopped: previous frame inner to this frame (corrupt stack?)
+(gdb)
+```
+
+## Updates of jit-reader
+
+When updating jit-reader you first need to update this repository
+and push the new version here. Then you need to run
+`./otp_build update_gdb_tools` in the Erlang/OTP repo for
+it to use the correct commit.
diff --git a/erts/etc/unix/gdb-tools/jit-reader.c b/erts/etc/unix/gdb-tools/jit-reader.c
new file mode 100644
index 0000000000..3c39c5540d
--- /dev/null
+++ b/erts/etc/unix/gdb-tools/jit-reader.c
@@ -0,0 +1,386 @@
+#include <gdb/jit-reader.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+
+/* Useful links
+ * - https://pwparchive.wordpress.com/2011/11/20/new-jit-interface-for-gdb/
+ * - https://sourceware.org/gdb/current/onlinedocs/gdb/Custom-Debug-Info.html
+ * - https://github.com/tetzank/asmjit-utilities
+ * - https://github.com/bminor/binutils-gdb/blob/master/gdb/testsuite/gdb.base/jitreader.c
+ */
+
+GDB_DECLARE_GPL_COMPATIBLE_READER
+
+#if 0
+#define HARD_DEBUG
+static FILE *log = NULL;
+#define LOG(...) do { fprintf(log, ##__VA_ARGS__); fflush(log); } while(0)
+#else
+#define LOG(...)
+#endif
+
+typedef enum {
+ X64_RBP = 6, /* Frame pointer iff native frames are enabled */
+ X64_RSP = 7, /* Stack pointer when using native stack */
+ X64_R12 = 12, /* Stack pointer when using non-native stack */
+ X64_R13 = 13, /* Current process */
+ X64_RIP = 16
+} X64Register;
+
+typedef enum {
+ /* Return address only */
+ ERTS_FRAME_LAYOUT_RA,
+ /* Frame pointer, return address */
+ ERTS_FRAME_LAYOUT_FP_RA
+} ErtsFrameLayout;
+
+struct emulator_info {
+ /* 0 = regular, 1 = frame pointers */
+ int frame_layout;
+ const void *normal_exit;
+};
+
+struct erlang_module_info {
+ uint64_t base_address;
+ uint32_t range_count;
+ uint32_t code_size;
+ /* Module name, including null terminator. */
+ uint16_t name_length;
+ char name[];
+ /* array of range_info structures */
+};
+
+struct range_info {
+ uint32_t start_offset;
+ uint32_t end_offset;
+ uint32_t line_count;
+ /* Range name, including null terminator. */
+ uint16_t name_length;
+ char name[];
+ /* array of line_info structures */
+};
+
+struct line_info {
+ uint32_t start_offset;
+ uint32_t line_number;
+ /* File name, including null terminator. */
+ uint16_t file_length;
+ char file[];
+};
+
+enum debug_info_header {
+ DEBUG_INFO_HEADER_EMULATOR = 0,
+ DEBUG_INFO_HEADER_MODULE = 1,
+};
+
+struct debug_info {
+ enum debug_info_header header;
+ union {
+ struct emulator_info emu;
+ struct erlang_module_info mod;
+ } payload;
+};
+
+typedef struct range {
+ GDB_CORE_ADDR start;
+ GDB_CORE_ADDR end;
+#ifdef HARD_DEBUG
+ char *name;
+#endif
+} range;
+
+typedef struct priv {
+ range *ranges;
+ int num_ranges;
+ ErtsFrameLayout frame_layout;
+ const void *normal_exit;
+} priv;
+
+static enum gdb_status read_module_info(struct gdb_reader_funcs *self,
+ struct gdb_symbol_callbacks *cb,
+ struct erlang_module_info *module_info) {
+ struct gdb_object *obj = cb->object_open(cb);
+ GDB_CORE_ADDR mod_start, mod_end;
+ char *symfile = (char*)module_info;
+ priv *priv = self->priv_data;
+
+ symfile += sizeof(*module_info) + module_info->name_length;
+
+ mod_start = module_info->base_address;
+ mod_end = mod_start + module_info->code_size;
+
+ priv->ranges = realloc(priv->ranges, (priv->num_ranges + 1) * sizeof(range));
+ priv->ranges[priv->num_ranges].start = mod_start;
+ priv->ranges[priv->num_ranges].end = mod_end;
+#ifdef HARD_DEBUG
+ priv->ranges[priv->num_ranges].name = strdup(module_info->name);
+#endif
+ priv->num_ranges += 1;
+
+ LOG("Add module `%s` (0x%lx, 0x%lx)\r\n",
+ module_info->name, mod_start, mod_end);
+
+ for (int range = 0; range < module_info->range_count; range++) {
+ struct range_info *range_info;
+ struct gdb_symtab *symtab;
+ GDB_CORE_ADDR begin, end;
+
+ range_info = (struct range_info *)symfile;
+ symfile += sizeof(*range_info) + range_info->name_length;
+
+ begin = mod_start + range_info->start_offset;
+ end = mod_start + range_info->end_offset;
+
+ LOG("Add range `%s` (0x%lx, 0x%lx), %u lines\r\n",
+ range_info->name,
+ begin, end,
+ range_info->line_count);
+
+ /* A bug in GDB < 9 forces us to open and close the symtab for each
+ * iteration. */
+ symtab = cb->symtab_open(cb, obj, module_info->name);
+ cb->block_open(cb, symtab, NULL, begin, end, range_info->name);
+ cb->symtab_close(cb, symtab);
+
+ for (int line = 0; line < range_info->line_count; line++) {
+ struct gdb_line_mapping line_mapping;
+ struct line_info *line_info;
+
+ line_info = (struct line_info *)symfile;
+ symfile += sizeof(*line_info) + line_info->file_length;
+
+ line_mapping.pc = mod_start + line_info->start_offset;
+ line_mapping.line = line_info->line_number;
+
+ LOG("\t%s:%u\r\n", line_info->file, line_info->line_number);
+
+ /* The symbol table must be opened and closed on every single line
+ * for file names to work properly, as there is no other way to
+ * tell GDB that a certain line belongs to a different file than
+ * the rest of the table. Sigh. */
+ symtab = cb->symtab_open(cb, obj, line_info->file);
+
+ cb->block_open(cb, symtab, NULL, line_mapping.pc, end,
+ range_info->name);
+ cb->line_mapping_add(cb, symtab, 1, &line_mapping);
+ cb->symtab_close(cb, symtab);
+ }
+ }
+
+ cb->object_close(cb, obj);
+
+ return GDB_SUCCESS;
+}
+
+static enum gdb_status read_emulator_info(struct gdb_reader_funcs *self,
+ struct gdb_symbol_callbacks *cb,
+ struct emulator_info *emulator_info) {
+ priv *priv = self->priv_data;
+
+ priv->frame_layout = emulator_info->frame_layout;
+ priv->normal_exit = emulator_info->normal_exit;
+
+ LOG("initialize: frame layout = %i\r\n", priv->frame_layout);
+
+ return GDB_SUCCESS;
+}
+
+static enum gdb_status read_debug_info(struct gdb_reader_funcs *self,
+ struct gdb_symbol_callbacks *cb,
+ void *memory, long memory_sz) {
+ struct debug_info *debug_info = memory;
+
+ (void)memory_sz;
+
+ switch (debug_info->header) {
+ case DEBUG_INFO_HEADER_EMULATOR:
+ return read_emulator_info(self, cb, &debug_info->payload.emu);
+ case DEBUG_INFO_HEADER_MODULE:
+ return read_module_info(self, cb, &debug_info->payload.mod);
+ }
+
+ return GDB_FAIL;
+}
+
+static void regfree(struct gdb_reg_value *reg) {
+ free(reg);
+}
+
+static struct range *get_range(priv *priv, GDB_CORE_ADDR rip) {
+ for (int i = 0; i < priv->num_ranges; i++) {
+ if (rip >= priv->ranges[i].start && rip < priv->ranges[i].end) {
+ return &priv->ranges[i];
+ }
+ }
+
+ return NULL;
+}
+
+static enum gdb_status unwind(struct gdb_reader_funcs *self,
+ struct gdb_unwind_callbacks *cb) {
+ GDB_CORE_ADDR rbp, rsp, rip;
+ struct range *range;
+ priv *priv;
+
+ rbp = *(GDB_CORE_ADDR*)cb->reg_get(cb, X64_RBP)->value;
+ rsp = *(GDB_CORE_ADDR*)cb->reg_get(cb, X64_RSP)->value;
+ rip = *(GDB_CORE_ADDR*)cb->reg_get(cb, X64_RIP)->value;
+
+ priv = self->priv_data;
+ range = get_range(priv, rip);
+
+ /* Check that rip points to one of the addresses that we handle */
+ if (range) {
+ struct gdb_reg_value *prev_rbp, *prev_rsp, *prev_rip;
+
+ prev_rbp = malloc(sizeof(struct gdb_reg_value) + sizeof(char*));
+ prev_rsp = malloc(sizeof(struct gdb_reg_value) + sizeof(char*));
+ prev_rip = malloc(sizeof(struct gdb_reg_value) + sizeof(char*));
+
+ LOG("UNWIND match %s: rbp: 0x%lx rsp: 0x%lx rip: 0x%lx \r\n",
+ range->name, rbp, rsp, rip);
+
+ prev_rbp->free = &regfree;
+ prev_rbp->defined = 1;
+ prev_rbp->size = sizeof(char*);
+ prev_rsp->free = &regfree;
+ prev_rsp->defined = 1;
+ prev_rsp->size = sizeof(char*);
+ prev_rip->free = &regfree;
+ prev_rip->defined = 1;
+ prev_rip->size = sizeof(char*);
+
+ if (priv->frame_layout == ERTS_FRAME_LAYOUT_FP_RA) {
+ /* Frame pointers are enabled, which means that rbp will point to
+ * where we stored the previous frames rbp. Also the previous
+ * frames address will be at rbp + 8 and the previous frames rsp
+ * will be rbp + 16.
+ *
+ * 0x00: <- prev_rsp
+ * 0x08: prev call addr
+ * 0x10: prev rbp <- curr rbp
+ * 0x18: current frame
+ * 0x20: <- curr rip */
+ cb->target_read(rbp + 1 * sizeof(char*), &prev_rip->value,
+ sizeof(char*));
+ cb->target_read(rbp + 0 * sizeof(char*), &prev_rbp->value,
+ sizeof(char*));
+ *(GDB_CORE_ADDR*)prev_rsp->value = rbp + sizeof(char*[2]);
+ } else {
+ /* Normal frame layout, we need to scan the stack. */
+ cb->target_read(rsp, &prev_rip->value, sizeof(char*));
+
+ for (rsp += sizeof(char*); ; rsp += sizeof(char*)) {
+ cb->target_read(rsp, &prev_rip->value, sizeof(char*));
+
+ LOG("rsp: 0x%lx rip: 0x%lx\r\n",
+ rsp, *(GDB_CORE_ADDR*)prev_rip->value);
+
+ /* Check if it is a cp */
+ if ((*(GDB_CORE_ADDR*)prev_rip->value & 0x3) == 0) {
+ break;
+ }
+ }
+
+ *(GDB_CORE_ADDR*)prev_rsp->value = rsp;
+ *(GDB_CORE_ADDR*)prev_rbp->value = rsp - sizeof(char*);
+ }
+
+ if (*(GDB_CORE_ADDR*)prev_rip->value == (uintptr_t)priv->normal_exit) {
+ LOG("Normal exit\r\n");
+ *(GDB_CORE_ADDR*)prev_rsp->value = 0;
+ *(GDB_CORE_ADDR*)prev_rbp->value = 0;
+ } else {
+ LOG("UNWIND prev: rbp: 0x%lx rsp: 0x%lx rip: 0x%lx\r\n",
+ *(GDB_CORE_ADDR*)prev_rbp->value,
+ *(GDB_CORE_ADDR*)prev_rsp->value,
+ *(GDB_CORE_ADDR*)prev_rip->value);
+ }
+
+ cb->reg_set(cb, X64_RIP, prev_rip);
+ cb->reg_set(cb, X64_RSP, prev_rsp);
+ cb->reg_set(cb, X64_RBP, prev_rbp);
+
+ return GDB_SUCCESS;
+ }
+
+ LOG("UNWIND no match: rbp: 0x%lx rsp: 0x%lx rip: 0x%lx\r\n", rbp, rsp, rip);
+ return GDB_FAIL;
+}
+
+static struct gdb_frame_id get_frame_id(struct gdb_reader_funcs *self,
+ struct gdb_unwind_callbacks *cb){
+ struct gdb_frame_id frame = {0, 0};
+ GDB_CORE_ADDR rbp, rsp, rip;
+ struct range *range;
+ priv *priv;
+
+ rbp = *(GDB_CORE_ADDR*)cb->reg_get(cb, X64_RBP)->value;
+ rsp = *(GDB_CORE_ADDR*)cb->reg_get(cb, X64_RSP)->value;
+ rip = *(GDB_CORE_ADDR*)cb->reg_get(cb, X64_RIP)->value;
+
+ priv = self->priv_data;
+ range = get_range(priv, rip);
+
+ LOG("FRAME: rip: 0x%lx rsp: 0x%lx rbp: 0x%lx \r\n", rip, rsp, rbp);
+
+ if (range) {
+ frame.code_address = rip;
+
+ if (priv->frame_layout == ERTS_FRAME_LAYOUT_FP_RA) {
+ frame.stack_address = rbp + sizeof(char*);
+ } else {
+ GDB_CORE_ADDR prev_rip;
+
+ for (rsp += sizeof(char*); ; rsp += sizeof(char*)) {
+ cb->target_read(rsp, &prev_rip, sizeof(char*));
+
+ LOG("rsp: 0x%lx rip: 0x%lx\r\n", rsp, prev_rip);
+
+ /* Check if it is a cp */
+ if ((prev_rip & 0x3) == 0) {
+ break;
+ }
+ }
+
+ frame.stack_address = rsp;
+ }
+ }
+
+ LOG("FRAME: code_address: 0x%lx stack_address: 0x%lx\r\n",
+ frame.code_address, frame.stack_address);
+
+ return frame;
+}
+
+static void destroy(struct gdb_reader_funcs *self){
+ free(self);
+}
+
+struct gdb_reader_funcs *gdb_init_reader(void){
+ struct gdb_reader_funcs *funcs = malloc(sizeof(struct gdb_reader_funcs));
+ priv *priv_data = malloc(sizeof(priv));
+
+ priv_data->num_ranges = 1;
+ priv_data->ranges = malloc(sizeof(range));
+ priv_data->ranges[0].start = 0;
+ priv_data->ranges[0].end = 0;
+
+ funcs->reader_version = GDB_READER_INTERFACE_VERSION;
+ funcs->priv_data = priv_data;
+
+ funcs->read = read_debug_info;
+ funcs->unwind = unwind;
+ funcs->get_frame_id = get_frame_id;
+ funcs->destroy = destroy;
+
+#ifdef HARD_DEBUG
+ log = fopen("/tmp/jit-reader.log","w+");
+ if (!log) fprintf(stderr,"Could not open /tmp/jit-reader.log");
+#endif
+
+ return funcs;
+}
diff --git a/erts/etc/unix/gdb-tools/jit-reader.mk b/erts/etc/unix/gdb-tools/jit-reader.mk
new file mode 100644
index 0000000000..8ef0bccec2
--- /dev/null
+++ b/erts/etc/unix/gdb-tools/jit-reader.mk
@@ -0,0 +1,9 @@
+EXTRA_LIBS = $(BINDIR)/jit-reader.so
+
+jit-reader: $(EXTRA_LIBS)
+
+$(OBJDIR)/jit-reader.o: $(GDB_TOOLS)/jit-reader.c $(GDB_TOOLS)/jit-reader.h
+ $(V_CC) $(DED_CFLAGS) -I$(ETC) -o $@ -c $<
+
+$(BINDIR)/jit-reader.so: $(OBJDIR)/jit-reader.o
+ $(V_LD) $(DED_LDFLAGS) -o $@ $^

View file

@ -0,0 +1,100 @@
From: Sergei Golovan <sgolovan@debian.org>
Date: Sun, 30 Nov 2014 20:20:41 +0300
Subject: [PATCH] Patch removes support for SSLv3 protocol because it is proved
to be insecure and nobody should use it anymore.
diff --git a/lib/ssl/doc/src/ssl.xml b/lib/ssl/doc/src/ssl.xml
index b53344e..b245621 100644
--- a/lib/ssl/doc/src/ssl.xml
+++ b/lib/ssl/doc/src/ssl.xml
@@ -123,7 +123,7 @@
<p><c>sslsocket() - opaque to the user. </c></p>
- <p><c>protocol() = sslv3 | tlsv1 | 'tlsv1.1' | 'tlsv1.2' </c></p>
+ <p><c>protocol() = tlsv1 | 'tlsv1.1' | 'tlsv1.2' </c></p>
<p><c>ciphers() = [ciphersuite()] | string() (according to old API)</c></p>
diff --git a/lib/ssl/doc/src/ssl_app.xml b/lib/ssl/doc/src/ssl_app.xml
index 43cb393..ff12e04 100644
--- a/lib/ssl/doc/src/ssl_app.xml
+++ b/lib/ssl/doc/src/ssl_app.xml
@@ -47,10 +47,10 @@
</p>
<p>Note that the environment parameters can be set on the command line,
for instance,</p>
- <p><c>erl ... -ssl protocol_version '[sslv3, tlsv1]' ...</c>.
+ <p><c>erl ... -ssl protocol_version '[tlsv1.1, tlsv1]' ...</c>.
</p>
<taglist>
- <tag><c><![CDATA[protocol_version = [sslv3|tlsv1] <optional>]]></c>.</tag>
+ <tag><c><![CDATA[protocol_version = [tlsv1|tlsv1.1|tlsv1.2] <optional>]]></c>.</tag>
<item>
<p>Protocol that will be supported by started clients and
servers. If this option is not set it will default to all
@@ -58,6 +58,9 @@
Note that this option may be overridden by the version option
to ssl:connect/[2,3] and ssl:listen/2.
</p>
+ <p>For Debian GNU/Linux distribution the sslv3 protocol was
+ disabled due to its security issues.
+ </p>
</item>
<tag><c><![CDATA[session_lifetime = integer() <optional>]]></c></tag>
diff --git a/lib/ssl/src/ssl_internal.hrl b/lib/ssl/src/ssl_internal.hrl
index 75efb64..155fa81 100644
--- a/lib/ssl/src/ssl_internal.hrl
+++ b/lib/ssl/src/ssl_internal.hrl
@@ -67,8 +67,8 @@
-define(TRUE, 0).
-define(FALSE, 1).
--define(ALL_SUPPORTED_VERSIONS, ['tlsv1.2', 'tlsv1.1', tlsv1, sslv3]).
--define(MIN_SUPPORTED_VERSIONS, ['tlsv1.1', tlsv1, sslv3]).
+-define(ALL_SUPPORTED_VERSIONS, ['tlsv1.2', 'tlsv1.1', tlsv1]).
+-define(MIN_SUPPORTED_VERSIONS, ['tlsv1.1', tlsv1]).
-define(ALL_DATAGRAM_SUPPORTED_VERSIONS, ['dtlsv1.2', dtlsv1]).
-define(MIN_DATAGRAM_SUPPORTED_VERSIONS, ['dtlsv1.2', dtlsv1]).
diff --git a/lib/ssl/src/ssl_record.hrl b/lib/ssl/src/ssl_record.hrl
index 6aab35d..1511abd 100644
--- a/lib/ssl/src/ssl_record.hrl
+++ b/lib/ssl/src/ssl_record.hrl
@@ -144,6 +144,7 @@
%% }).
-define(LOWEST_MAJOR_SUPPORTED_VERSION, 3).
+-define(LOWEST_MINOR_SUPPORTED_VERSION, 1).
-record(generic_stream_cipher, {
diff --git a/lib/ssl/src/tls_record.erl b/lib/ssl/src/tls_record.erl
index f50ea22..aa4fc8d 100644
--- a/lib/ssl/src/tls_record.erl
+++ b/lib/ssl/src/tls_record.erl
@@ -276,14 +276,20 @@ supported_protocol_versions([_|_] = Vsns) ->
%%--------------------------------------------------------------------
-spec is_acceptable_version(tls_version()) -> boolean().
is_acceptable_version({N,_})
- when N >= ?LOWEST_MAJOR_SUPPORTED_VERSION ->
+ when N > ?LOWEST_MAJOR_SUPPORTED_VERSION ->
+ true;
+is_acceptable_version({N,M})
+ when N == ?LOWEST_MAJOR_SUPPORTED_VERSION andalso M >= ?LOWEST_MINOR_SUPPORTED_VERSION ->
true;
is_acceptable_version(_) ->
false.
-spec is_acceptable_version(tls_version(), Supported :: [tls_version()]) -> boolean().
is_acceptable_version({N,_} = Version, Versions)
- when N >= ?LOWEST_MAJOR_SUPPORTED_VERSION ->
+ when N > ?LOWEST_MAJOR_SUPPORTED_VERSION ->
+ lists:member(Version, Versions);
+is_acceptable_version({N,M} = Version, Versions)
+ when N == ?LOWEST_MAJOR_SUPPORTED_VERSION andalso M >= ?LOWEST_MINOR_SUPPORTED_VERSION ->
lists:member(Version, Versions);
is_acceptable_version(_,_) ->
false.

View file

@ -0,0 +1,589 @@
From: Ingela Anderton Andin <ingela@erlang.org>
Date: Tue, 13 Jan 2015 15:16:20 +0100
Subject: [PATCH] ssl: Reenable padding check for TLS-1.0 and provide backwards
compatible disable option
diff --git a/lib/ssl/doc/src/ssl.xml b/lib/ssl/doc/src/ssl.xml
index b245621..c798364 100644
--- a/lib/ssl/doc/src/ssl.xml
+++ b/lib/ssl/doc/src/ssl.xml
@@ -4,7 +4,7 @@
<erlref>
<header>
<copyright>
- <year>1999</year><year>2014</year>
+ <year>1999</year><year>2015</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -348,11 +348,23 @@ fun(srp, Username :: string(), UserState :: term()) ->
</p>
</item>
+ <tag>{padding_check, boolean()}</tag>
+ <item>
+ <p> This option only affects TLS-1.0 connections.
+ If set to false it disables the block cipher padding check
+ to be able to interoperate with legacy software.
+ </p>
+
+ <warning><p> Using this option makes TLS vulnerable to
+ the Poodle attack</p></warning>
+
+ </item>
+
</taglist>
-
+
</section>
-
- <section>
+
+ <section>
<title>SSL OPTION DESCRIPTIONS - CLIENT SIDE</title>
<p>Options described here are client specific or has a slightly different
diff --git a/lib/ssl/src/dtls_record.erl b/lib/ssl/src/dtls_record.erl
index a7bbb6b..ae35dd7 100644
--- a/lib/ssl/src/dtls_record.erl
+++ b/lib/ssl/src/dtls_record.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2013-2014. All Rights Reserved.
+%% Copyright Ericsson AB 2013-2015. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -146,7 +146,7 @@ decode_cipher_text(#ssl_tls{type = Type, version = Version,
= ConnnectionStates0) ->
CompressAlg = SecParams#security_parameters.compression_algorithm,
{PlainFragment, Mac, ReadState1} = ssl_record:decipher(dtls_v1:corresponding_tls_version(Version),
- CipherFragment, ReadState0),
+ CipherFragment, ReadState0, true),
MacHash = calc_mac_hash(ReadState1, Type, Version, Epoch, Seq, PlainFragment),
case ssl_record:is_correct_mac(Mac, MacHash) of
true ->
diff --git a/lib/ssl/src/ssl.erl b/lib/ssl/src/ssl.erl
index b4bea25..4b7f495 100644
--- a/lib/ssl/src/ssl.erl
+++ b/lib/ssl/src/ssl.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2014. All Rights Reserved.
+%% Copyright Ericsson AB 1999-2015. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -656,7 +656,8 @@ handle_options(Opts0) ->
log_alert = handle_option(log_alert, Opts, true),
server_name_indication = handle_option(server_name_indication, Opts, undefined),
honor_cipher_order = handle_option(honor_cipher_order, Opts, false),
- protocol = proplists:get_value(protocol, Opts, tls)
+ protocol = proplists:get_value(protocol, Opts, tls),
+ padding_check = proplists:get_value(padding_check, Opts, true)
},
CbInfo = proplists:get_value(cb_info, Opts, {gen_tcp, tcp, tcp_closed, tcp_error}),
@@ -669,7 +670,7 @@ handle_options(Opts0) ->
cb_info, renegotiate_at, secure_renegotiate, hibernate_after,
erl_dist, next_protocols_advertised,
client_preferred_next_protocols, log_alert,
- server_name_indication, honor_cipher_order],
+ server_name_indication, honor_cipher_order, padding_check],
SockOpts = lists:foldl(fun(Key, PropList) ->
proplists:delete(Key, PropList)
@@ -847,6 +848,8 @@ validate_option(server_name_indication, undefined) ->
undefined;
validate_option(honor_cipher_order, Value) when is_boolean(Value) ->
Value;
+validate_option(padding_check, Value) when is_boolean(Value) ->
+ Value;
validate_option(Opt, Value) ->
throw({error, {options, {Opt, Value}}}).
diff --git a/lib/ssl/src/ssl_cipher.erl b/lib/ssl/src/ssl_cipher.erl
index 72467ea..ff9c618 100644
--- a/lib/ssl/src/ssl_cipher.erl
+++ b/lib/ssl/src/ssl_cipher.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2007-2014. All Rights Reserved.
+%% Copyright Ericsson AB 2007-2015. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -33,8 +33,7 @@
-include_lib("public_key/include/public_key.hrl").
-export([security_parameters/2, security_parameters/3, suite_definition/1,
- decipher/5, cipher/5,
- suite/1, suites/1, all_suites/1,
+ decipher/6, cipher/5, suite/1, suites/1, all_suites/1,
ec_keyed_suites/0, anonymous_suites/0, psk_suites/1, srp_suites/0,
openssl_suite/1, openssl_suite_name/1, filter/2, filter_suites/1,
hash_algorithm/1, sign_algorithm/1, is_acceptable_hash/2]).
@@ -143,17 +142,18 @@ block_cipher(Fun, BlockSz, #cipher_state{key=Key, iv=IV} = CS0,
{T, CS0#cipher_state{iv=NextIV}}.
%%--------------------------------------------------------------------
--spec decipher(cipher_enum(), integer(), #cipher_state{}, binary(), ssl_record:ssl_version()) ->
+-spec decipher(cipher_enum(), integer(), #cipher_state{}, binary(),
+ ssl_record:ssl_version(), boolean()) ->
{binary(), binary(), #cipher_state{}} | #alert{}.
%%
%% Description: Decrypts the data and the MAC using cipher described
%% by cipher_enum() and updating the cipher state.
%%-------------------------------------------------------------------
-decipher(?NULL, _HashSz, CipherState, Fragment, _) ->
+decipher(?NULL, _HashSz, CipherState, Fragment, _, _) ->
{Fragment, <<>>, CipherState};
-decipher(?RC4, HashSz, CipherState, Fragment, _) ->
+decipher(?RC4, HashSz, CipherState, Fragment, _, _) ->
State0 = case CipherState#cipher_state.state of
- undefined -> crypto:stream_init(rc4, CipherState#cipher_state.key);
+ undefined -> crypto:stream_init(rc4, CipherState#cipher_state.key);
S -> S
end,
try crypto:stream_decrypt(State0, Fragment) of
@@ -171,23 +171,23 @@ decipher(?RC4, HashSz, CipherState, Fragment, _) ->
?ALERT_REC(?FATAL, ?BAD_RECORD_MAC)
end;
-decipher(?DES, HashSz, CipherState, Fragment, Version) ->
+decipher(?DES, HashSz, CipherState, Fragment, Version, PaddingCheck) ->
block_decipher(fun(Key, IV, T) ->
crypto:block_decrypt(des_cbc, Key, IV, T)
- end, CipherState, HashSz, Fragment, Version);
-decipher(?'3DES', HashSz, CipherState, Fragment, Version) ->
+ end, CipherState, HashSz, Fragment, Version, PaddingCheck);
+decipher(?'3DES', HashSz, CipherState, Fragment, Version, PaddingCheck) ->
block_decipher(fun(<<K1:8/binary, K2:8/binary, K3:8/binary>>, IV, T) ->
crypto:block_decrypt(des3_cbc, [K1, K2, K3], IV, T)
- end, CipherState, HashSz, Fragment, Version);
-decipher(?AES, HashSz, CipherState, Fragment, Version) ->
+ end, CipherState, HashSz, Fragment, Version, PaddingCheck);
+decipher(?AES, HashSz, CipherState, Fragment, Version, PaddingCheck) ->
block_decipher(fun(Key, IV, T) when byte_size(Key) =:= 16 ->
crypto:block_decrypt(aes_cbc128, Key, IV, T);
(Key, IV, T) when byte_size(Key) =:= 32 ->
crypto:block_decrypt(aes_cbc256, Key, IV, T)
- end, CipherState, HashSz, Fragment, Version).
+ end, CipherState, HashSz, Fragment, Version, PaddingCheck).
block_decipher(Fun, #cipher_state{key=Key, iv=IV} = CipherState0,
- HashSz, Fragment, Version) ->
+ HashSz, Fragment, Version, PaddingCheck) ->
try
Text = Fun(Key, IV, Fragment),
NextIV = next_iv(Fragment, IV),
@@ -195,7 +195,7 @@ block_decipher(Fun, #cipher_state{key=Key, iv=IV} = CipherState0,
Content = GBC#generic_block_cipher.content,
Mac = GBC#generic_block_cipher.mac,
CipherState1 = CipherState0#cipher_state{iv=GBC#generic_block_cipher.next_iv},
- case is_correct_padding(GBC, Version) of
+ case is_correct_padding(GBC, Version, PaddingCheck) of
true ->
{Content, Mac, CipherState1};
false ->
@@ -1288,16 +1288,18 @@ generic_stream_cipher_from_bin(T, HashSz) ->
#generic_stream_cipher{content=Content,
mac=Mac}.
-%% For interoperability reasons we do not check the padding content in
-%% SSL 3.0 and TLS 1.0 as it is not strictly required and breaks
-%% interopability with for instance Google.
is_correct_padding(#generic_block_cipher{padding_length = Len,
- padding = Padding}, {3, N})
- when N == 0; N == 1 ->
- Len == byte_size(Padding);
-%% Padding must be check in TLS 1.1 and after
+ padding = Padding}, {3, 0}, _) ->
+ Len == byte_size(Padding); %% Only length check is done in SSL 3.0 spec
+%% For interoperability reasons it is possible to disable
+%% the padding check when using TLS 1.0, as it is not strictly required
+%% in the spec (only recommended), howerver this makes TLS 1.0 vunrable to the Poodle attack
+%% so by default this clause will not match
+is_correct_padding(GenBlockCipher, {3, 1}, false) ->
+ is_correct_padding(GenBlockCipher, {3, 0}, false);
+%% Padding must be checked in TLS 1.1 and after
is_correct_padding(#generic_block_cipher{padding_length = Len,
- padding = Padding}, _) ->
+ padding = Padding}, _, _) ->
Len == byte_size(Padding) andalso
list_to_binary(lists:duplicate(Len, Len)) == Padding.
diff --git a/lib/ssl/src/ssl_internal.hrl b/lib/ssl/src/ssl_internal.hrl
index 155fa81..1250b50 100644
--- a/lib/ssl/src/ssl_internal.hrl
+++ b/lib/ssl/src/ssl_internal.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2007-2014. All Rights Reserved.
+%% Copyright Ericsson AB 2007-2015. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -117,7 +117,8 @@
server_name_indication = undefined,
%% Should the server prefer its own cipher order over the one provided by
%% the client?
- honor_cipher_order = false
+ honor_cipher_order = false,
+ padding_check = true
}).
-record(socket_options,
diff --git a/lib/ssl/src/ssl_record.erl b/lib/ssl/src/ssl_record.erl
index 7337225..025a46b 100644
--- a/lib/ssl/src/ssl_record.erl
+++ b/lib/ssl/src/ssl_record.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2013-2014. All Rights Reserved.
+%% Copyright Ericsson AB 2013-2015. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -48,7 +48,7 @@
-export([compress/3, uncompress/3, compressions/0]).
%% Payload encryption/decryption
--export([cipher/4, decipher/3, is_correct_mac/2]).
+-export([cipher/4, decipher/4, is_correct_mac/2]).
-export_type([ssl_version/0, ssl_atom_version/0]).
@@ -376,8 +376,9 @@ cipher(Version, Fragment,
{CipherFragment, CipherS1} =
ssl_cipher:cipher(BulkCipherAlgo, CipherS0, MacHash, Fragment, Version),
{CipherFragment, WriteState0#connection_state{cipher_state = CipherS1}}.
+
%%--------------------------------------------------------------------
--spec decipher(ssl_version(), binary(), #connection_state{}) -> {binary(), binary(), #connection_state{}} | #alert{}.
+-spec decipher(ssl_version(), binary(), #connection_state{}, boolean()) -> {binary(), binary(), #connection_state{}} | #alert{}.
%%
%% Description: Payload decryption
%%--------------------------------------------------------------------
@@ -387,8 +388,8 @@ decipher(Version, CipherFragment,
BulkCipherAlgo,
hash_size = HashSz},
cipher_state = CipherS0
- } = ReadState) ->
- case ssl_cipher:decipher(BulkCipherAlgo, HashSz, CipherS0, CipherFragment, Version) of
+ } = ReadState, PaddingCheck) ->
+ case ssl_cipher:decipher(BulkCipherAlgo, HashSz, CipherS0, CipherFragment, Version, PaddingCheck) of
{PlainFragment, Mac, CipherS1} ->
CS1 = ReadState#connection_state{cipher_state = CipherS1},
{PlainFragment, Mac, CS1};
diff --git a/lib/ssl/src/tls_connection.erl b/lib/ssl/src/tls_connection.erl
index 7df73fb..77d3aa7 100644
--- a/lib/ssl/src/tls_connection.erl
+++ b/lib/ssl/src/tls_connection.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2007-2014. All Rights Reserved.
+%% Copyright Ericsson AB 2007-2015. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -482,8 +482,9 @@ next_record(#state{protocol_buffers = #protocol_buffers{tls_packets = [], tls_ci
next_record(#state{protocol_buffers =
#protocol_buffers{tls_packets = [], tls_cipher_texts = [CT | Rest]}
= Buffers,
- connection_states = ConnStates0} = State) ->
- case tls_record:decode_cipher_text(CT, ConnStates0) of
+ connection_states = ConnStates0,
+ ssl_options = #ssl_options{padding_check = Check}} = State) ->
+ case tls_record:decode_cipher_text(CT, ConnStates0, Check) of
{Plain, ConnStates} ->
{Plain, State#state{protocol_buffers =
Buffers#protocol_buffers{tls_cipher_texts = Rest},
diff --git a/lib/ssl/src/tls_record.erl b/lib/ssl/src/tls_record.erl
index aa4fc8d..bb7a701 100644
--- a/lib/ssl/src/tls_record.erl
+++ b/lib/ssl/src/tls_record.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2007-2014. All Rights Reserved.
+%% Copyright Ericsson AB 2007-2015. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -34,7 +34,7 @@
-export([get_tls_records/2]).
%% Decoding
--export([decode_cipher_text/2]).
+-export([decode_cipher_text/3]).
%% Encoding
-export([encode_plain_text/4]).
@@ -142,19 +142,21 @@ encode_plain_text(Type, Version, Data,
{CipherText, ConnectionStates#connection_states{current_write = WriteState#connection_state{sequence_number = Seq +1}}}.
%%--------------------------------------------------------------------
--spec decode_cipher_text(#ssl_tls{}, #connection_states{}) ->
+-spec decode_cipher_text(#ssl_tls{}, #connection_states{}, boolean()) ->
{#ssl_tls{}, #connection_states{}}| #alert{}.
%%
%% Description: Decode cipher text
%%--------------------------------------------------------------------
decode_cipher_text(#ssl_tls{type = Type, version = Version,
- fragment = CipherFragment} = CipherText, ConnnectionStates0) ->
- ReadState0 = ConnnectionStates0#connection_states.current_read,
- #connection_state{compression_state = CompressionS0,
- sequence_number = Seq,
- security_parameters = SecParams} = ReadState0,
- CompressAlg = SecParams#security_parameters.compression_algorithm,
- case ssl_record:decipher(Version, CipherFragment, ReadState0) of
+ fragment = CipherFragment} = CipherText,
+ #connection_states{current_read =
+ #connection_state{
+ compression_state = CompressionS0,
+ sequence_number = Seq,
+ security_parameters=
+ #security_parameters{compression_algorithm = CompressAlg}
+ } = ReadState0} = ConnnectionStates0, PaddingCheck) ->
+ case ssl_record:decipher(Version, CipherFragment, ReadState0, PaddingCheck) of
{PlainFragment, Mac, ReadState1} ->
MacHash = calc_mac_hash(Type, Version, PlainFragment, ReadState1),
case ssl_record:is_correct_mac(Mac, MacHash) of
diff --git a/lib/ssl/test/ssl_cipher_SUITE.erl b/lib/ssl/test/ssl_cipher_SUITE.erl
index 45e9178..0e48b67 100644
--- a/lib/ssl/test/ssl_cipher_SUITE.erl
+++ b/lib/ssl/test/ssl_cipher_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2015. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -38,7 +38,7 @@
suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
- [aes_decipher_good, aes_decipher_good_tls11, aes_decipher_fail, aes_decipher_fail_tls11].
+ [aes_decipher_good, aes_decipher_fail, padding_test].
groups() ->
[].
@@ -73,93 +73,123 @@ end_per_testcase(_TestCase, Config) ->
%% Test Cases --------------------------------------------------------
%%--------------------------------------------------------------------
aes_decipher_good() ->
- [{doc,"Decipher a known cryptotext."}].
+ [{doc,"Decipher a known cryptotext using a correct key"}].
aes_decipher_good(Config) when is_list(Config) ->
HashSz = 32,
- CipherState = #cipher_state{iv = <<59,201,85,117,188,206,224,136,5,109,46,70,104,79,4,9>>,
- key = <<72,196,247,97,62,213,222,109,210,204,217,186,172,184,197,148>>},
- Fragment = <<220,193,179,139,171,33,143,245,202,47,123,251,13,232,114,8,
- 190,162,74,31,186,227,119,155,94,74,119,79,169,193,240,160,
- 198,181,81,19,98,162,213,228,74,224,253,168,156,59,195,122,
- 108,101,107,242,20,15,169,150,163,107,101,94,93,104,241,165>>,
- Content = <<183,139,16,132,10,209,67,86,168,100,61,217,145,57,36,56, "HELLO\n">>,
- Mac = <<71,136,212,107,223,200,70,232,127,116,148,205,232,35,158,113,237,174,15,217,192,168,35,8,6,107,107,233,25,174,90,111>>,
- Version = {3,0},
- {Content, Mac, _} = ssl_cipher:decipher(?AES, HashSz, CipherState, Fragment, Version),
- Version1 = {3,1},
- {Content, Mac, _} = ssl_cipher:decipher(?AES, HashSz, CipherState, Fragment, Version1),
- ok.
-
-%%--------------------------------------------------------------------
-
-aes_decipher_good_tls11() ->
- [{doc,"Decipher a known TLS 1.1 cryptotext."}].
-
-%% the fragment is actuall a TLS 1.1 record, with
-%% Version = TLS 1.1, we get the correct NextIV in #cipher_state
-aes_decipher_good_tls11(Config) when is_list(Config) ->
- HashSz = 32,
- CipherState = #cipher_state{iv = <<59,201,85,117,188,206,224,136,5,109,46,70,104,79,4,9>>,
- key = <<72,196,247,97,62,213,222,109,210,204,217,186,172,184,197,148>>},
- Fragment = <<220,193,179,139,171,33,143,245,202,47,123,251,13,232,114,8,
- 190,162,74,31,186,227,119,155,94,74,119,79,169,193,240,160,
- 198,181,81,19,98,162,213,228,74,224,253,168,156,59,195,122,
- 108,101,107,242,20,15,169,150,163,107,101,94,93,104,241,165>>,
- Content = <<"HELLO\n">>,
- NextIV = <<183,139,16,132,10,209,67,86,168,100,61,217,145,57,36,56>>,
- Mac = <<71,136,212,107,223,200,70,232,127,116,148,205,232,35,158,113,237,174,15,217,192,168,35,8,6,107,107,233,25,174,90,111>>,
- Version = {3,2},
- {Content, Mac, #cipher_state{iv = NextIV}} = ssl_cipher:decipher(?AES, HashSz, CipherState, Fragment, Version),
- Version1 = {3,2},
- {Content, Mac, #cipher_state{iv = NextIV}} = ssl_cipher:decipher(?AES, HashSz, CipherState, Fragment, Version1),
- ok.
+ CipherState = correct_cipher_state(),
+ decipher_check_good(HashSz, CipherState, {3,0}),
+ decipher_check_good(HashSz, CipherState, {3,1}),
+ decipher_check_good(HashSz, CipherState, {3,2}),
+ decipher_check_good(HashSz, CipherState, {3,3}).
%%--------------------------------------------------------------------
aes_decipher_fail() ->
- [{doc,"Decipher a known cryptotext."}].
+ [{doc,"Decipher a known cryptotext using a incorrect key"}].
-%% same as above, last byte of key replaced
aes_decipher_fail(Config) when is_list(Config) ->
HashSz = 32,
- CipherState = #cipher_state{iv = <<59,201,85,117,188,206,224,136,5,109,46,70,104,79,4,9>>,
- key = <<72,196,247,97,62,213,222,109,210,204,217,186,172,184,197,254>>},
- Fragment = <<220,193,179,139,171,33,143,245,202,47,123,251,13,232,114,8,
- 190,162,74,31,186,227,119,155,94,74,119,79,169,193,240,160,
- 198,181,81,19,98,162,213,228,74,224,253,168,156,59,195,122,
- 108,101,107,242,20,15,169,150,163,107,101,94,93,104,241,165>>,
- Version = {3,0},
- {Content, Mac, _} = ssl_cipher:decipher(?AES, HashSz, CipherState, Fragment, Version),
- 32 = byte_size(Content),
- 32 = byte_size(Mac),
- Version1 = {3,1},
- {Content1, Mac1, _} = ssl_cipher:decipher(?AES, HashSz, CipherState, Fragment, Version1),
- 32 = byte_size(Content1),
- 32 = byte_size(Mac1),
- ok.
-%%--------------------------------------------------------------------
-
-aes_decipher_fail_tls11() ->
- [{doc,"Decipher a known TLS 1.1 cryptotext."}].
-
-%% same as above, last byte of key replaced
-%% stricter padding checks in TLS 1.1 mean we get an alert instead
-aes_decipher_fail_tls11(Config) when is_list(Config) ->
- HashSz = 32,
- CipherState = #cipher_state{iv = <<59,201,85,117,188,206,224,136,5,109,46,70,104,79,4,9>>,
- key = <<72,196,247,97,62,213,222,109,210,204,217,186,172,184,197,254>>},
- Fragment = <<220,193,179,139,171,33,143,245,202,47,123,251,13,232,114,8,
- 190,162,74,31,186,227,119,155,94,74,119,79,169,193,240,160,
- 198,181,81,19,98,162,213,228,74,224,253,168,156,59,195,122,
- 108,101,107,242,20,15,169,150,163,107,101,94,93,104,241,165>>,
- Version = {3,2},
- #alert{level = ?FATAL, description = ?BAD_RECORD_MAC} =
- ssl_cipher:decipher(?AES, HashSz, CipherState, Fragment, Version),
- Version1 = {3,3},
- #alert{level = ?FATAL, description = ?BAD_RECORD_MAC} =
- ssl_cipher:decipher(?AES, HashSz, CipherState, Fragment, Version1),
- ok.
+ CipherState = incorrect_cipher_state(),
+ decipher_check_fail(HashSz, CipherState, {3,0}),
+ decipher_check_fail(HashSz, CipherState, {3,1}),
+ decipher_check_fail(HashSz, CipherState, {3,2}),
+ decipher_check_fail(HashSz, CipherState, {3,3}).
%%--------------------------------------------------------------------
+padding_test(Config) when is_list(Config) ->
+ HashSz = 16,
+ CipherState = correct_cipher_state(),
+ pad_test(HashSz, CipherState, {3,0}),
+ pad_test(HashSz, CipherState, {3,1}),
+ pad_test(HashSz, CipherState, {3,2}),
+ pad_test(HashSz, CipherState, {3,3}).
+
+%%--------------------------------------------------------------------
+% Internal functions --------------------------------------------------------
+%%--------------------------------------------------------------------
+decipher_check_good(HashSz, CipherState, Version) ->
+ {Content, NextIV, Mac} = content_nextiv_mac(Version),
+ {Content, Mac, #cipher_state{iv = NextIV}} =
+ ssl_cipher:decipher(?AES, HashSz, CipherState, aes_fragment(Version), Version, true).
+
+decipher_check_fail(HashSz, CipherState, Version) ->
+ {Content, NextIV, Mac} = content_nextiv_mac(Version),
+ true = {Content, Mac, #cipher_state{iv = NextIV}} =/=
+ ssl_cipher:decipher(?AES, HashSz, CipherState, aes_fragment(Version), Version, true).
+
+pad_test(HashSz, CipherState, {3,0} = Version) ->
+ %% 3.0 does not have padding test
+ {Content, NextIV, Mac} = badpad_content_nextiv_mac(Version),
+ {Content, Mac, #cipher_state{iv = NextIV}} =
+ ssl_cipher:decipher(?AES, HashSz, CipherState, badpad_aes_fragment({3,0}), {3,0}, true),
+ {Content, Mac, #cipher_state{iv = NextIV}} =
+ ssl_cipher:decipher(?AES, HashSz, CipherState, badpad_aes_fragment({3,0}), {3,0}, false);
+pad_test(HashSz, CipherState, {3,1} = Version) ->
+ %% 3.1 should have padding test, but may be disabled
+ {Content, NextIV, Mac} = badpad_content_nextiv_mac(Version),
+ BadCont = badpad_content(Content),
+ {Content, Mac, #cipher_state{iv = NextIV}} =
+ ssl_cipher:decipher(?AES, HashSz, CipherState, badpad_aes_fragment({3,1}) , {3,1}, false),
+ {BadCont, Mac, #cipher_state{iv = NextIV}} =
+ ssl_cipher:decipher(?AES, HashSz, CipherState, badpad_aes_fragment({3,1}), {3,1}, true);
+pad_test(HashSz, CipherState, Version) ->
+ %% 3.2 and 3.3 must have padding test
+ {Content, NextIV, Mac} = badpad_content_nextiv_mac(Version),
+ BadCont = badpad_content(Content),
+ {BadCont, Mac, #cipher_state{iv = NextIV}} = ssl_cipher:decipher(?AES, HashSz, CipherState,
+ badpad_aes_fragment(Version), Version, false),
+ {BadCont, Mac, #cipher_state{iv = NextIV}} = ssl_cipher:decipher(?AES, HashSz, CipherState,
+ badpad_aes_fragment(Version), Version, true).
+
+aes_fragment({3,N}) when N == 0; N == 1->
+ <<197,9,6,109,242,87,80,154,85,250,110,81,119,95,65,185,53,206,216,153,246,169,
+ 119,177,178,238,248,174,253,220,242,81,33,0,177,251,91,44,247,53,183,198,165,
+ 63,20,194,159,107>>;
+
+aes_fragment(_) ->
+ <<220,193,179,139,171,33,143,245,202,47,123,251,13,232,114,8,
+ 190,162,74,31,186,227,119,155,94,74,119,79,169,193,240,160,
+ 198,181,81,19,98,162,213,228,74,224,253,168,156,59,195,122,
+ 108,101,107,242,20,15,169,150,163,107,101,94,93,104,241,165>>.
+
+badpad_aes_fragment({3,N}) when N == 0; N == 1 ->
+ <<186,139,125,10,118,21,26,248,120,108,193,104,87,118,145,79,225,55,228,10,105,
+ 30,190,37,1,88,139,243,210,99,65,41>>;
+badpad_aes_fragment(_) ->
+ <<137,31,14,77,228,80,76,103,183,125,55,250,68,190,123,131,117,23,229,180,207,
+ 94,121,137,117,157,109,99,113,61,190,138,131,229,201,120,142,179,172,48,77,
+ 234,19,240,33,38,91,93>>.
+
+content_nextiv_mac({3,N}) when N == 0; N == 1 ->
+ {<<"HELLO\n">>,
+ <<33,0, 177,251, 91,44, 247,53, 183,198, 165,63, 20,194, 159,107>>,
+ <<71,136,212,107,223,200,70,232,127,116,148,205,232,35,158,113,237,174,15,217,192,168,35,8,6,107,107,233,25,174,90,111>>};
+content_nextiv_mac(_) ->
+ {<<"HELLO\n">>,
+ <<183,139,16,132,10,209,67,86,168,100,61,217,145,57,36,56>>,
+ <<71,136,212,107,223,200,70,232,127,116,148,205,232,35,158,113,237,174,15,217,192,168,35,8,6,107,107,233,25,174,90,111>>}.
+
+badpad_content_nextiv_mac({3,N}) when N == 0; N == 1 ->
+ {<<"HELLO\n">>,
+ <<225,55,228,10,105,30,190,37,1,88,139,243,210,99,65,41>>,
+ <<183,139,16,132,10,209,67,86,168,100,61,217,145,57,36,56>>
+ };
+badpad_content_nextiv_mac(_) ->
+ {<<"HELLO\n">>,
+ <<133,211,45,189,179,229,56,86,11,178,239,159,14,160,253,140>>,
+ <<183,139,16,132,10,209,67,86,168,100,61,217,145,57,36,56>>
+ }.
+
+badpad_content(Content) ->
+ %% BadContent will fail mac test
+ <<16#F0, Content/binary>>.
+
+correct_cipher_state() ->
+ #cipher_state{iv = <<59,201,85,117,188,206,224,136,5,109,46,70,104,79,4,9>>,
+ key = <<72,196,247,97,62,213,222,109,210,204,217,186,172,184,197,148>>}.
+
+incorrect_cipher_state() ->
+ #cipher_state{iv = <<59,201,85,117,188,206,224,136,5,109,46,70,104,79,4,9>>,
+ key = <<72,196,247,97,62,213,222,109,210,204,217,186,172,184,197,254>>}.

View file

@ -0,0 +1,27 @@
From: Rickard Green <rickard@erlang.org>
Date: Tue, 9 Feb 2016 18:23:26 +0100
Subject: [PATCH] Quickfix for cmpxchg8b inline asm when pic and gcc >= 5.0 is
used
diff --git a/erts/include/internal/i386/ethr_dw_atomic.h b/erts/include/internal/i386/ethr_dw_atomic.h
index 9fb89bb..89f32f7 100644
--- a/erts/include/internal/i386/ethr_dw_atomic.h
+++ b/erts/include/internal/i386/ethr_dw_atomic.h
@@ -114,6 +114,8 @@ ethr_native_dw_atomic_addr(ethr_native_dw_atomic_t *var)
return (ethr_sint_t *) ETHR_DW_NATMC_MEM__(var);
}
+#if !ETHR_AT_LEAST_GCC_VSN__(5, 0, 0)
+
#if ETHR_SIZEOF_PTR == 4 && defined(__PIC__) && __PIC__
/*
* When position independent code is used in 32-bit mode, the EBX register
@@ -137,6 +139,7 @@ ethr_native_dw_atomic_addr(ethr_native_dw_atomic_t *var)
# endif
#endif
+#endif /* < gcc-5.0 */
#define ETHR_HAVE_ETHR_NATIVE_DW_ATOMIC_CMPXCHG_MB

View file

@ -17,6 +17,18 @@
#
# # start of autogenerated patch tag list
# # end of autogenerated patch tag list
# # start of autogenerated prep patch list
# # end of autogenerated prep patch list
#
# The following special comment lines in the git commit messages
# will be interpreted:
#
# Fedora-Spec-Comment: This patch only applies to EL6 builds
# Fedora-Spec-Before: %if 0%?el6}
# Fedora-Spec-After: %endif
#
# If there is no "Fedora-Spec-Comment:" line, we will use
# "Fedora specific patch".
# Command line parsing
otp_dir="${1:?'Fatal: otp git repo dir required'}"
@ -37,29 +49,44 @@ test -s "$tmpdir/patch-list.txt"
# Process patch files
echo "# start of autogenerated patch tag list" > "$tmpdir/patch-list-tags.txt"
echo "# start of autogenerated prep patch list" > "$tmpdir/patch-list-prep.txt"
n=1
while read patch
do
otppatch="$(dirname "$patch")/otp-$(basename "$patch")"
${SED-sed} -e '1d' -e '/^-- $/,$d' "$patch" > "$otppatch"
rm -f "$patch"
comment="$(sed -n 's/^Fedora-Spec-Comment:\s*//p' "$otppatch")"
if test "x$comment" = "x"; then comment="Fedora specific patch"; fi
echo "# ${comment}" >> "$tmpdir/patch-list-tags.txt"
echo "# $(sed -n 's/^Subject: \[PATCH\] //p' "$otppatch")" >> "$tmpdir/patch-list-tags.txt"
echo "Patch$n: $(basename "$otppatch")" >> "$tmpdir/patch-list-tags.txt"
base="$(basename "$patch" ".patch" | sed 's/^00[0-9][0-9]-//')"
backupext=".$(echo -n "$base" | tr -c -s '[:alnum:]' '_')"
sed -n 's/^Fedora-Spec-Before:\s*//p' "$otppatch" >> "$tmpdir/patch-list-prep.txt"
echo "%patch$n -p1 -b ${backupext}" >> "$tmpdir/patch-list-prep.txt"
sed -n 's/^Fedora-Spec-After:\s*//p' "$otppatch" >> "$tmpdir/patch-list-prep.txt"
n=$(($n + 1))
done < "$tmpdir/patch-list.txt"
echo "# end of autogenerated patch tag list" >> "$tmpdir/patch-list-tags.txt"
echo "# end of autogenerated prep patch list" >> "$tmpdir/patch-list-prep.txt"
# Create updated spec file
specfile="erlang.spec"
newspec1="${tmpdir}/${specfile}.new1"
newspec2="${tmpdir}/${specfile}.new2"
sed '/^# start of autogenerated patch tag list$/,$d' "$specfile" > "$newspec1"
cat "$tmpdir/patch-list-tags.txt" >> "$newspec1"
sed '1,/^# end of autogenerated patch tag list/d' "$specfile" >> "$newspec1"
sed '/^# start of autogenerated prep patch list$/,$d' "$newspec1" > "$newspec2"
cat "$tmpdir/patch-list-prep.txt" >> "$newspec2"
sed '1,/^# end of autogenerated prep patch list/d' "$newspec1" >> "$newspec2"
# Actually put all changes into git index
git rm -f otp-00*.patch
mv "$tmpdir/otp-00"*.patch .
git add otp-00*.patch
mv -f "$newspec1" "$specfile"
mv -f "$newspec2" "$specfile"
git add "$specfile"
rm -rf "$tmpdir"

View file

@ -1,174 +0,0 @@
import glob
import os
import re
import rpm
import sys
ts = rpm.TransactionSet()
packages = []
for arg in sys.argv[1:]:
packages += glob.glob(arg)
erlang_provides = {}
erlang_requires = {}
package_names = []
package_headers = {}
##
## Custom tweaks begins here
##
# These packages should be marked as noarch
package_noarch = [
"emacs-erlang",
"emacs-erlang-el",
"erlang-doc"]
# These are additional Requires which cannot be picked up automatically (yet).
# TODO these should be added automatically
package_additional_requires = {
"emacs-erlang": ["emacs-common-erlang = %{version}-%{release}", "emacs(bin) >= %{_emacs_version}" ],
"emacs-erlang-el": ["emacs-erlang = %{version}-%{release}"],
"erlang-dialyzer": ["graphviz"],
"erlang-erl_interface": ["%{name}-erts%{?_isa} = %{version}-%{release}"],
# This library (lksctp-tools) is dlopened so it can't be picked
# up automatically by the RPM dependency checker
"erlang-erts": ["lksctp-tools"],
"erlang-gs": ["tk"],
# Stores files/links in /usr/share/java so has to depend on jpackage-utils
"erlang-ic": ["jpackage-utils"],
# Stores files/links in /usr/share/java so has to depend on jpackage-utils
"erlang-jinterface": ["%{name}-erts%{?_isa} = %{version}-%{release}", "jpackage-utils"],
"erlang-wx": ["mesa-libGL", "mesa-libGLU"],
}
package_additional_buildrequires = {
"emacs-erlang": ["emacs", "emacs-el"],
"erlang-crypto": ["openssl-devel"],
"erlang-diameter": ["ed"],
# BEWARE. No fop for EPEL5, and only for x86/x86_64 in EPEL6,
# so we cannot regenerate docs here. (Un)Fortunately we dropped
# support for EPEL6 and older versions.
# FIXME add bootstrap condition first.
"erlang-doc": ["fop", "libxslt"],
"erlang-erts": ["lksctp-tools-devel", "m4", "ncurses-devel", "zlib-devel"],
"erlang-gs": ["tcl-devel", "tk-devel"],
# in EPEL6 on arches different from %{ix86} x86_64 we have to
# use java-devel-gcj, so technically this requirement makes it
# impossible to build Java support there. (Un)Fortunately we
# already dropped full support for EPEL6 and older versions.
"erlang-ic": ["java-devel"],
"erlang-jinterface": ["java-devel"],
"erlang-odbc": ["unixODBC-devel"],
}
package_additional_obsoletes = {
"erlang-erts": [
"erlang-appmon",
"erlang-docbuilder",
"erlang-inviso",
"erlang-pman",
"erlang-toolbar",
"erlang-tv"],
}
##
## Custom tweaks ends here
##
# To match 'erlang(asn1ct_eval_ext:transform_to_EXTERNAL1994/1)'
prog = re.compile("^erlang(.*:.*/\d+)")
rpmmask = re.compile(".*\.rpm")
# iterate over all rpms
for package in sorted([p for p in packages if rpmmask.match(p)]):
# A tricky part. We are processing packages, rebuilt with
# %{__erlang_provides_requires}. Otherwise we won't get information
# about imports/exports (until we learn how to parse Erlang BEAM file
# headers with Python.
fd = os.open(package, os.O_RDONLY)
h = ts.hdrFromFdno(fd)
os.close(fd)
rpm_name = h[rpm.RPMTAG_NAME]
# Let's calculate provides
# We'll create dictionary to speedup future use
# FIXME duplicate provides
local_provides = [p for p in h[rpm.RPMTAG_PROVIDENAME] if prog.match(p)]
erlang_provides.update({k: rpm_name for k in local_provides})
# Let's calculate requires
erlang_requires.update({rpm_name: [r for r in h[rpm.RPMTAG_REQUIRENAME] if prog.match(r) and not r in local_provides]})
package_headers.update({rpm_name: h})
package_names.append(rpm_name)
namemask = re.compile("^erlang-[a-zA-Z0-9_]*$")
print "### BEGIN OF AUTOGENERATED LIST ###"
print ""
for name in package_names:
h = package_headers[name]
if name == "erlang-doc":
# Additional ifdef just for this sub-package (see below)
print "%if %{with doc}"
if namemask.match(name):
print "%%package %s" % name.replace("erlang-", "")
else:
print "%%package -n %s" % name
print "Summary: %s" % h[rpm.RPMTAG_SUMMARY]
print "Group: %s" % h[rpm.RPMTAG_GROUP]
rawdeps = [erlang_provides.get(r, "Error: missing requires: %s" % r) for r in erlang_requires[name]]
deps = set()
dependency_add = deps.add
[x for x in rawdeps if not (x in deps or dependency_add(x))]
# Additional BuildRequires (if any):
for br in package_additional_buildrequires.get(name, []):
print "BuildRequires: %s" % br
# Add basic autogenerated Requires:
for r in sorted(deps):
#Requires: %{name}-stdlib%{?_isa} = %{version}-%{release}
print "Requires: %s%%{?_isa} = %%{version}-%%{release}" % r.replace("erlang-", "%{name}-")
# Add custom additional Requires (if any):
for r in package_additional_requires.get(name, []):
print "Requires: %s" % r
# Add custom additional Obsoletes (if any):
for os in package_additional_obsoletes.get(name, []):
print "Obsoletes: %s" % os
if name in package_noarch:
print "BuildArch: noarch"
print ""
if namemask.match(name):
print "%%description %s" % name.replace("erlang-", "")
else:
print "%%description -n %s" % name
print "%s" % h[rpm.RPMTAG_DESCRIPTION]
if name == "erlang-doc":
# Additional ifdef just for this sub-package (see above)
print "%endif"
print ""
print "### END OF AUTOGENERATED LIST ###"

View file

@ -1 +1 @@
SHA512 (otp-OTP-26.2.5.16.tar.gz) = 4e973be7e8ccad196d59759108a521535b0f046268eb0406f789a50f411fa27c9c11fcfb61a7218605bf1b32921bb52c52fc7c99917e1acfc0d3ed09437129b2
0d06e7d3802d63992535116e4d37c1a4 otp-OTP-17.4.tar.gz