Merge 'aslr' into HEAD

Address Space Layout Randomization (ASLR) allows executables' memory
layout to change at random between runs, and therefore offers a quite
decent protection against many attacks.

We enable ASLR because MSYS2's C compiler offers support for ASLR, and
whatever performance impact it has is neglible, according to
https://insights.sei.cmu.edu/cert/2014/02/differences-between-aslr-on-windows-and-linux.html

This merges the part of https://github.com/git-for-windows/git/pull/612
that does not break Git ;-)

This fixes https://github.com/git-for-windows/git/issues/608

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2018-06-08 13:42:44 +02:00

View File

@@ -556,11 +556,19 @@ else
ifeq ($(shell expr "$(uname_R)" : '2\.'),2)
# MSys2
prefix = /usr/
# Enable DEP
BASIC_LDFLAGS += -Wl,--nxcompat
# Enable ASLR (unless debugging)
ifneq (,$(findstring -O,$(CFLAGS)))
BASIC_LDFLAGS += -Wl,--dynamicbase
endif
ifeq (MINGW32,$(MSYSTEM))
prefix = /mingw32
BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
endif
ifeq (MINGW64,$(MSYSTEM))
prefix = /mingw64
BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
else
COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
BASIC_LDFLAGS += -Wl,--large-address-aware