]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
build: Add -fcf-protection=full
authorDavid Goulet <dgoulet@torproject.org>
Mon, 6 Oct 2025 12:49:10 +0000 (08:49 -0400)
committerDavid Goulet <dgoulet@torproject.org>
Mon, 6 Oct 2025 12:51:34 +0000 (08:51 -0400)
Defense in depth and good compiler security option.

Closes #41139

Signed-off-by: David Goulet <dgoulet@torproject.org>
changes/gcc-fcf [new file with mode: 0644]
configure.ac

diff --git a/changes/gcc-fcf b/changes/gcc-fcf
new file mode 100644 (file)
index 0000000..b744b77
--- /dev/null
@@ -0,0 +1,3 @@
+  o Minor feature (compiler flag):
+    - Add -fcf-protection=full if supported by the compiler. Fixes 41139.
+
index bf9f130e05aed2362c8e31402f0ccf8876da6f72..8a33b4fc85db161b5a7992dca34e24147cb05dd4 100644 (file)
@@ -1490,6 +1490,15 @@ dnl we should try to add -fasynchronous-unwind-tables so that our backtrace
 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