mingw: enable stack smashing protector

To reduce Git for Windows' attack surface, we started using the Address Space Layout Randomization and Data Execution Prevention features in ce6a158561f9 (mingw: enable DEP and ASLR, 2019-05-08). To remove yet another attack vector, let's make use of gcc's stack smashing protector that helps detect stack buffer overruns early. Rather than using -fstack-protector, we use -fstack-protector-strong because on Windows: The latter appears to strike a better balance between the performance impact and the provided safety. In a non-scientific test (time git log --grep=is -p), best of 5 timings went from 23.009s to 22.997s, i.e. the performance impact was *well* lost in the noise. This fixes https://github.com/git-for-windows/git/issues/501 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jun 27, 2019 at 02:29 UTC a1c5e906c8bab294f380151f59e552766fdf32b7
1 file changed +2 -1
config.mak.uname
+2 -1
@@ -596,7 +596,8 @@ else
596 BASIC_LDFLAGS += -Wl,--large-address-aware
597 endif
598 CC = gcc
599 - COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY
599 + COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
600 + -fstack-protector-strong
601 EXTLIBS += -lntdll
602 INSTALL = /bin/install
603 NO_R_TO_GCC_LINKER = YesPlease