Update KSPP recommendations
[kconfig-hardened-check.git] / config_files / kspp-recommendations / kspp-recommendations-x86-32.config
1 # CONFIGs
2 # Linux/i386 4.20.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 builds only. For GCC, see CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL=y below)
72 CONFIG_INIT_STACK_ALL=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 # Dangerous; enabling this allows direct physical memory writing.
84 # CONFIG_ACPI_CUSTOM_METHOD is not set
85
86 # Dangerous; enabling this disables brk ASLR.
87 # CONFIG_COMPAT_BRK is not set
88
89 # Dangerous; enabling this allows direct kernel memory writing.
90 # CONFIG_DEVKMEM is not set
91
92 # Dangerous; exposes kernel text image layout.
93 # CONFIG_PROC_KCORE is not set
94
95 # Dangerous; enabling this disables VDSO ASLR.
96 # CONFIG_COMPAT_VDSO is not set
97
98 # Dangerous; enabling this allows replacement of running kernel.
99 # CONFIG_KEXEC is not set
100
101 # Dangerous; enabling this allows replacement of running kernel.
102 # CONFIG_HIBERNATION is not set
103
104 # Prior to v4.1, assists heap memory attacks; best to keep interface disabled.
105 # CONFIG_INET_DIAG is not set
106
107 # Easily confused by misconfigured userspace, keep off.
108 # CONFIG_BINFMT_MISC is not set
109
110 # Use the modern PTY interface (devpts) only.
111 # CONFIG_LEGACY_PTYS is not set
112
113 # If SELinux can be disabled at runtime, the LSM structures cannot be read-only; keep off.
114 # CONFIG_SECURITY_SELINUX_DISABLE is not set
115
116 # Reboot devices immediately if kernel experiences an Oops.
117 CONFIG_PANIC_ON_OOPS=y
118 CONFIG_PANIC_TIMEOUT=-1
119
120 # Keep root from altering kernel memory via loadable modules.
121 # CONFIG_MODULES is not set
122
123 # But if CONFIG_MODULE=y is needed, at least they must be signed with a per-build key.
124 CONFIG_STRICT_MODULE_RWX=y
125 CONFIG_MODULE_SIG=y
126 CONFIG_MODULE_SIG_FORCE=y
127 CONFIG_MODULE_SIG_ALL=y
128 CONFIG_MODULE_SIG_SHA512=y
129 CONFIG_MODULE_SIG_HASH="sha512"
130 CONFIG_MODULE_SIG_KEY="certs/signing_key.pem"
131
132 # GCC plugins
133
134 # Enable GCC Plugins
135 CONFIG_GCC_PLUGINS=y
136
137 # Gather additional entropy at boot time for systems that may not have appropriate entropy sources.
138 CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y
139
140 # Force all structures to be initialized before they are passed to other functions.
141 # When building with GCC:
142 CONFIG_GCC_PLUGIN_STRUCTLEAK=y
143 CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL=y
144
145 # Wipe stack contents on syscall exit (reduces stale data lifetime in stack)
146 CONFIG_GCC_PLUGIN_STACKLEAK=y
147
148 # Randomize the layout of system structures. This may have dramatic performance impact, so
149 # use with caution or also use CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE=y
150 CONFIG_GCC_PLUGIN_RANDSTRUCT=y
151
152 # x86_32
153
154 CONFIG_X86_32=y
155
156 # On 32-bit kernels, require PAE for NX bit support.
157 # CONFIG_M486 is not set
158 # CONFIG_HIGHMEM4G is not set
159 CONFIG_HIGHMEM64G=y
160 CONFIG_X86_PAE=y
161
162 # Disallow allocating the first 64k of memory.
163 CONFIG_DEFAULT_MMAP_MIN_ADDR=65536
164
165 # Randomize position of kernel.
166 CONFIG_RANDOMIZE_BASE=y
167