From: Michael Jeanson Date: Thu, 27 Oct 2022 20:57:18 +0000 (-0400) Subject: Fix: tests: CFLAGS to CXXFLAGS when converting to C++ X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=fbf606d77e98bd46d953a40331f039730cfdf532 Fix: tests: CFLAGS to CXXFLAGS when converting to C++ 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 Signed-off-by: Jérémie Galarneau --- diff --git a/tests/regression/kernel/Makefile.am b/tests/regression/kernel/Makefile.am index a257eb07a..4fef90d36 100644 --- a/tests/regression/kernel/Makefile.am +++ b/tests/regression/kernel/Makefile.am @@ -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 \ diff --git a/tests/regression/kernel/select_poll_epoll.cpp b/tests/regression/kernel/select_poll_epoll.cpp index c0b688217..32cecddbb 100644 --- a/tests/regression/kernel/select_poll_epoll.cpp +++ b/tests/regression/kernel/select_poll_epoll.cpp @@ -5,6 +5,14 @@ * */ +/* + * This test voluntarily does buffer overflows and stack overruns, disable + * source fortification. + */ +#ifdef _FORTIFY_SOURCE +#undef _FORTIFY_SOURCE +#endif + #include #include #include