diff --git a/valgrind-3.15.0-some-stack-protector.patch b/valgrind-3.15.0-some-stack-protector.patch new file mode 100644 index 0000000..0634ee2 --- /dev/null +++ b/valgrind-3.15.0-some-stack-protector.patch @@ -0,0 +1,109 @@ +commit 24f3e6699f0eed42cb2e0acf511ffb7e96efebe7 +Author: Mark Wielaard +Date: Sun Apr 14 00:30:05 2019 +0200 + + Remove no-stack-protector, add stack-protector-strong to some. + +diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am +index 56cc5efc7..bed7b7ba3 100644 +--- a/auxprogs/Makefile.am ++++ b/auxprogs/Makefile.am +@@ -30,7 +30,7 @@ bin_PROGRAMS = valgrind-listener valgrind-di-server + + valgrind_listener_SOURCES = valgrind-listener.c + valgrind_listener_CPPFLAGS = $(AM_CPPFLAGS_PRI) -I$(top_srcdir)/coregrind +-valgrind_listener_CFLAGS = $(AM_CFLAGS_PRI) ++valgrind_listener_CFLAGS = $(AM_CFLAGS_PRI) -fstack-protector-strong + valgrind_listener_CCASFLAGS = $(AM_CCASFLAGS_PRI) + valgrind_listener_LDFLAGS = $(AM_CFLAGS_PRI) + if VGCONF_PLATVARIANT_IS_ANDROID +@@ -49,7 +49,7 @@ endif + + valgrind_di_server_SOURCES = valgrind-di-server.c + valgrind_di_server_CPPFLAGS = $(AM_CPPFLAGS_PRI) -I$(top_srcdir)/coregrind +-valgrind_di_server_CFLAGS = $(AM_CFLAGS_PRI) ++valgrind_di_server_CFLAGS = $(AM_CFLAGS_PRI) -fstack-protector-strong + valgrind_di_server_CCASFLAGS = $(AM_CCASFLAGS_PRI) + valgrind_di_server_LDFLAGS = $(AM_CFLAGS_PRI) + if VGCONF_PLATVARIANT_IS_ANDROID +diff --git a/cachegrind/Makefile.am b/cachegrind/Makefile.am +index f8447a17c..f57274118 100644 +--- a/cachegrind/Makefile.am ++++ b/cachegrind/Makefile.am +@@ -25,7 +25,7 @@ bin_PROGRAMS = cg_merge + + cg_merge_SOURCES = cg_merge.c + cg_merge_CPPFLAGS = $(AM_CPPFLAGS_PRI) +-cg_merge_CFLAGS = $(AM_CFLAGS_PRI) ++cg_merge_CFLAGS = $(AM_CFLAGS_PRI) -fstack-protector-strong + cg_merge_CCASFLAGS = $(AM_CCASFLAGS_PRI) + cg_merge_LDFLAGS = $(AM_CFLAGS_PRI) + # If there is no secondary platform, and the platforms include x86-darwin, +diff --git a/configure.ac b/configure.ac +index f8c798bf3..ccc8f52db 100755 +--- a/configure.ac ++++ b/configure.ac +@@ -2188,24 +2188,24 @@ AC_LANG(C) + AC_SUBST(FLAG_FALIGNED_NEW) + + # does this compiler support -fno-stack-protector ? +-AC_MSG_CHECKING([if gcc accepts -fno-stack-protector]) +- +-safe_CFLAGS=$CFLAGS +-CFLAGS="-fno-stack-protector -Werror" +- +-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ +- return 0; +-]])], [ +-no_stack_protector=yes +-FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector" +-AC_MSG_RESULT([yes]) +-], [ +-no_stack_protector=no ++#AC_MSG_CHECKING([if gcc accepts -fno-stack-protector]) ++# ++#safe_CFLAGS=$CFLAGS ++#CFLAGS="-fno-stack-protector -Werror" ++# ++#AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ ++# return 0; ++#]])], [ ++#no_stack_protector=yes ++#FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector" ++#AC_MSG_RESULT([yes]) ++#], [ ++#no_stack_protector=no + FLAG_FNO_STACK_PROTECTOR="" +-AC_MSG_RESULT([no]) +-]) +-CFLAGS=$safe_CFLAGS +- ++#AC_MSG_RESULT([no]) ++#]) ++#CFLAGS=$safe_CFLAGS ++# + AC_SUBST(FLAG_FNO_STACK_PROTECTOR) + + # does this compiler support -finline-functions ? +diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am +index 94030fdb0..3c732100e 100644 +--- a/coregrind/Makefile.am ++++ b/coregrind/Makefile.am +@@ -55,7 +55,7 @@ AR = ${LTO_AR} + RANLIB = ${LTO_RANLIB} + + valgrind_CPPFLAGS = $(AM_CPPFLAGS_PRI) +-valgrind_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) ++valgrind_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong + valgrind_CCASFLAGS = $(AM_CCASFLAGS_PRI) + valgrind_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ + # If there is no secondary platform, and the platforms include x86-darwin, +@@ -94,7 +94,7 @@ vgdb_SOURCES += vgdb-invoker-solaris.c + endif + + vgdb_CPPFLAGS = $(AM_CPPFLAGS_PRI) +-vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) ++vgdb_CFLAGS = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong + vgdb_CCASFLAGS = $(AM_CCASFLAGS_PRI) + vgdb_LDFLAGS = $(AM_CFLAGS_PRI) @LIB_UBSAN@ + if VGCONF_PLATVARIANT_IS_ANDROID diff --git a/valgrind.spec b/valgrind.spec index 6ccb628..74051dd 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Tool for finding memory management bugs in programs Name: %{?scl_prefix}valgrind Version: 3.15.0 -Release: 0.6.RC2%{?dist} +Release: 0.7.RC2%{?dist} Epoch: 1 License: GPLv2+ URL: http://www.valgrind.org/ @@ -98,6 +98,9 @@ Patch6: valgrind-3.15.0-mmap-32bit.patch # Disable z13 support (on rhel6) Patch7: valgrind-3.15.0-disable-s390x-z13.patch +# Add some stack-protector +Patch8: valgrind-3.15.0-some-stack-protector.patch + BuildRequires: glibc-devel @@ -228,6 +231,8 @@ Valgrind User Manual for details. %patch7 -p1 %endif +%patch8 -p1 + %build @@ -430,6 +435,9 @@ fi %endif %changelog +* Sun Apr 14 2019 Mark Wielaard - 3.15.0-0.7.RC2 +- Add valgrind-3.15.0-some-stack-protector.patch + * Sat Apr 13 2019 Mark Wielaard - 3.15.0-0.6.RC2 - Pass through most (hardening) flags, except -O2, -fstack-protector and -Wl,-z,now.