Skip to content

Commit 331f1ad

Browse files
dschoGit for Windows Build Agent
authored andcommitted
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 #612 that does not break Git ;-) This fixes #608 Signed-off-by: Johannes Schindelin <[email protected]>
2 parents 584ce4a + 39d3fd0 commit 331f1ad

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

config.mak.uname

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,13 +571,21 @@ else
571571
ifneq ($(shell expr "$(uname_R)" : '1\.'),2)
572572
# MSys2
573573
prefix = /usr/
574+
# Enable DEP
575+
BASIC_LDFLAGS += -Wl,--nxcompat
576+
# Enable ASLR (unless debugging)
577+
ifneq (,$(findstring -O,$(CFLAGS)))
578+
BASIC_LDFLAGS += -Wl,--dynamicbase
579+
endif
574580
ifeq (MINGW32,$(MSYSTEM))
575581
prefix = /mingw32
576582
HOST_CPU = i686
583+
BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
577584
endif
578585
ifeq (MINGW64,$(MSYSTEM))
579586
prefix = /mingw64
580587
HOST_CPU = x86_64
588+
BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
581589
else
582590
COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
583591
BASIC_LDFLAGS += -Wl,--large-address-aware

0 commit comments

Comments
 (0)