b8097c6793f76820bf1e889ecb4091f36cb40027
[kconfig-hardened-check.git] / kconfig_hardened_check / config_files / kspp-recommendations / kspp-recommendations-x86-64.config
1 # CONFIGs
2 # Linux/x86_64 5.14.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 CONFIG_SECURITY=y
42 CONFIG_SECURITY_YAMA=y
43
44 # Perform usercopy bounds checking. (And disable fallback to gain full whitelist enforcement.)
45 CONFIG_HARDENED_USERCOPY=y
46 # CONFIG_HARDENED_USERCOPY_FALLBACK is not set
47 # CONFIG_HARDENED_USERCOPY_PAGESPAN is not set
48
49 # Randomize allocator freelists, harden metadata.
50 CONFIG_SLAB_FREELIST_RANDOM=y
51 CONFIG_SLAB_FREELIST_HARDENED=y
52
53 # Randomize high-order page allocation freelist.
54 CONFIG_SHUFFLE_PAGE_ALLOCATOR=y
55
56 # Allow allocator validation checking to be enabled (see "slub_debug=P" below).
57 CONFIG_SLUB_DEBUG=y
58
59 # Wipe higher-level memory allocations when they are freed (needs "page_poison=1" command line below).
60 # (If you can afford even more performance penalty, leave CONFIG_PAGE_POISONING_NO_SANITY=n)
61 CONFIG_PAGE_POISONING=y
62 CONFIG_PAGE_POISONING_NO_SANITY=y
63 CONFIG_PAGE_POISONING_ZERO=y
64
65 # Wipe slab and page allocations (since v5.3)
66 # Instead of "slub_debug=P" and "page_poison=1", a single place can control memory allocation wiping now.
67 # The init_on_free is only needed if there is concern about minimizing stale data lifetime.
68 CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
69 CONFIG_INIT_ON_FREE_DEFAULT_ON=y
70
71 # 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)
72 CONFIG_INIT_STACK_ALL_ZERO=y
73
74 # Adds guard pages to kernel stacks (not all architectures support this yet).
75 CONFIG_VMAP_STACK=y
76
77 # Perform extensive checks on reference counting.
78 CONFIG_REFCOUNT_FULL=y
79
80 # Check for memory copies that might overflow a structure in str*() and mem*() functions both at build-time and run-time.
81 CONFIG_FORTIFY_SOURCE=y
82
83 # Avoid kernel memory address exposures via dmesg (sets sysctl kernel.dmesg_restrict initial value to 1)
84 CONFIG_SECURITY_DMESG_RESTRICT=y
85
86 # Randomize kernel stack offset on syscall entry (since v5.13).
87 CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT=y
88
89 # Enable sampling-based overflow detection. This is similar to KASAN coverage, but with almost zero runtime overhead.
90 CONFIG_KFENCE=y
91
92 # Do not ignore compile-time warnings (since v5.15)
93 CONFIG_WERROR=y
94
95 # 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)
96 CONFIG_IOMMU_DEFAULT_DMA_STRICT=y
97
98 # Make scheduler aware of SMT Cores. Program needs to opt-in to using this feature with prctl(PR_SCHED_CORE).
99 CONFIG_SCHED_CORE=y
100
101 # Wipe all caller-used registers on exit from the function (reduces available ROP gadgets and minimizes stale data in registers)
102 CONFIG_ZERO_CALL_USED_REGS=y
103
104 # Dangerous; enabling this allows direct physical memory writing.
105 # CONFIG_ACPI_CUSTOM_METHOD is not set
106
107 # Dangerous; enabling this disables brk ASLR.
108 # CONFIG_COMPAT_BRK is not set
109
110 # Dangerous; enabling this allows direct kernel memory writing.
111 # CONFIG_DEVKMEM is not set
112
113 # Dangerous; exposes kernel text image layout.
114 # CONFIG_PROC_KCORE is not set
115
116 # Dangerous; enabling this disables VDSO ASLR.
117 # CONFIG_COMPAT_VDSO is not set
118
119 # Dangerous; enabling this allows replacement of running kernel.
120 # CONFIG_KEXEC is not set
121
122 # Dangerous; enabling this allows replacement of running kernel.
123 # CONFIG_HIBERNATION is not set
124
125 # Prior to v4.1, assists heap memory attacks; best to keep interface disabled.
126 # CONFIG_INET_DIAG is not set
127
128 # Easily confused by misconfigured userspace, keep off.
129 # CONFIG_BINFMT_MISC is not set
130
131 # Use the modern PTY interface (devpts) only.
132 # CONFIG_LEGACY_PTYS is not set
133
134 # If SELinux can be disabled at runtime, the LSM structures cannot be read-only; keep off.
135 # CONFIG_SECURITY_SELINUX_DISABLE is not set
136
137 # Reboot devices immediately if kernel experiences an Oops.
138 CONFIG_PANIC_ON_OOPS=y
139 CONFIG_PANIC_TIMEOUT=-1
140
141 # Keep root from altering kernel memory via loadable modules.
142 # CONFIG_MODULES is not set
143
144 # But if CONFIG_MODULE=y is needed, at least they must be signed with a per-build key.
145 CONFIG_STRICT_MODULE_RWX=y
146 CONFIG_MODULE_SIG=y
147 CONFIG_MODULE_SIG_FORCE=y
148 CONFIG_MODULE_SIG_ALL=y
149 CONFIG_MODULE_SIG_SHA512=y
150 CONFIG_MODULE_SIG_HASH="sha512"
151 CONFIG_MODULE_SIG_KEY="certs/signing_key.pem"
152
153 # GCC plugins
154
155 # Enable GCC Plugins
156 CONFIG_GCC_PLUGINS=y
157
158 # Gather additional entropy at boot time for systems that may not have appropriate entropy sources.
159 CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y
160
161 # Force all structures to be initialized before they are passed to other functions.
162 # When building with GCC:
163 CONFIG_GCC_PLUGIN_STRUCTLEAK=y
164 CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL=y
165
166 # Wipe stack contents on syscall exit (reduces stale data lifetime in stack)
167 CONFIG_GCC_PLUGIN_STACKLEAK=y
168
169 # Randomize the layout of system structures. This may have dramatic performance impact, so
170 # use with caution or also use CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE=y
171 CONFIG_GCC_PLUGIN_RANDSTRUCT=y
172
173 # x86_64
174
175 # Full 64-bit means PAE and NX bit.
176 CONFIG_X86_64=y
177
178 # Disallow allocating the first 64k of memory.
179 CONFIG_DEFAULT_MMAP_MIN_ADDR=65536
180
181 # Disable Model-Specific Register writes.
182 # CONFIG_X86_MSR is not set
183
184 # Randomize position of kernel and memory.
185 CONFIG_RANDOMIZE_BASE=y
186 CONFIG_RANDOMIZE_MEMORY=y
187
188 # Modern libc no longer needs a fixed-position mapping in userspace, remove it as a possible target.
189 CONFIG_LEGACY_VSYSCALL_NONE=y
190
191 # Enable Kernel Page Table Isolation to remove an entire class of cache timing side-channels.
192 CONFIG_PAGE_TABLE_ISOLATION=y
193
194 # Remove additional attack surface, unless you really need them.
195 # CONFIG_IA32_EMULATION is not set
196 # CONFIG_X86_X32 is not set
197 # CONFIG_MODIFY_LDT_SYSCALL is not set
198
199