Fix: tests: CFLAGS to CXXFLAGS when converting to C++
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 27 Oct 2022 20:57:18 +0000 (16:57 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 28 Oct 2022 19:53:41 +0000 (15:53 -0400)
The test was converted to C++ but the custom flags used to build it were
left in the CFLAGS variable which doesn't apply to C++ code. This begs
the question of the usefulness of these flags, except for POPT_CFLAGS
which lead to this finding.

Change-Id: I87412ff0730b960b191d8725a13407c67f7b431d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/regression/kernel/Makefile.am
tests/regression/kernel/select_poll_epoll.cpp

index a257eb07a778c805b790ea9b2ccafb202a62d4b2..4fef90d36b18766553458b8211f4e1316750b65d 100644 (file)
@@ -19,7 +19,9 @@ EXTRA_DIST = test_all_events \
 noinst_PROGRAMS = select_poll_epoll
 select_poll_epoll_SOURCES = select_poll_epoll.cpp
 select_poll_epoll_LDADD = $(POPT_LIBS) $(top_builddir)/src/common/libcommon-lgpl.la
-select_poll_epoll_CFLAGS = $(POPT_CFLAGS) -fno-stack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 $(AM_CFLAGS)
+select_poll_epoll_CPPFLAGS = $(POPT_CFLAGS) $(AM_CPPFLAGS)
+# Disable stack protection, the test overflows the stack to test the poll/epoll syscalls
+select_poll_epoll_CXXFLAGS = -fno-stack-protector $(AM_CXXFLAGS)
 
 all-local:
        @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
index c0b6882172b13d471be9a3496ac80b2692595a67..32cecddbb13409c2e1551385c47eb7043142538b 100644 (file)
@@ -5,6 +5,14 @@
  *
  */
 
+/*
+ * This test voluntarily does buffer overflows and stack overruns, disable
+ * source fortification.
+ */
+#ifdef _FORTIFY_SOURCE
+#undef _FORTIFY_SOURCE
+#endif
+
 #include <fcntl.h>
 #include <limits.h>
 #include <poll.h>
This page took 0.026225 seconds and 4 git commands to generate.