Merge pull request #1418 from fanquake/use_fortify_source_3

build: use FORTIFY_SOURCE=3 in hardening option
This commit is contained in:
Azat Khuzhin 2023-02-14 09:56:03 +01:00 committed by GitHub
commit bcefdbc67a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -341,7 +341,7 @@ if (${GNUC})
-Wstack-protector -Wstack-protector
"--param ssp-buffer-size=1") "--param ssp-buffer-size=1")
add_definitions(-D_FORTIFY_SOURCE=2) add_definitions(-D_FORTIFY_SOURCE=3)
endif() endif()
if (EVENT__ENABLE_GCC_FUNCTION_SECTIONS) if (EVENT__ENABLE_GCC_FUNCTION_SECTIONS)

View File

@ -42,7 +42,7 @@ AC_ARG_ENABLE([gcc-warnings],
AC_ARG_ENABLE([gcc-hardening], AC_ARG_ENABLE([gcc-hardening],
AS_HELP_STRING([--enable-gcc-hardening, enable compiler security checks]), AS_HELP_STRING([--enable-gcc-hardening, enable compiler security checks]),
[if test "$enableval" = "yes"; then [if test "$enableval" = "yes"; then
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2 -fstack-protector-all" CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=3 -fstack-protector-all"
CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector" CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector"
CFLAGS="$CFLAGS --param ssp-buffer-size=1" CFLAGS="$CFLAGS --param ssp-buffer-size=1"
fi]) fi])