| 1 |
# Linux/arm 6.17.3 Kernel Configuration |
| 2 |
|
| 3 |
# Report BUG() conditions and kill the offending process. |
| 4 |
CONFIG_BUG=y |
| 5 |
|
| 6 |
# Make sure kernel page tables have safe permissions. |
| 7 |
CONFIG_STRICT_KERNEL_RWX=y |
| 8 |
|
| 9 |
# Report any dangerous memory permissions (not available on all archs). |
| 10 |
CONFIG_DEBUG_WX=y |
| 11 |
|
| 12 |
# Use -fstack-protector-strong (gcc 4.9+) for best stack canary coverage. |
| 13 |
# Prior to v4.18, these are: |
| 14 |
# CONFIG_CC_STACKPROTECTOR=y |
| 15 |
# CONFIG_CC_STACKPROTECTOR_STRONG=y |
| 16 |
CONFIG_STACKPROTECTOR=y |
| 17 |
CONFIG_STACKPROTECTOR_STRONG=y |
| 18 |
|
| 19 |
# Do not allow direct physical memory access (but if you must have it, at least enable STRICT mode...) |
| 20 |
# CONFIG_DEVMEM is not set |
| 21 |
CONFIG_STRICT_DEVMEM=y |
| 22 |
CONFIG_IO_STRICT_DEVMEM=y |
| 23 |
|
| 24 |
# Provides some protections against SYN flooding. |
| 25 |
CONFIG_SYN_COOKIES=y |
| 26 |
|
| 27 |
# Perform additional validation of various commonly targeted structures. |
| 28 |
CONFIG_LIST_HARDENED=y |
| 29 |
CONFIG_DEBUG_CREDENTIALS=y |
| 30 |
CONFIG_DEBUG_NOTIFIERS=y |
| 31 |
CONFIG_DEBUG_LIST=y |
| 32 |
CONFIG_DEBUG_SG=y |
| 33 |
CONFIG_DEBUG_VIRTUAL=y |
| 34 |
CONFIG_BUG_ON_DATA_CORRUPTION=y |
| 35 |
CONFIG_SCHED_STACK_END_CHECK=y |
| 36 |
|
| 37 |
# Provide userspace with seccomp BPF API for syscall attack surface reduction. |
| 38 |
CONFIG_SECCOMP=y |
| 39 |
CONFIG_SECCOMP_FILTER=y |
| 40 |
|
| 41 |
# Make sure line disciplines can't be autoloaded (since v5.1). |
| 42 |
# CONFIG_LDISC_AUTOLOAD is not set |
| 43 |
|
| 44 |
# Provide userspace with ptrace ancestry protections. |
| 45 |
# Make sure that "yama" is also present in the "CONFIG_LSM=yama,..." list. |
| 46 |
CONFIG_SECURITY=y |
| 47 |
CONFIG_SECURITY_YAMA=y |
| 48 |
|
| 49 |
# Provide userspace with Landlock MAC interface. |
| 50 |
# Make sure that "landlock" is also present in the "CONFIG_LSM=landlock,..." list. |
| 51 |
CONFIG_SECURITY_LANDLOCK=y |
| 52 |
|
| 53 |
# Make sure SELinux cannot be disabled trivially. |
| 54 |
# CONFIG_SECURITY_SELINUX_BOOTPARAM is not set |
| 55 |
# CONFIG_SECURITY_SELINUX_DEVELOP is not set |
| 56 |
# CONFIG_SECURITY_SELINUX_DEBUG is not set |
| 57 |
# CONFIG_SECURITY_WRITABLE_HOOKS is not set |
| 58 |
|
| 59 |
# Enable "lockdown" LSM for bright line between the root user and kernel memory. |
| 60 |
CONFIG_SECURITY_LOCKDOWN_LSM=y |
| 61 |
CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=y |
| 62 |
CONFIG_LOCK_DOWN_KERNEL_FORCE_CONFIDENTIALITY=y |
| 63 |
|
| 64 |
# Perform usercopy bounds checking. (And disable fallback to gain full whitelist enforcement.) |
| 65 |
CONFIG_HARDENED_USERCOPY=y |
| 66 |
# CONFIG_HARDENED_USERCOPY_FALLBACK is not set |
| 67 |
# CONFIG_HARDENED_USERCOPY_PAGESPAN is not set |
| 68 |
|
| 69 |
# Randomize allocator freelists, harden metadata. |
| 70 |
CONFIG_SLAB_FREELIST_RANDOM=y |
| 71 |
CONFIG_SLAB_FREELIST_HARDENED=y |
| 72 |
CONFIG_RANDOM_KMALLOC_CACHES=y |
| 73 |
|
| 74 |
# Make cross-slab heap attacks not as trivial when object sizes are the same. (Same as slab_nomerge boot param.) |
| 75 |
# CONFIG_SLAB_MERGE_DEFAULT is not set |
| 76 |
|
| 77 |
# Allow for randomization of high-order page allocation freelist. Must be enabled with |
| 78 |
# the "page_alloc.shuffle=1" command line below). |
| 79 |
CONFIG_SHUFFLE_PAGE_ALLOCATOR=y |
| 80 |
|
| 81 |
# Sanity check userspace page table mappings (since v5.17) |
| 82 |
CONFIG_PAGE_TABLE_CHECK=y |
| 83 |
CONFIG_PAGE_TABLE_CHECK_ENFORCED=y |
| 84 |
|
| 85 |
# Allow allocator validation checking to be enabled (see "slub_debug=P" below). |
| 86 |
CONFIG_SLUB_DEBUG=y |
| 87 |
|
| 88 |
# Wipe higher-level memory allocations when they are freed (needs "page_poison=1" command line below). |
| 89 |
# This kernel feature was removed in v5.11. |
| 90 |
# Starting from v5.11 CONFIG_PAGE_POISONING unconditionally checks the 0xAA poison pattern on allocation. |
| 91 |
CONFIG_PAGE_POISONING_ZERO=y |
| 92 |
|
| 93 |
# Wipe slab and page allocations (since v5.3) |
| 94 |
# Instead of "slub_debug=P" and "page_poison=1", a single place can control memory allocation wiping now. |
| 95 |
# The init_on_free is only needed if there is concern about minimizing stale data lifetime. |
| 96 |
CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y |
| 97 |
CONFIG_INIT_ON_FREE_DEFAULT_ON=y |
| 98 |
|
| 99 |
# Initialize all stack variables on function entry. (Clang and GCC 12+ builds only. For earlier GCC, see CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL=y below) |
| 100 |
CONFIG_INIT_STACK_ALL_ZERO=y |
| 101 |
|
| 102 |
# Adds guard pages to kernel stacks (not all architectures support this yet). |
| 103 |
CONFIG_VMAP_STACK=y |
| 104 |
|
| 105 |
# Perform extensive checks on reference counting. |
| 106 |
CONFIG_REFCOUNT_FULL=y |
| 107 |
|
| 108 |
# Check for memory copies that might overflow a structure in str*() and mem*() functions both at build-time and run-time. |
| 109 |
CONFIG_FORTIFY_SOURCE=y |
| 110 |
|
| 111 |
# Avoid kernel memory address exposures via dmesg (sets sysctl kernel.dmesg_restrict initial value to 1) |
| 112 |
CONFIG_SECURITY_DMESG_RESTRICT=y |
| 113 |
|
| 114 |
# Enable trapping bounds checking of array indexes (since v5.11). All the other UBSAN checks should be disabled. |
| 115 |
CONFIG_UBSAN=y |
| 116 |
CONFIG_UBSAN_TRAP=y |
| 117 |
CONFIG_UBSAN_BOUNDS=y |
| 118 |
CONFIG_UBSAN_SANITIZE_ALL=y |
| 119 |
# CONFIG_UBSAN_SHIFT is not set |
| 120 |
# CONFIG_UBSAN_DIV_ZERO is not set |
| 121 |
# CONFIG_UBSAN_UNREACHABLE is not set |
| 122 |
# CONFIG_UBSAN_SIGNED_WRAP is not set |
| 123 |
# CONFIG_UBSAN_BOOL is not set |
| 124 |
# CONFIG_UBSAN_ENUM is not set |
| 125 |
# CONFIG_UBSAN_ALIGNMENT is not set |
| 126 |
# This is only available on Clang builds, and is likely already enabled if CONFIG_UBSAN_BOUNDS=y is set: |
| 127 |
CONFIG_UBSAN_LOCAL_BOUNDS=y |
| 128 |
|
| 129 |
# Enable sampling-based overflow detection (since v5.12). This is similar to KASAN coverage, but with almost zero runtime overhead. |
| 130 |
CONFIG_KFENCE=y |
| 131 |
CONFIG_KFENCE_SAMPLE_INTERVAL=100 |
| 132 |
|
| 133 |
# Randomize kernel stack offset on syscall entry (since v5.13). |
| 134 |
CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT=y |
| 135 |
|
| 136 |
# Do not ignore compile-time warnings (since v5.15) |
| 137 |
CONFIG_WERROR=y |
| 138 |
|
| 139 |
# Disable DMA between EFI hand-off and the kernel's IOMMU setup. |
| 140 |
CONFIG_EFI_DISABLE_PCI_DMA=y |
| 141 |
|
| 142 |
# Force IOMMU TLB invalidation so devices will never be able to access stale data contents (or set "iommu.passthrough=0 iommu.strict=1" at boot) |
| 143 |
CONFIG_IOMMU_SUPPORT=y |
| 144 |
CONFIG_IOMMU_DEFAULT_DMA_STRICT=y |
| 145 |
# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set |
| 146 |
|
| 147 |
# Enable feeding RNG entropy from TPM, if available. |
| 148 |
CONFIG_HW_RANDOM_TPM=y |
| 149 |
|
| 150 |
# Get as much entropy as possible from external sources. The Chacha mixer isn't vulnerable to injected entropy, so even |
| 151 |
# malicious sources should not cause problems. |
| 152 |
CONFIG_RANDOM_TRUST_BOOTLOADER=y |
| 153 |
CONFIG_RANDOM_TRUST_CPU=y |
| 154 |
|
| 155 |
# Randomize the layout of system structures. This may have dramatic performance impact, so |
| 156 |
# use with caution. If using GCC, you can check if using CONFIG_RANDSTRUCT_PERFORMANCE=y is better. |
| 157 |
CONFIG_RANDSTRUCT_FULL=y |
| 158 |
|
| 159 |
# Make scheduler aware of SMT Cores. Program needs to opt-in to using this feature with prctl(PR_SCHED_CORE). |
| 160 |
CONFIG_SCHED_CORE=y |
| 161 |
|
| 162 |
# Wipe all caller-used registers on exit from the function (reduces available ROP gadgets and |
| 163 |
# minimizes stale data in registers). (Since v5.15) |
| 164 |
CONFIG_ZERO_CALL_USED_REGS=y |
| 165 |
|
| 166 |
# Wipe RAM at reboot via EFI. |
| 167 |
# For more details, see: |
| 168 |
# https://trustedcomputinggroup.org/resource/pc-client-work-group-platform-reset-attack-mitigation-specification/ |
| 169 |
# https://bugzilla.redhat.com/show_bug.cgi?id=1532058 |
| 170 |
CONFIG_RESET_ATTACK_MITIGATION=y |
| 171 |
|
| 172 |
# This needs userspace support, and will break "regular" distros. See: https://github.com/tych0/huldufolk |
| 173 |
CONFIG_STATIC_USERMODEHELPER=y |
| 174 |
|
| 175 |
# Dangerous; enabling this allows direct physical memory writing. |
| 176 |
# CONFIG_ACPI_CUSTOM_METHOD is not set |
| 177 |
|
| 178 |
# Dangerous; enabling this disables brk ASLR. |
| 179 |
# CONFIG_COMPAT_BRK is not set |
| 180 |
|
| 181 |
# Dangerous; enabling this allows direct kernel memory writing. |
| 182 |
# CONFIG_DEVKMEM is not set |
| 183 |
|
| 184 |
# Dangerous; exposes kernel text image layout. |
| 185 |
# CONFIG_PROC_KCORE is not set |
| 186 |
|
| 187 |
# Dangerous; enabling this allows replacement of running kernel. |
| 188 |
# CONFIG_KEXEC is not set |
| 189 |
|
| 190 |
# Dangerous; enabling this allows replacement of running kernel. |
| 191 |
# CONFIG_HIBERNATION is not set |
| 192 |
|
| 193 |
# Prior to v4.1, assists heap memory attacks; best to keep interface disabled. |
| 194 |
# CONFIG_INET_DIAG is not set |
| 195 |
|
| 196 |
# Easily confused by misconfigured userspace, keep off. |
| 197 |
# CONFIG_BINFMT_MISC is not set |
| 198 |
|
| 199 |
# Use the modern PTY interface (devpts) only. |
| 200 |
# CONFIG_LEGACY_PTYS is not set |
| 201 |
|
| 202 |
# Block TTY stuffing attacks (this will break screen readers, see "dev.tty.legacy_tiocsti" sysctl below). |
| 203 |
# CONFIG_LEGACY_TIOCSTI is not set |
| 204 |
|
| 205 |
# If SELinux can be disabled at runtime, the LSM structures cannot be read-only; keep off. |
| 206 |
# CONFIG_SECURITY_SELINUX_DISABLE is not set |
| 207 |
|
| 208 |
# Reboot devices immediately if kernel experiences an Oops. |
| 209 |
CONFIG_PANIC_ON_OOPS=y |
| 210 |
CONFIG_PANIC_TIMEOUT=-1 |
| 211 |
|
| 212 |
# Limit sysrq to sync,unmount,reboot. For more details see the sysrq bit field table: |
| 213 |
# https://docs.kernel.org/admin-guide/sysrq.html |
| 214 |
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=176 |
| 215 |
|
| 216 |
# Keep root from altering kernel memory via loadable modules. |
| 217 |
# CONFIG_MODULES is not set |
| 218 |
|
| 219 |
# But if CONFIG_MODULE=y is needed, at least they must be signed with a per-build key. |
| 220 |
# See also kernel.modules_disabled sysctl below. |
| 221 |
CONFIG_STRICT_MODULE_RWX=y |
| 222 |
CONFIG_MODULE_SIG=y |
| 223 |
CONFIG_MODULE_SIG_FORCE=y |
| 224 |
CONFIG_MODULE_SIG_ALL=y |
| 225 |
CONFIG_MODULE_SIG_SHA512=y |
| 226 |
CONFIG_MODULE_SIG_HASH="sha512" |
| 227 |
CONFIG_MODULE_SIG_KEY="certs/signing_key.pem" |
| 228 |
# CONFIG_MODULE_FORCE_LOAD is not set |
| 229 |
|
| 230 |
# GCC plugins |
| 231 |
|
| 232 |
# Enable GCC Plugins |
| 233 |
CONFIG_GCC_PLUGINS=y |
| 234 |
|
| 235 |
# Gather additional entropy at boot time for systems that may not have appropriate entropy sources. |
| 236 |
CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y |
| 237 |
|
| 238 |
# Force all structures to be initialized before they are passed to other functions. |
| 239 |
# When building with GCC: |
| 240 |
CONFIG_GCC_PLUGIN_STRUCTLEAK=y |
| 241 |
CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL=y |
| 242 |
|
| 243 |
# Wipe stack contents on syscall exit (reduces stale data lifetime in stack) |
| 244 |
CONFIG_GCC_PLUGIN_STACKLEAK=y |
| 245 |
# CONFIG_STACKLEAK_METRICS is not set |
| 246 |
# CONFIG_STACKLEAK_RUNTIME_DISABLE is not set |
| 247 |
|
| 248 |
# arm |
| 249 |
|
| 250 |
CONFIG_ARM=y |
| 251 |
CONFIG_CC_IS_GCC=y |
| 252 |
|
| 253 |
# Disallow allocating the first 32k of memory (cannot be 64k due to ARM loader). |
| 254 |
CONFIG_DEFAULT_MMAP_MIN_ADDR=32768 |
| 255 |
|
| 256 |
# For maximal userspace memory area (and maximum ASLR). |
| 257 |
CONFIG_VMSPLIT_3G=y |
| 258 |
|
| 259 |
# Make sure PXN/PAN emulation is enabled. |
| 260 |
CONFIG_CPU_SW_DOMAIN_PAN=y |
| 261 |
|
| 262 |
# Dangerous; old interfaces and needless additional attack surface. |
| 263 |
# CONFIG_OABI_COMPAT is not set |