Skip to content

Commit 0070717

Browse files
committed
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 a41b148 + dea5443 commit 0070717

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

config.mak.uname

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,11 +542,17 @@ else
542542
ifeq ($(shell expr "$(uname_R)" : '2\.'),2)
543543
# MSys2
544544
prefix = /usr/
545+
# Enable DEP
546+
BASIC_LDFLAGS += -Wl,--nxcompat
547+
# Enable ASLR
548+
BASIC_LDFLAGS += -Wl,--dynamicbase
545549
ifeq (MINGW32,$(MSYSTEM))
546550
prefix = /mingw32
551+
BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
547552
endif
548553
ifeq (MINGW64,$(MSYSTEM))
549554
prefix = /mingw64
555+
BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
550556
else
551557
COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
552558
BASIC_LDFLAGS += -Wl,--large-address-aware

0 commit comments

Comments
 (0)