Skip to content

Commit a284e43

Browse files
committed
hardening: Enable KCFI and some other options
Add some stuff that got missed along the way: - CONFIG_UNWIND_PATCH_PAC_INTO_SCS=y so SCS vs PAC is hardware selectable. - CONFIG_X86_KERNEL_IBT=y while a default, just be sure. - CONFIG_CFI_CLANG=y globally. - CONFIG_PAGE_TABLE_CHECK=y for userspace mapping sanity. Reviewed-by: Nathan Chancellor <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent fb28a88 commit a284e43

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

arch/arm64/configs/hardening.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CONFIG_ARM64_SW_TTBR0_PAN=y
55

66
# Software Shadow Stack or PAC
77
CONFIG_SHADOW_CALL_STACK=y
8+
CONFIG_UNWIND_PATCH_PAC_INTO_SCS=y
89

910
# Pointer authentication (ARMv8.3 and later). If hardware actually supports
1011
# it, one can turn off CONFIG_STACKPROTECTOR_STRONG with this enabled.

arch/x86/configs/hardening.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@ CONFIG_INTEL_IOMMU_DEFAULT_ON=y
1010
CONFIG_INTEL_IOMMU_SVM=y
1111
CONFIG_AMD_IOMMU=y
1212

13+
# Enforce CET Indirect Branch Tracking in the kernel.
14+
CONFIG_X86_KERNEL_IBT=y
15+
1316
# Enable CET Shadow Stack for userspace.
1417
CONFIG_X86_USER_SHADOW_STACK=y

kernel/configs/hardening.config

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ CONFIG_SLAB_FREELIST_HARDENED=y
2323
CONFIG_SHUFFLE_PAGE_ALLOCATOR=y
2424
CONFIG_RANDOM_KMALLOC_CACHES=y
2525

26+
# Sanity check userspace page table mappings.
27+
CONFIG_PAGE_TABLE_CHECK=y
28+
CONFIG_PAGE_TABLE_CHECK_ENFORCED=y
29+
2630
# Randomize kernel stack offset on syscall entry.
2731
CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT=y
2832

@@ -81,6 +85,10 @@ CONFIG_SECCOMP_FILTER=y
8185
# Provides some protections against SYN flooding.
8286
CONFIG_SYN_COOKIES=y
8387

88+
# Enable Kernel Control Flow Integrity (currently Clang only).
89+
CONFIG_CFI_CLANG=y
90+
# CONFIG_CFI_PERMISSIVE is not set
91+
8492
# Attack surface reduction: do not autoload TTY line disciplines.
8593
# CONFIG_LDISC_AUTOLOAD is not set
8694

0 commit comments

Comments
 (0)