From ead352754307cf35a5930a3f5484a42a955fb20e Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Thu, 11 Dec 2025 09:01:14 +0200 Subject: [PATCH] m4: dovecot.m4 - Add Control-flow protection support --- m4/dovecot.m4 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/m4/dovecot.m4 b/m4/dovecot.m4 index c3794f4f89..c73f43d1cd 100644 --- a/m4/dovecot.m4 +++ b/m4/dovecot.m4 @@ -28,6 +28,23 @@ AC_DEFUN([AC_CC_D_FORTIFY_SOURCE],[ ]) ]) +AC_DEFUN([DC_FCF_PROTECTION], [ + AC_ARG_WITH([fcf-protection], + [AS_HELP_STRING([--with-fcf-protection=], [Set Control-flow protection level (default: none)])], + [fcf_protection=$withval], + [fcf_protection=none]) + AS_IF([test "x$fcf_protection" != "xnone"], [ + case "$host" in + *) + gl_COMPILER_OPTION_IF([-fcf-protection=$fcf_protection], + [AM_CFLAGS="$AM_CFLAGS -fcf-protection=$fcf_protection"], + [AC_MSG_ERROR([-fcf-protection=$fcf_protection not supported by compiler])], + [AC_LANG_PROGRAM()]) + ;; + esac + ]) +]) + AC_DEFUN([DC_HARDEN_SLS], [ AC_ARG_WITH([harden-sls], [AS_HELP_STRING([--with-harden-sls=], [Straight-Line Speculation (SLS) mitigations (default: none)])], @@ -347,6 +364,7 @@ AC_DEFUN([DC_DOVECOT_HARDENING],[ AC_LD_RELRO DC_LTO DC_HARDEN_SLS + DC_FCF_PROTECTION DOVECOT_WANT_UBSAN ]) -- 2.47.3