Skip to content

Commit f1c82d8

Browse files
socram8888millert
authored andcommitted
Enable Intel CET on x86-64 only
Before, Intel CET was enabled for both 32-bit and 64-bit targets. However, this made sudo incompatible with semi-i686 non-Intel and non-AMD processors, such as DM&P Vortex86 processors that are still in production, and legacy VIA/Geode processors. On those, generated ENDBR32 instructions are parsed as invalid opcodes, crashing sudo with a SIGILL. Even for modern processors that support it, enabling it does not enhance security as no kernel in 32-bit mode supports Intel CET (neither Linux nor FreeBSD nor OpenBSD), so enabling it only increases the binary size at best and prevents entirely from running at worst. This commit changes the compilation process to enable it only on x86-64 targets.
1 parent e2a2982 commit f1c82d8

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

m4/hardening.m4

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,18 @@ AC_DEFUN([SUDO_CHECK_HARDENING], [
100100
])
101101
fi
102102
103-
# Check for control-flow transfer instrumentation (Intel CET).
104-
AX_CHECK_COMPILE_FLAG([-fcf-protection], [
105-
AX_CHECK_LINK_FLAG([-fcf-protection], [
106-
AX_APPEND_FLAG([-fcf-protection], [HARDENING_CFLAGS])
107-
AX_APPEND_FLAG([-Wc,-fcf-protection], [HARDENING_LDFLAGS])
103+
# Check for control-flow transfer instrumentation (Intel CET)
104+
# on x86-64. Do not enable for 32-bit, since no 32-bit OS supports
105+
# it and the generated ENDBR32 instructions have compatibility
106+
# issues with some old i586/i686 processors (eg Geode or Vortex).
107+
if test "$host_cpu" = "x86_64"; then
108+
AX_CHECK_COMPILE_FLAG([-fcf-protection], [
109+
AX_CHECK_LINK_FLAG([-fcf-protection], [
110+
AX_APPEND_FLAG([-fcf-protection], [HARDENING_CFLAGS])
111+
AX_APPEND_FLAG([-Wc,-fcf-protection], [HARDENING_LDFLAGS])
112+
])
108113
])
109-
])
114+
fi
110115
fi
111116
112117
# Linker-specific hardening flags.

0 commit comments

Comments
 (0)