Skip to content

Commit 40a6eb4

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 18fd757 + 448effc commit 40a6eb4

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
@@ -572,13 +572,21 @@ else
572572
ifeq ($(shell expr "$(uname_R)" : '2\.'),2)
573573
# MSys2
574574
prefix = /usr/
575+
# Enable DEP
576+
BASIC_LDFLAGS += -Wl,--nxcompat
577+
# Enable ASLR (unless debugging)
578+
ifneq (,$(findstring -O,$(CFLAGS)))
579+
BASIC_LDFLAGS += -Wl,--dynamicbase
580+
endif
575581
ifeq (MINGW32,$(MSYSTEM))
576582
prefix = /mingw32
577583
HOST_CPU = i686
584+
BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
578585
endif
579586
ifeq (MINGW64,$(MSYSTEM))
580587
prefix = /mingw64
581588
HOST_CPU = x86_64
589+
BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
582590
else
583591
COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
584592
BASIC_LDFLAGS += -Wl,--large-address-aware

0 commit comments

Comments
 (0)