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