From cee6162783cc0a1d91ef55a088d4b21f1a61bc5f Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 7 Jan 2010 15:03:47 +0000 Subject: [PATCH] 2010-01-07 16:02 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * INSTALL * Updated valgrind example. * contrib/hbnetio/utils/netiosrv.hbp * utils/hbformat/hbformat.hbp * utils/hbmk2/hbmk2.hbp * utils/hbi18n/hbi18n.hbp * utils/hbtest/hbtest.hbp * utils/hbrun/hbrun.hbp * config/wce/msvcarm.mk * config/win/msvc.mk + Added MSVC linker switches to enhance security by enabling NX compatibility and ASLR. Especially important for server apps like netiosrv and hbrun. ; TODO: Enable the same for MinGW. ; TOCHECK: Please test this with old MSVC versions and MSVCARM, maybe we will need to disable them in some cases. ; QUESTION: I'm unsure of -fixed:no MSVC option. Do we need it to increase security? * config/wce/msvcarm.mk + Changed to use link.exe for linking instead of cl[arm].exe. This now syncs it with rest of Harbour. --- harbour/ChangeLog | 25 ++++++++++++++++++++++ harbour/INSTALL | 2 +- harbour/config/wce/msvcarm.mk | 6 +++--- harbour/config/win/msvc.mk | 2 +- harbour/contrib/hbnetio/utils/netiosrv.hbp | 3 +++ harbour/utils/hbformat/hbformat.hbp | 3 +++ harbour/utils/hbi18n/hbi18n.hbp | 3 +++ harbour/utils/hbmk2/hbmk2.hbp | 3 +++ harbour/utils/hbrun/hbrun.hbp | 3 +++ harbour/utils/hbtest/hbtest.hbp | 3 +++ 10 files changed, 48 insertions(+), 5 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 493e225e29..3b891deda7 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,31 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-01-07 16:02 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * INSTALL + * Updated valgrind example. + + * contrib/hbnetio/utils/netiosrv.hbp + * utils/hbformat/hbformat.hbp + * utils/hbmk2/hbmk2.hbp + * utils/hbi18n/hbi18n.hbp + * utils/hbtest/hbtest.hbp + * utils/hbrun/hbrun.hbp + * config/wce/msvcarm.mk + * config/win/msvc.mk + + Added MSVC linker switches to enhance security by + enabling NX compatibility and ASLR. + Especially important for server apps like netiosrv and hbrun. + ; TODO: Enable the same for MinGW. + ; TOCHECK: Please test this with old MSVC versions and MSVCARM, + maybe we will need to disable them in some cases. + ; QUESTION: I'm unsure of -fixed:no MSVC option. Do we need it + to increase security? + + * config/wce/msvcarm.mk + + Changed to use link.exe for linking instead of cl[arm].exe. + This now syncs it with rest of Harbour. + 2010-01-07 14:14 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/hbnetio/netiocli.c ! use hb_vmAtInit() to initialize NETIO - looks that winsock diff --git a/harbour/INSTALL b/harbour/INSTALL index 7b5307676c..d95f3d6adf 100644 --- a/harbour/INSTALL +++ b/harbour/INSTALL @@ -692,7 +692,7 @@ HARBOUR $ hbmk2 myapp -debug Run app with: - $ valgrind --tool=memcheck --leak-check=yes -v ./myapp 2> myapp.log + $ valgrind --tool=memcheck --leak-check=yes --num-callers=16 -v ./myapp 2> myapp.log CodeGuard (on win/bcc target only) --------- diff --git a/harbour/config/wce/msvcarm.mk b/harbour/config/wce/msvcarm.mk index f3108dcd1a..56862f6adc 100644 --- a/harbour/config/wce/msvcarm.mk +++ b/harbour/config/wce/msvcarm.mk @@ -60,15 +60,15 @@ ifeq ($(HB_BUILD_DEBUG),yes) DFLAGS += -debug endif -LD := $(CC) -LD_OUT := -Fe +LD := link.exe +LD_OUT := -out: SYSLIBS += corelibc LIBPATHS := -libpath:$(LIB_DIR) LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),$(lib)$(LIB_EXT)) -LDFLAGS += -nologo -link -subsystem:windowsce -nodefaultlib:oldnames.lib -nodefaultlib:kernel32.lib +LDFLAGS += -nologo -nxcompat -dynamicbase -subsystem:windowsce -nodefaultlib:oldnames.lib -nodefaultlib:kernel32.lib ifeq ($(filter $(HB_COMPILER_VER),600 700 710),) LDFLAGS += -manifest:no endif diff --git a/harbour/config/win/msvc.mk b/harbour/config/win/msvc.mk index d8444a577c..a062dbf9da 100644 --- a/harbour/config/win/msvc.mk +++ b/harbour/config/win/msvc.mk @@ -73,7 +73,7 @@ LD_OUT := -out: LIBPATHS := -libpath:$(LIB_DIR) LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),$(lib)$(LIB_EXT)) -LDFLAGS += -nologo $(LIBPATHS) +LDFLAGS += -nologo -nxcompat -dynamicbase $(LIBPATHS) AR := lib.exe AR_RULE = $(AR) $(ARFLAGS) $(HB_USER_AFLAGS) -nologo -out:$(LIB_DIR)/$@ $(^F) || $(RM) $(LIB_DIR)/$@ diff --git a/harbour/contrib/hbnetio/utils/netiosrv.hbp b/harbour/contrib/hbnetio/utils/netiosrv.hbp index 30977325d3..7e42a4e60b 100644 --- a/harbour/contrib/hbnetio/utils/netiosrv.hbp +++ b/harbour/contrib/hbnetio/utils/netiosrv.hbp @@ -6,3 +6,6 @@ netiosrv.prg -o{!dos&x86}hbnetio_${hb_plat} -o{!dos&!x86}hbnetio_${hb_plat}_${hb_cpu} -o{dos}hbnetio + +-ldflag={allmsvc}-nxcompat +-ldflag={allmsvc}-dynamicbase diff --git a/harbour/utils/hbformat/hbformat.hbp b/harbour/utils/hbformat/hbformat.hbp index 3e16ab6ca2..a0f9f8ce52 100644 --- a/harbour/utils/hbformat/hbformat.hbp +++ b/harbour/utils/hbformat/hbformat.hbp @@ -4,6 +4,9 @@ -q0 -w3 -es2 -kmo -l +-ldflag={allmsvc}-nxcompat +-ldflag={allmsvc}-dynamicbase + -nulrdd hbformat.prg hbformac.c diff --git a/harbour/utils/hbi18n/hbi18n.hbp b/harbour/utils/hbi18n/hbi18n.hbp index 0f86013d53..23bb227475 100644 --- a/harbour/utils/hbi18n/hbi18n.hbp +++ b/harbour/utils/hbi18n/hbi18n.hbp @@ -4,5 +4,8 @@ -q0 -w3 -es2 -kmo -l +-ldflag={allmsvc}-nxcompat +-ldflag={allmsvc}-dynamicbase + -nulrdd hbi18n.prg diff --git a/harbour/utils/hbmk2/hbmk2.hbp b/harbour/utils/hbmk2/hbmk2.hbp index e7926987a0..f9ea692c04 100644 --- a/harbour/utils/hbmk2/hbmk2.hbp +++ b/harbour/utils/hbmk2/hbmk2.hbp @@ -4,6 +4,9 @@ -q0 -w3 -es2 -kmo -l +-ldflag={allmsvc}-nxcompat +-ldflag={allmsvc}-dynamicbase + -nulrdd -mt hbmk2.prg diff --git a/harbour/utils/hbrun/hbrun.hbp b/harbour/utils/hbrun/hbrun.hbp index cce244f23b..f5bd318cbf 100644 --- a/harbour/utils/hbrun/hbrun.hbp +++ b/harbour/utils/hbrun/hbrun.hbp @@ -4,6 +4,9 @@ -q0 -w3 -es2 -kmo -l +-ldflag={allmsvc}-nxcompat +-ldflag={allmsvc}-dynamicbase + hbrun.prg -lhbcplr diff --git a/harbour/utils/hbtest/hbtest.hbp b/harbour/utils/hbtest/hbtest.hbp index d14d1808ef..7a7d333da1 100644 --- a/harbour/utils/hbtest/hbtest.hbp +++ b/harbour/utils/hbtest/hbtest.hbp @@ -4,6 +4,9 @@ -q0 -w3 -es2 -kmo +-ldflag={allmsvc}-nxcompat +-ldflag={allmsvc}-dynamicbase + hbtest.prg rt_array.prg rt_date.prg