/pidgin/main: 75dbccde9fc7: Enable the GCC Stack-Smashing Protec...

Daniel Atallah datallah at pidgin.im
Thu Sep 6 00:31:12 EDT 2012


Changeset: 75dbccde9fc70f38f5e324b957edf556c6438218
Author:	 Daniel Atallah <datallah at pidgin.im>
Date:	 2012-09-06 05:30 +0100
Branch:	 release-2.x.y
URL: http://hg.pidgin.im/pidgin/main/rev/75dbccde9fc7

Description:

Enable the GCC Stack-Smashing Protection functionality (-fstack-protector-all)
Thanks again to Jacob Appelbaum for pointing at his pidgin-otr patch.

Fixes #15290

diffstat:

 Makefile.mingw                         |  2 ++
 libpurple/win32/global.mak             |  5 +++--
 pidgin/Makefile.mingw                  |  4 ++--
 pidgin/win32/nsis/pidgin-installer.nsi |  1 +
 4 files changed, 8 insertions(+), 4 deletions(-)

diffs (80 lines):

diff --git a/Makefile.mingw b/Makefile.mingw
--- a/Makefile.mingw
+++ b/Makefile.mingw
@@ -55,6 +55,7 @@ EXTERNAL_DLLS = \
 	libplc4.dll \
 	libplds4.dll \
 	libsasl.dll \
+	libssp-0.dll \
 	libxml2-2.dll \
 	nss3.dll \
 	nssckbi.dll \
@@ -99,6 +100,7 @@ endif
 	cp $(ENCHANT_TOP)/bin/libenchant.dll $(PIDGIN_INSTALL_DIR)/spellcheck
 	cp -R $(ENCHANT_TOP)/lib/enchant/*.dll $(PIDGIN_INSTALL_DIR)/spellcheck/lib/enchant
 	cp $(WIN32_DEV_TOP)/pidgin-inst-deps-20100315/exchndl.dll $(PIDGIN_INSTALL_DIR)
+	cp $(GCC_SSP_TOP)/bin/libssp-0.dll $(PIDGIN_INSTALL_DIR)
 
 pidgin/win32/nsis/gtk-runtime-$(GTK_BUNDLE_VERSION).zip:
 	pidgin/win32/nsis/generate_gtk_zip.sh `pwd`
diff --git a/libpurple/win32/global.mak b/libpurple/win32/global.mak
--- a/libpurple/win32/global.mak
+++ b/libpurple/win32/global.mak
@@ -22,6 +22,7 @@ PERL_LIB_TOP ?= $(WIN32_DEV_TOP)/perl-5.
 SILC_TOOLKIT ?= $(WIN32_DEV_TOP)/silc-toolkit-1.1.10
 TCL_LIB_TOP ?= $(WIN32_DEV_TOP)/tcl-8.4.5
 GSTREAMER_TOP ?= $(WIN32_DEV_TOP)/gstreamer-0.10.13
+GCC_SSP_TOP ?= $(WIN32_DEV_TOP)/gcc-core-4.4.0-mingw32-dll
 
 # Where we installing this stuff to?
 PIDGIN_INSTALL_DIR := $(PIDGIN_TREE_TOP)/win32-install-dir
@@ -57,7 +58,7 @@ PIDGIN_PORTABLE_EXE := $(PIDGIN_TOP)/pid
 
 GCCWARNINGS ?= -Waggregate-return -Wcast-align -Wdeclaration-after-statement -Werror-implicit-function-declaration -Wextra -Wno-sign-compare -Wno-unused-parameter -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wundef
 
-CC_HARDENING_OPTIONS ?= -Wstack-protector -fwrapv -fno-strict-overflow -Wno-missing-field-initializers -Wformat-security
+CC_HARDENING_OPTIONS ?= -Wstack-protector -fwrapv -fno-strict-overflow -Wno-missing-field-initializers -Wformat-security -fstack-protector-all --param ssp-buffer-size=1
 LD_HARDENING_OPTIONS ?= -Wl,--dynamicbase -Wl,--nxcompat
 
 
@@ -95,7 +96,7 @@ CFLAGS += -O2 -Wall $(GCCWARNINGS) $(CC_
 # address colides with the base address of an existing dll.  To avoid rebasing 
 # we do the following.  Rebasing can slow down the load time of dlls and it
 # also renders debug info useless.
-DLL_LD_FLAGS += -Wl,--enable-auto-image-base $(LD_HARDENING_OPTIONS)
+DLL_LD_FLAGS += -Wl,--enable-auto-image-base -Wl,--enable-auto-import $(LD_HARDENING_OPTIONS) -lssp
 
 # Build programs
 ifeq "$(origin CC)" "default"
diff --git a/pidgin/Makefile.mingw b/pidgin/Makefile.mingw
--- a/pidgin/Makefile.mingw
+++ b/pidgin/Makefile.mingw
@@ -18,7 +18,7 @@ EXE_NAME := $(EXE_TARGET).exe
 
 WINAPP := -mwindows
 
-LDFLAGS := $(WINAPP) $(LD_HARDENING_OPTIONS)
+LDFLAGS := $(WINAPP) $(LD_HARDENING_OPTIONS) -Wl,--enable-auto-import -lssp
 
 ##
 ## INCLUDE PATHS
@@ -160,7 +160,7 @@ win32/pidgin_dll_rc.rc: win32/pidgin_dll
 	$(CC) -shared $(PIDGIN_OBJECTS) $(LIB_PATHS) $(PIDGIN_LIBS) $(DLL_LD_FLAGS) -Wl,--output-def,$(PIDGIN_TARGET).def,--out-implib,$(PIDGIN_TARGET).dll.a -o $(PIDGIN_TARGET).dll
 
 $(EXE_TARGET).exe: $(PIDGIN_CONFIG_H) $(PIDGIN_DLL).a $(EXE_OBJECTS) $(PIDGIN_TARGET).dll
-	$(CC) $(LDFLAGS) $(EXE_OBJECTS) -o $(EXE_TARGET).exe
+	$(CC) $(EXE_OBJECTS) $(LDFLAGS) -o $(EXE_TARGET).exe
 
 ##
 ## CLEAN RULES
diff --git a/pidgin/win32/nsis/pidgin-installer.nsi b/pidgin/win32/nsis/pidgin-installer.nsi
--- a/pidgin/win32/nsis/pidgin-installer.nsi
+++ b/pidgin/win32/nsis/pidgin-installer.nsi
@@ -638,6 +638,7 @@ Section Uninstall
     Delete "$INSTDIR\libsasl.dll"
     Delete "$INSTDIR\libsilc-1-1-2.dll"
     Delete "$INSTDIR\libsilcclient-1-1-3.dll"
+    Delete "$INSTDIR\libssp-0.dll"
     Delete "$INSTDIR\libxml2-2.dll"
     Delete "$INSTDIR\libymsg.dll"
     Delete "$INSTDIR\nss3.dll"



More information about the Commits mailing list