[PATCH 2/6] cet: Do not override enable-cet=permissive during 'make check'
Arjun Shankar
arjun@redhat.com
Mon Nov 23 12:46:56 GMT 2026
sysdeps/x86_64/configure stored a "does the test compiler support CET?"
yes/no in test_enable_cet. This was then used to override enable-cet
during 'make check'. Because of this, even during
'--enable-cet=permissive' builds, 'make check' saw enable-cet as "yes"
instead of "permissive". Some test flags in sysdeps/x86_64/Makefile are
gated on permissive mode, so it should not be overridden in this way.
Therefore:
1. In sysdeps/x86_64/configure.ac, rename test_enable_cet to
test_have_cet to clarify what it actually stores.
2. In Makefile.in, only when test_have_cet is "no", override enable-cet
and mark it "no". We do not want to build CET tests when the
test compiler does not support it.
---
Makefile.in | 10 ++++++++--
configure | 2 +-
configure.ac | 2 +-
sysdeps/x86_64/configure | 4 ++--
sysdeps/x86_64/configure.ac | 5 +++--
5 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 17f3dc9dc0..9eca2ce985 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -8,7 +8,7 @@ test-config-cflags-signaling-nans = @libc_cv_test_cc_signaling_nans@
test-config-cflags-fcall-used-g6 = @libc_cv_test_cc_fcall_used_g6@
test-cc-option-wfree-labels = @libc_cv_test_cc_wfree_labels@
test-cc-option-wmissing-parameter-name = @libc_cv_test_cc_wmissing_parameter_name@
-test-enable-cet = @test_enable_cet@
+test-have-cet = @test_have_cet@
test-have-static-pie = @libc_cv_test_static_pie@
test-supported-fortify = @libc_cv_test_supported_fortify_source@
@@ -22,6 +22,12 @@ test-supported-fortify = @libc_cv_test_supported_fortify_source@
all .DEFAULT:
$(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@
+ifeq ($(test-have-cet),no)
+disable-cet-tests = enable-cet=no
+else
+disable-cet-tests =
+endif
+
check xcheck test:
$(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) \
CC="$(TEST_CC)" CXX="$(TEST_CXX)" \
@@ -31,7 +37,7 @@ check xcheck test:
config-cflags-fcall-used-g6="$(test-config-cflags-fcall-used-g6)" \
cc-option-wfree-labels="$(test-cc-option-wfree-labels)" \
cc-option-wmissing-parameter-name="$(test-cc-option-wmissing-parameter-name)" \
- enable-cet="$(test-enable-cet)" \
+ $(disable-cet-tests) \
have-static-pie="$(test-have-static-pie)" \
supported-fortify="$(test-supported-fortify)" \
objdir=`pwd` $@
diff --git a/configure b/configure
index c33603061d..5fa310d3b5 100755
--- a/configure
+++ b/configure
@@ -602,7 +602,7 @@ mach_interface_list
DEFINES
profile
libc_cv_multidir
-test_enable_cet
+test_have_cet
libc_cv_test_cc_fcall_used_g6
libc_cv_test_cc_mprefer_vector_width
shared
diff --git a/configure.ac b/configure.ac
index 564e2cba21..5e92621a5e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2126,7 +2126,7 @@ fi
# Support configure.ac under sysdeps.
AC_SUBST(libc_cv_test_cc_mprefer_vector_width)
AC_SUBST(libc_cv_test_cc_fcall_used_g6)
-AC_SUBST(test_enable_cet)
+AC_SUBST(test_have_cet)
enable_gsframe=no
if test $use_sframe = yes; then
diff --git a/sysdeps/x86_64/configure b/sysdeps/x86_64/configure
index 83f206c259..3253d30597 100644
--- a/sysdeps/x86_64/configure
+++ b/sysdeps/x86_64/configure
@@ -99,7 +99,7 @@ if test x"$build_mathvec" = xnotset; then
build_mathvec=yes
fi
-test_enable_cet=$enable_cet
+test_have_cet=$enable_cet
if test $enable_cet != no; then
# Check if CET can be enabled.
conftest_code="
@@ -165,7 +165,7 @@ CC="$saved_CC"
fi
rm -f conftest*
- test_enable_cet=$libc_cv_test_x86_cet_available
+ test_have_cet=$libc_cv_test_x86_cet_available
if test $libc_cv_x86_cet_available != yes; then
as_fn_error $? "$CC doesn't support CET" "$LINENO" 5
fi
diff --git a/sysdeps/x86_64/configure.ac b/sysdeps/x86_64/configure.ac
index c4ef4319e4..065e9add0c 100644
--- a/sysdeps/x86_64/configure.ac
+++ b/sysdeps/x86_64/configure.ac
@@ -21,7 +21,8 @@ if test x"$build_mathvec" = xnotset; then
build_mathvec=yes
fi
-test_enable_cet=$enable_cet
+dnl Check if we can use -fcf-protection in relevant tests.
+test_have_cet=$enable_cet
if test $enable_cet != no; then
# Check if CET can be enabled.
conftest_code="
@@ -38,7 +39,7 @@ if test $enable_cet != no; then
libc_cv_test_x86_cet_available,
[libc_cv_test_x86_cet_available=yes],
[libc_cv_test_x86_cet_available=no])
- test_enable_cet=$libc_cv_test_x86_cet_available
+ test_have_cet=$libc_cv_test_x86_cet_available
if test $libc_cv_x86_cet_available != yes; then
AC_MSG_ERROR([$CC doesn't support CET])
fi
--
2.56.0
More information about the Libc-alpha
mailing list