[CRIU] [PATCH 2/2] Fix Fedora build (undo _FORTIFY_SOURCE for pie)

Kir Kolyshkin kir at openvz.org
Thu Feb 16 17:41:32 PST 2017


Recent Fedora releases add -Wp,-D_FORTIFY_SOURCE=2 to rpm builds,
which breaks compiling pie code on some architectures due to its
trying to use (absent) memcpy_chk() instead of usual memcpy().

We must stand strong against FORTIFY_SOURCE in pie code.
No pasaran! Viva la resistance!

NOTE: in tests, FORTIFY_SOURCE is disabled for completely different
reasons (see commit d1a36cc9 for details), so we're not touching it.

Reported-by: Reported-by: Adrian Reber <adrian at lisas.de>
Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 criu/pie/Makefile         | 1 +
 criu/pie/Makefile.library | 1 +
 test/zdtm/lib/Makefile    | 1 +
 test/zdtm/static/Makefile | 1 +
 4 files changed, 4 insertions(+)

diff --git a/criu/pie/Makefile b/criu/pie/Makefile
index 8d593e2..141c018 100644
--- a/criu/pie/Makefile
+++ b/criu/pie/Makefile
@@ -22,6 +22,7 @@ CFLAGS			+= -iquote $(SRC_DIR)/criu/include
 CFLAGS			+= -iquote $(SRC_DIR)/include
 CFLAGS			+= -iquote $(SRC_DIR)
 CFLAGS			+= -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
+CFLAGS			+= -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=0
 
 
 ifneq ($(filter-out ia32,$(ARCH)),)
diff --git a/criu/pie/Makefile.library b/criu/pie/Makefile.library
index 7d6d859..dce650a 100644
--- a/criu/pie/Makefile.library
+++ b/criu/pie/Makefile.library
@@ -50,3 +50,4 @@ else
 endif
 
 ccflags-y		+= -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
+ccflags-y		+= -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=0
diff --git a/test/zdtm/lib/Makefile b/test/zdtm/lib/Makefile
index 592d934..8157f73 100644
--- a/test/zdtm/lib/Makefile
+++ b/test/zdtm/lib/Makefile
@@ -1,6 +1,7 @@
 include ../Makefile.inc
 
 CFLAGS	= -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
+CFLAGS	+= -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=0
 CFLAGS	+= $(USERCFLAGS)
 
 LIBDIR	= .
diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
index e93edf1..d1b343a 100644
--- a/test/zdtm/static/Makefile
+++ b/test/zdtm/static/Makefile
@@ -5,6 +5,7 @@ LIB	= $(LIBDIR)/libzdtmtst.a
 LDLIBS	+= $(LIBDIR)/libzdtmtst.a
 override CPPFLAGS += -I$(LIBDIR)
 CFLAGS	= -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
+CFLAGS	+= -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=0
 CFLAGS	+= $(USERCFLAGS)
 
 TST_NOFILE	:=				\
-- 
2.9.3



More information about the CRIU mailing list