Defense in depth and good compiler security option.
Closes #41139
Signed-off-by: David Goulet <dgoulet@torproject.org>
--- /dev/null
+ o Minor feature (compiler flag):
+ - Add -fcf-protection=full if supported by the compiler. Fixes 41139.
+
dnl code will work.
TOR_CHECK_CFLAGS(-fasynchronous-unwind-tables)
+# From https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html:
+#
+# Enable code instrumentation to increase program security by checking that
+# target addresses of control-flow transfer instructions are valid. This
+# prevents diverting the flow of control to an unexpected target. This is
+# intended to protect against such threats as Return-oriented Programming
+# (ROP), and similarly call/jmp-oriented programming (COP/JOP).
+TOR_CHECK_CFLAGS(-fcf-protection=full)
+
dnl ============================================================
dnl Check for libseccomp