Fix the reason for the nosmt check
[kconfig-hardened-check.git] / issues.md
1 Export of Github issues for [a13xp0p0v/kernel-hardening-checker](https://github.com/a13xp0p0v/kernel-hardening-checker). Generated on 2023.09.18 at 01:51:32.
2
3 # [\#87 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/87) `open`: Add a check for IA32_EMULATION
4
5 #### <img src="https://avatars.githubusercontent.com/u/325724?u=4446b76c0f4ebcbecb2678759f8d13817a67f85d&v=4" width="50">[jvoisin](https://github.com/jvoisin) opened issue at [2023-09-14 12:36](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/87):
6
7 As [reported by phoronix](https://www.phoronix.com/news/Linux-6.7-ia32_emulation-Boot), it's now possible to disable 32b support on amd64, to reduce attack surface.
8
9
10
11
12 -------------------------------------------------------------------------------
13
14 # [\#86 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/86) `merged`: Add colors to output
15
16 #### <img src="https://avatars.githubusercontent.com/u/5826484?u=2cc3ddef5824379423495733759ef362d0600078&v=4" width="50">[frakman1](https://github.com/frakman1) opened issue at [2023-09-10 17:49](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/86):
17
18 Shows OK in green and FAIL in red
19
20 <img width="1047" alt="image" src="https://github.com/a13xp0p0v/kconfig-hardened-check/assets/5826484/d098d14f-2e1a-4569-af22-54ef2bc0eecb">
21
22 fixes #81
23
24 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-09-10 19:25](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/86#issuecomment-1712916729):
25
26 @frakman1, thanks for the pull request!
27
28 There are some small mistakes that break the tests.
29
30 Looking forward to your fixes.
31
32 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-09-11 18:25](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/86#issuecomment-1714376333):
33
34 Hello @frakman1, the CI tests are broken again.
35
36 Please see, the argument of `colorize_result()` may be None in the verbose mode of the tool.
37 So we need to add something like that at the beginning of the function:
38 ```
39     if input is None:
40         return input
41 ```
42
43 Also please fix two pylint warnings added by this PR:
44
45 1) W0311: Bad indentation. Found 17 spaces, expected 16 (bad-indentation)
46
47 2) W0622: Redefining built-in 'input' (redefined-builtin).
48 To fix this, you need to rename the argument of the function.
49
50 Thanks again!
51 Looking forward to the fixes.
52
53 #### <img src="https://avatars.githubusercontent.com/u/65553080?u=1e9e0de760ac0083c86dab588f627a0468cd714e&v=4" width="50">[codecov-commenter](https://github.com/codecov-commenter) commented at [2023-09-11 23:05](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/86#issuecomment-1714703072):
54
55 ## [Codecov](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/86?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) Report
56 > Merging [#86](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/86?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (374aee3) into [master](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/commit/108eb7374967b0f66e70b68cca60a0548f12844c?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (108eb73) will **decrease** coverage by `1.32%`.
57 > The diff coverage is `87.50%`.
58
59 :exclamation: Your organization needs to install the [Codecov GitHub app](https://github.com/apps/codecov/installations/select_target) to enable full functionality.
60
61 ```diff
62 @@             Coverage Diff             @@
63 ##            master      #86      +/-   ##
64 ===========================================
65 - Coverage   100.00%   98.68%   -1.32%     
66 ===========================================
67   Files            6        5       -1     
68   Lines         1049      839     -210     
69   Branches       184      187       +3     
70 ===========================================
71 - Hits          1049      828     -221     
72 - Misses           0        5       +5     
73 - Partials         0        6       +6     
74 ```
75
76 | [Flag](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/86/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) | Coverage Δ | |
77 |---|---|---|
78 | [engine_unit-test](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/86/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) | `?` | |
79 | [functional_test](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/86/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) | `98.68% <87.50%> (-0.23%)` | :arrow_down: |
80
81 Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#carryforward-flags-in-the-pull-request-comment) to find out more.
82
83 | [Files Changed](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/86?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) | Coverage Δ | |
84 |---|---|---|
85 | [kconfig\_hardened\_check/engine.py](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/86?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#diff-a2NvbmZpZ19oYXJkZW5lZF9jaGVjay9lbmdpbmUucHk=) | `94.58% <87.50%> (-5.42%)` | :arrow_down: |
86
87 ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/86/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)
88
89 :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)
90
91 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-09-12 17:40](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/86#issuecomment-1716159903):
92
93 @frakman1, thanks for the fixes!
94
95 I think we should better add colors to the `stdout_result` in the unit tests instead of filtering them out before `assertEqual()`.
96
97 That would allow to test that `colorize_result()` works as expected.
98
99 #### <img src="https://avatars.githubusercontent.com/u/5826484?u=2cc3ddef5824379423495733759ef362d0600078&v=4" width="50">[frakman1](https://github.com/frakman1) commented at [2023-09-12 22:12](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/86#issuecomment-1716580970):
100
101 I'm sorry, this is outside the scope of my knowledge or effort. Not intersted in re-writing test cases.
102
103 #### <img src="https://avatars.githubusercontent.com/u/5826484?u=2cc3ddef5824379423495733759ef362d0600078&v=4" width="50">[frakman1](https://github.com/frakman1) commented at [2023-09-13 22:14](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/86#issuecomment-1718385583):
104
105 Thank you!
106
107 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-09-13 22:50](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/86#issuecomment-1718412639):
108
109 Added f8f7033.
110
111 Thanks for you contribution, @frakman1!
112
113
114 -------------------------------------------------------------------------------
115
116 # [\#85 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/85) `merged`: Rename kconfig-hardened-check into kernel-hardening-checker
117
118 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) opened issue at [2023-09-10 12:18](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/85):
119
120 **kconfig-hardened-check** is a tool for checking the security hardening options of the Linux kernel.
121
122 In addition to Kconfig options, it now can check kernel cmdline arguments and sysctl parameters.
123
124 It's time to give this project a new name that describes it better: **kernel-hardening-checker**.
125
126 #### <img src="https://avatars.githubusercontent.com/u/65553080?u=1e9e0de760ac0083c86dab588f627a0468cd714e&v=4" width="50">[codecov-commenter](https://github.com/codecov-commenter) commented at [2023-09-10 12:19](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/85#issuecomment-1712799348):
127
128 ## [Codecov](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/85?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) Report
129 > Merging [#85](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/85?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (032f67f) into [master](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/commit/f8e47e12ddf6b5c7b7562af6b85b8f65481e4b07?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (f8e47e1) will **decrease** coverage by `0.04%`.
130 > The diff coverage is `n/a`.
131
132 :exclamation: Your organization needs to install the [Codecov GitHub app](https://github.com/apps/codecov/installations/select_target) to enable full functionality.
133
134 ```diff
135 @@            Coverage Diff             @@
136 ##           master      #85      +/-   ##
137 ==========================================
138 - Coverage   99.81%   99.77%   -0.04%     
139 ==========================================
140   Files           6        2       -4     
141   Lines        1087      451     -636     
142   Branches      174        0     -174     
143 ==========================================
144 - Hits         1085      450     -635     
145   Misses          1        1              
146 + Partials        1        0       -1     
147 ```
148
149 | [Flag](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/85/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) | Coverage Δ | |
150 |---|---|---|
151 | [engine_unit-test](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/85/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) | `99.77% <ø> (ø)` | |
152 | [functional_test](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/85/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) | `?` | |
153
154 Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#carryforward-flags-in-the-pull-request-comment) to find out more.
155
156 | [Files Changed](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/85?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) | Coverage Δ | |
157 |---|---|---|
158 | [kernel\_hardening\_checker/engine.py](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/85?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#diff-a2VybmVsX2hhcmRlbmluZ19jaGVja2VyL2VuZ2luZS5weQ==) | `99.50% <ø> (ø)` | |
159 | [kernel\_hardening\_checker/test\_engine.py](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/85?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#diff-a2VybmVsX2hhcmRlbmluZ19jaGVja2VyL3Rlc3RfZW5naW5lLnB5) | `100.00% <ø> (ø)` | |
160
161 ... and [4 files with indirect coverage changes](https://app.codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/85/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)
162
163 :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)
164
165
166 -------------------------------------------------------------------------------
167
168 # [\#84 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/84) `open`: Add RDK Linux Hardening specification flags
169
170 #### <img src="https://avatars.githubusercontent.com/u/5826484?u=2cc3ddef5824379423495733759ef362d0600078&v=4" width="50">[frakman1](https://github.com/frakman1) opened issue at [2023-09-01 12:48](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/84):
171
172 The [RDK Linux Hardening specification](https://developer.rdkcentral.com/documentation/documentation/licensee_specific_subsystems/rdk_security_concepts/rdk_software_security_specifications/rdk_linux_hardening_specification/) lists many flags that are not checked in this tool. The first five I looked for were not there: `CONFIG_DEBUG_KERNEL` `CONFIG_MARKERS` `CONFIG_DEBUG_MEMLEAK` and `CONFIG_ELF_CORE`
173
174 Perhaps these can be added as part of a new 'RDK security policy' check for the 'decision' column
175
176 #### <img src="https://avatars.githubusercontent.com/u/5826484?u=2cc3ddef5824379423495733759ef362d0600078&v=4" width="50">[frakman1](https://github.com/frakman1) commented at [2023-09-05 14:23](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/84#issuecomment-1706723756):
177
178 Link no longer appears to be up. I saved a cache for reference:
179
180 ----
181
182 RDK Linux Hardening specification 
183 Created on June 21, 2022 
184 1.      Ensure no hard-coded credentials are present in the clear
185 2.      Ensure compliance with Comcast specifications for crypto and TLS 
186 o       All STB connections to servers must be secured using TLS 1.2 or above, and verified to be correctly performing server certificate chain validation
187 3.      Build with stack-smashing (at least for modules implementing security) 
188 o       Enable CONFIG_CC_STACKPROTECTOR, -fstack-protector-all, -Wstack-protector
189 o       Libc function buffer overrun checks: _FORTIFY_SOURCE=2
190 o       Initial requirement would be to enable this for all security sensitive modules with follow up to enable for the entire build.
191 4.      Scan all non-OSS sources with static analyzer
192 5.      Network port blocking 
193 o       All ports not specifically used must be blocked by ipTables rules 
194 6.      Disable all unused devices (USB, Bluetooth, etc)
195 7.      Implement multiuser/sandbox strategy (Restrict Linux process privileges) 
196 o       No applications/utilities within a sandbox should run as root or have any means to achieve root privileges.  Sandbox shall not contains hard links to outside files.  Every sandbox connected to external network shall contain its own firewall and shall be configured using a whitelist.
197 o       Configure processes to the minimum capabilities and resources required for their operation.  Have unique user and group own service components/applications that need to be isolated.  Users have permissions to access the required device files only.  Shared files are access controlled using group permissions. Default permissions for newly created files include read/write/exec permissions for the owner only.  Always use setresuid() and setresgid() functions to change the current user and group. Always confirm the change with getresuid() and getresgid() function.  Users and groups must have unique ID’s
198 o       In progress, containerization via LXC is being implemented for subset of RDK processes.  OEM may choose to use a technology other than LXC to sandbox their processes.
199 8.      Vet all open source 
200 o       Currently being done using Whitesource tool
201 9.      Disable kernel module load 
202 o       Making modules statically linked to the kernel would be a significant effort.
203 o       Disable module load after boot using /proc/sys/kernel/module_disabled 
204 10.     Disable kernel module unload 
205 o       Set CONFIG_MODULE_UNLOAD
206 11.     Kernel module parameters must be R/O or trusted 
207 o       Audit boot scripts to ensure loadable kernel module parameters are hard coded and don’t rely on data from persistent storage or other writable source
208 12.     Remove kernel debugging and profiling options 
209 o       CONFIG_DEBUG_KERNEL CONFIG_MARKERS CONFIG_DEBUG_MEMLEAK CONFIG_KPROBES
210 o       CONFIG_SLUB_DEBUG CONFIG_PROFILING CONFIG_DEBUG_FS CONFIG_KPTRACE
211 o       CONFIG_KALLSYMS CONFIG_LTT CONFIG_UNUSED_SYMBOLS CONFIG_TRACE_IRQFLAGS_SUPPORT
212 o       CONFIG_RELAY CONFIG_MAGIC_SYSRQ CONFIG_VM_EVENT_COUNTERS CONFIGU_UNWIND_INFO
213 o       CONFIG_BPA2_ALLOC_TRACE CONFIG_PRINTK
214 o       CONFIG_CRASH_DUMP CONFIG_BUG CONFIG_SCSI_LOGGING CONFIG_ELF_CORE CONFIG_FULL_PANIC
215 o       CONFIG_TASKSTATUS CONFIG_AUDIT CONFIG_BSD_PROCESS_ACCT CONFIG_KEXEC
216 o       CONFIG_EARLY_PRINTK CONFIG_IKCONFIG CONFIG_NETFILTER_DEBUG
217 o       CONFIG_MTD_UBI_DEBUG CONFIG_B43_DEBUG CONFIG_SSB_DEBUG CONFIG_FB_INTEL_DEBUG
218 o       CONFIG_TRACING CONFIG_PERF_EVENTS 
219 13.     Disable unused file system and block device support
220 14.     Enable heap protection and pointer obfuscation features. 
221 o       Enabled by default in glibc.  Protects heap from buffer overflows.  Available in glibc 2.3.4 or above, Enabled using environment variable malloc_check_
222 15.     Restrict /dev/mem to minimal regions of memory required
223 16.     Remove support for /dev/kmem
224 17.     Remove support for /dev/kcore 
225 o       Kernel core dumping should be disabled in production
226 18.     Enable format, buffer, and object size checks
227 19.     Restrict /proc to process owners (except for IDS)
228 20.     Disable kernel configfs 
229 o       Allows modification of kernel objects
230 21.     Remove ldconfig from target filesystem and [ld.so](http://ld.so/).conf and [ld.so](http://ld.so/).cache should be empty 
231 o       Removes caching of symbolic links.  Will cause a performance hit.
232 o       Impact: glibc changes. Would allow loading libraries from a non-standard library path even if we don’t use LD_LIBRARY_PATH.
233 22.     Security critical software are compiled as PIE (Position Independent Executable), if supported
234 23.     Kernel boots with “ro” in command line  
235 o       Mount filesystem as readonly. 
236 24.     Mount filesystems with minimal privileges. For example, filesystem containing no executable code shall have “noexec” option specified. 
237 25.     Mount temporary storage (/tmp) shall in dedicated filesystem (eg. tmpfs) and its contents does not survive reboots
238 26.     Flush cache after accessing sensitive data
239 27.     No overlay of writable mounts on read-only data 
240 28.     system directories such as /proc or /dev shall not be writable within a sandbox
241 29.     Applications and utilities shall not have the setgid or setuid bit set
242 30.     Configure default shell to /dev/null
243 31.     Remove all unused executables and libraries
244 32.     Disable PTRACE, General restriction on PTRACE should be applied at kernel level with Yama LSM  
245 o       http://linux-audit.com/protect-ptrace-processes-kernel-yama-ptrace_scope/ 
246 o       PTRACE is used by GDB.  Disable only for production builds.  Both compile time and runtime changes required (can restrict PTRACE to root if required)
247 33.     Don’t use LD_LIBRARY_PATH (loads libraries from default locations only)
248 34.     Full runtime path for non-standard libraries included in code image 
249 o       Use -rpath and -rpath-link
250 35.     Mount filesystems with ro option and change permission temporarily when needed
251 36.     Kernel init parameters / command line must be R/O and trusted
252 37.     Restrict kernel syslog (dmesg) to root user only
253 38.     Disable kernel debugfs 
254 o       Part of sysfs used to enable kernel debug messaging.  If printk is disabled this becomes irrelevant
255 39.     Use ELF format only 
256 o       May break scripts like Python
257 40.     Dynamic linker configuration changes 
258 o       Remove LD_DEBUG support from dynamic linker 
259 o       Remove LD_PRELOAD support from dynamic linker 
260 o       Remove LD_PROFILE support from the dynamic linker 
261 o       Remove LD_AUDIT support from the dynamic linker 
262 o       Remove LD_SHOW_AUXV support from the dynamic linker
263 o       Remove LD_TRACE_LOADED_OBJECTS support from the dynamic linker 
264 o       Link dynamic programs with -z now and -z relro options 
265 41.     Hide restricted kernel pointers 
266 o       Restricted pointers replaced with 0’s.
267 o       Relates to printk handling of printing pointer values.  This is a runtime setting, enable/disable via /proc/sys/kernel/kptr_restrict
268 42.     Review use of SYSFS, disable it if possible
269 43.     Mark unchanging files in writable partition with “immutable”
270 44.     Use all compiler security features 
271 o       Compile -wall, -Werror and fail on warnings (and possibly -Wextra)
272 45.     Replace strcpy with strncpy 
273 o       All code should use safer, bounds checking versions of string library functions (such as strncpy instead of strcpy) to avoid potential buffer overruns.
274 46.     Prevent file races, open temp files with O_CREAT | O_EXCL 
275 o       Makes check for file existence and creation atomic.  Prevents multiple threads creating same file. 
276 47.     Set sticky bit for temporary directories to prevent acc
277 idental deletion
278 o       Only owner and root can delete directory
279 48.     Restrict kernel network settings to be the most restrictive possible
280 49.     Limit temporary storage (tmpfs) memory size 
281 50.     Enable kernel ABI Version Check
282 51.     Disable kernel symbol resolution 
283 o       Disable CONFIG_KALLSYMS
284 o       Limits our ability to debug kernel crash dumps
285 52.     Disable kernel crashdump 
286 o       Disable CONFIG_CRASH_DUMP 
287 53.     Minimum MMAPable address set to 4K min. 
288 o       This prevents mapping NULL address
289
290
291 -------------------------------------------------------------------------------
292
293 # [\#83 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/83) `open`: Enhancement add kmalloc hardening
294 **Labels**: `enhancement`
295
296
297 #### <img src="https://avatars.githubusercontent.com/u/77795961?v=4" width="50">[osevan](https://github.com/osevan) opened issue at [2023-08-29 23:53](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/83):
298
299 https://www.phoronix.com/news/Linux-Randomize-Kmalloc-Cache
300
301 Thanks and
302 Best regards
303
304 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-09-03 15:45](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/83#issuecomment-1704338755):
305
306 @osevan, thanks!
307 I'll consider it during preparing the next release of the tool.
308
309
310 -------------------------------------------------------------------------------
311
312 # [\#82 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/82) `open`: Consider removing/not recommending CONFIG_ZERO_CALL_USED_REGS
313 **Labels**: `question`
314
315
316 #### <img src="https://avatars.githubusercontent.com/u/325724?u=4446b76c0f4ebcbecb2678759f8d13817a67f85d&v=4" width="50">[jvoisin](https://github.com/jvoisin) opened issue at [2023-05-08 12:38](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/82):
317
318 CONFIG_ZERO_CALL_USED_REGS is [useless at best](https://dustri.org/b/paper-notes-clean-the-scratch-registers-a-way-to-mitigate-return-oriented-programming-attacks.html), with a **significant** performance impact.
319
320 This is a security theatre knob, and the performance budget would be better spent elsewhere.
321
322 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-09-03 15:52](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/82#issuecomment-1704340181):
323
324 @jvoisin, thanks for the article!
325 It looks reasonable, we'll discuss it.
326
327
328 -------------------------------------------------------------------------------
329
330 # [\#81 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/81) `closed`: Color indicators for "check result" column
331 **Labels**: `enhancement`
332
333
334 #### <img src="https://avatars.githubusercontent.com/u/4941656?v=4" width="50">[harisphnx](https://github.com/harisphnx) opened issue at [2023-04-27 13:16](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/81):
335
336 Would the maintainers be open to adding colors to the output of the "check result" column? For example, the output would be red for FAIL, and green for OK?
337
338 #### <img src="https://avatars.githubusercontent.com/u/4941656?v=4" width="50">[harisphnx](https://github.com/harisphnx) commented at [2023-04-27 13:17](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/81#issuecomment-1525681451):
339
340 If so, I can make the change and create a PR
341
342 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-05-07 16:41](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/81#issuecomment-1537488610):
343
344 Yes, it would be nice.
345 Looking forward to your PR.
346
347 #### <img src="https://avatars.githubusercontent.com/u/5826484?u=2cc3ddef5824379423495733759ef362d0600078&v=4" width="50">[frakman1](https://github.com/frakman1) commented at [2023-09-01 17:04](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/81#issuecomment-1703069739):
348
349 Has anyone done this yet?
350 I made a hacky attempt of this last year before the `sysctl` support was added. I added different colors for the two sections too:
351
352 <img width="1282" alt="image" src="https://github.com/a13xp0p0v/kconfig-hardened-check/assets/5826484/e880006a-5f1d-4580-b3e2-dcc0b104b089">
353
354 I just tried to overlay it onto the latest code but it's too different now. My changes were in `kconfig_hardened_check/__init__.py` but everything has moved since then. Unfortunately, not an easy merge.
355
356 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-09-03 15:40](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/81#issuecomment-1704337689):
357
358 @frakman1 thanks, it looks nice.
359 Could you give a link to your commit? I'll help to rebase it.
360
361 #### <img src="https://avatars.githubusercontent.com/u/5826484?u=2cc3ddef5824379423495733759ef362d0600078&v=4" width="50">[frakman1](https://github.com/frakman1) commented at [2023-09-03 16:16](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/81#issuecomment-1704345063):
362
363 Thank you @a13xp0p0v. 
364 I just checked and my changes were based on [this](https://github.com/a13xp0p0v/kconfig-hardened-check/blob/899752c13f4d1260d1a33985672b72b3a9cb60ec/kconfig_hardened_check/__init__.py) commit:
365 ```
366 * 899752c - (Sun Oct 2 21:45:13 2022 +0300) Also check 'nospectre_v2' with 'spectre_v2' - <Alexander Popov> (HEAD -> master, origin/master, origin/HEAD)
367 ```
368 Unfortunately, I never commited it and just stashed it before doing a `git pull`
369
370 Original File (rename to .py):
371 [__init__.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/12506520/__init__.txt)
372
373
374 Colored File (rename to .py):
375 [__init__.color.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/12506521/__init__.color.txt)
376
377 I created a patch file using:
378 ```
379 git diff --no-index --patch --output=color.diff __init__.py __init__.color.py
380 ```
381
382 patch file (optionally rename to .diff):
383 [color.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/12506530/color.txt)
384
385 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-09-03 19:51](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/81#issuecomment-1704387355):
386
387 Thanks, I see the approach.
388
389 Let's print OK results in green and FAIL results in red.
390
391 We need to modify the `table_print()` method of classes in [engine.py](https://github.com/a13xp0p0v/kconfig-hardened-check/blob/master/kconfig_hardened_check/engine.py).
392
393 I would recommend something like that:
394
395 1) defining ANSI escape sequences at the beginning of the file:
396 ```
397 GREEN_COLOR = '\x1b[32m'
398 RED_COLOR = '\x1b[31m'
399 COLOR_END = '\x1b[0m'
400 ```
401
402 2) modify printing methods this way:
403 ```
404 if with_results:
405     if self.result.startswith('OK'):
406         color = GREEN_COLOR
407     elif self.result.startswith('FAIL:'):
408         color = RED_COLOR
409     else:
410         assert(False), f'unexpected result "{self.result}"'
411     colored_result = f'{color}{self.result}{COLOR_END}'
412     print(f'| {colored_result}', end='')
413 ```
414
415 What do you think?
416 Would you like to prepare a pull request?
417
418 Thanks!
419
420 #### <img src="https://avatars.githubusercontent.com/u/141440559?u=a2256f43745996b332a33cc986eb796c084caed2&v=4" width="50">[trclst](https://github.com/trclst) commented at [2023-09-03 23:34](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/81#issuecomment-1704435599):
421
422 I would only going to color `OK `and `FAIL` not full line.
423 Besides, I don't know if there aren't more important things a `| grep FAIL` can do.
424 Maybe it is better to keep the code small, the information is still there whether in color or not.
425 Anyway hope it looks fancy.
426
427 #### <img src="https://avatars.githubusercontent.com/u/5826484?u=2cc3ddef5824379423495733759ef362d0600078&v=4" width="50">[frakman1](https://github.com/frakman1) commented at [2023-09-04 05:16](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/81#issuecomment-1704624719):
428
429 If you only want to see the failures, you can use the `-m show_fail` option
430
431 #### <img src="https://avatars.githubusercontent.com/u/5826484?u=2cc3ddef5824379423495733759ef362d0600078&v=4" width="50">[frakman1](https://github.com/frakman1) commented at [2023-09-04 18:33](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/81#issuecomment-1705607069):
432
433 > What do you think? Would you like to prepare a pull request?
434
435 I like it. Thank you for the guidance. I just attempted it and it seems I have to repeat that logic in three places before I could get all the prints.
436
437 sample output:
438
439 <img width="1047" alt="image" src="https://github.com/a13xp0p0v/kconfig-hardened-check/assets/5826484/d098d14f-2e1a-4569-af22-54ef2bc0eecb">
440
441 Diffs located in my fork ~~[here](https://github.com/frakman1/kconfig-hardened-check/compare/108eb7374967b0f66e70b68cca60a0548f12844c...71c8e35842b805e8e6b819bf599b07fdd0d48479)~~
442
443 @a13xp0p0v Let me know if that looks good. If so, I will issue a pull request.
444
445 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-09-09 16:56](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/81#issuecomment-1712554168):
446
447 Thanks @frakman1 !
448
449 I would propose creating a function `colorize_result()` and call several times to avoid copying the code.
450
451 #### <img src="https://avatars.githubusercontent.com/u/5826484?u=2cc3ddef5824379423495733759ef362d0600078&v=4" width="50">[frakman1](https://github.com/frakman1) commented at [2023-09-09 18:20](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/81#issuecomment-1712570988):
452
453 I've updated the code with your recommendations. See changes [here](https://github.com/frakman1/kconfig-hardened-check/commit/fb9aeb5392762c6ea3aa67096a18e163e63ec6ea)
454
455 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-09-09 19:17](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/81#issuecomment-1712582213):
456
457 I've left some comments. The main point: it's better to leave printing inside of the `table_print()` method. The `colorize_result()` function should only return the colored string.
458
459 #### <img src="https://avatars.githubusercontent.com/u/5826484?u=2cc3ddef5824379423495733759ef362d0600078&v=4" width="50">[frakman1](https://github.com/frakman1) commented at [2023-09-09 21:12](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/81#issuecomment-1712623127):
460
461 Changes applied [here](https://github.com/frakman1/kconfig-hardened-check/compare/108eb7374967b0f66e70b68cca60a0548f12844c..b317b9f)
462
463 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-09-10 11:04](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/81#issuecomment-1712783879):
464
465 Good!
466
467 Please remove the unneeded whitespaces and send the pull request.
468
469 Looking forward to it.
470
471 #### <img src="https://avatars.githubusercontent.com/u/5826484?u=2cc3ddef5824379423495733759ef362d0600078&v=4" width="50">[frakman1](https://github.com/frakman1) commented at [2023-09-10 17:49](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/81#issuecomment-1712896232):
472
473 Done.
474 https://github.com/a13xp0p0v/kconfig-hardened-check/pull/86
475
476
477 -------------------------------------------------------------------------------
478
479 # [\#80 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/80) `merged`: Added support for gzipped config (eg. /proc/config.gz)
480
481 #### <img src="https://avatars.githubusercontent.com/u/3389586?u=71aa9a963297407bb515b073245e398e8049d582&v=4" width="50">[nE0sIghT](https://github.com/nE0sIghT) opened issue at [2023-03-25 09:41](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/80):
482
483
484
485 #### <img src="https://avatars.githubusercontent.com/u/65553080?u=1e9e0de760ac0083c86dab588f627a0468cd714e&v=4" width="50">[codecov-commenter](https://github.com/codecov-commenter) commented at [2023-03-26 15:02](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/80#issuecomment-1484123415):
486
487 ## [Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/80?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) Report
488 > Merging [#80](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/80?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (8def541) into [master](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/commit/b65af76d6e84b4cd80f4fb4c72799bdd49237024?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (b65af76) will **decrease** coverage by `0.24%`.
489 > The diff coverage is `80.00%`.
490
491 :mega: This organization is not using Codecov’s [GitHub App Integration](https://github.com/apps/codecov). We recommend you install it so Codecov can continue to function properly for your repositories. [Learn more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)
492
493 ```diff
494 @@            Coverage Diff             @@
495 ##           master      #80      +/-   ##
496 ==========================================
497 - Coverage   98.39%   98.16%   -0.24%     
498 ==========================================
499   Files           6        6              
500   Lines         812      818       +6     
501   Branches      160      161       +1     
502 ==========================================
503 + Hits          799      803       +4     
504 - Misses          7        8       +1     
505 - Partials        6        7       +1     
506 ```
507
508 | Flag | Coverage Δ | |
509 |---|---|---|
510 | engine_unit-test | `76.80% <ø> (ø)` | |
511 | functional_test | `97.97% <80.00%> (-0.26%)` | :arrow_down: |
512
513 Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#carryforward-flags-in-the-pull-request-comment) to find out more.
514
515 | [Impacted Files](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/80?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) | Coverage Δ | |
516 |---|---|---|
517 | [kconfig\_hardened\_check/\_\_init\_\_.py](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/80?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#diff-a2NvbmZpZ19oYXJkZW5lZF9jaGVjay9fX2luaXRfXy5weQ==) | `99.10% <80.00%> (-0.90%)` | :arrow_down: |
518
519 :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)
520
521 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-03-26 16:01](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/80#issuecomment-1484141857):
522
523 Hello @nE0sIghT,
524
525 I've merged your pull request and added:
526  - informing about supporting *.gz kconfig files,
527  - functional testing of this feature.
528
529 Thanks!
530 Alexander
531
532
533 -------------------------------------------------------------------------------
534
535 # [\#79 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/79) `closed`: Create unit-tests for the engine checking the correctness
536 **Labels**: `enhancement`
537
538
539 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) opened issue at [2023-03-06 08:03](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/79):
540
541 That would prevent the bug in cb779a71bf57d95b. See the fix d006bfa48e87.
542
543 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-04-02 12:51](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/79#issuecomment-1493323795):
544
545 Good. This task is completed.
546
547 Unit-tests for the `kconfig-hardened-check` engine are created:
548 [kconfig_hardened_check/test_engine.py](https://github.com/a13xp0p0v/kconfig-hardened-check/blob/master/kconfig_hardened_check/test_engine.py)
549
550 CI performs unit-testing on each repository push:
551 https://github.com/a13xp0p0v/kconfig-hardened-check/actions/workflows/engine_unit-test.yml
552
553 These unit-tests check the correctness of the engine results and cover 100% of the engine code.
554
555 Reverting the aforementioned fix https://github.com/a13xp0p0v/kconfig-hardened-check/commit/d006bfa48e87600e70aae1a696ede3182f6c1cbd is detected by these unit-tests:
556 ```
557 ======================================================================
558 FAIL: test_simple_kconfig (kconfig_hardened_check.test_engine.TestEngine)
559 ----------------------------------------------------------------------
560 Traceback (most recent call last):
561   File "/home/a13x/land/Develop/Linux_Kernel/kconfig-hardened-check/kconfig_hardened_check/test_engine.py", line 130, in test_simple_kconfig
562     self.assertEqual(
563 AssertionError: Lists differ: [['CO[701 chars]8', 'OK: is not off, "off"'], ['CONFIG_NAME_9'[169 chars]nd']] != [['CO[701 chars]8', 'FAIL: is off'], ['CONFIG_NAME_9', 'kconfi[160 chars]nd']]
564
565 First differing element 7:
566 ['CON[25 chars]is not off', 'decision_8', 'reason_8', 'OK: is not off, "off"']
567 ['CON[25 chars]is not off', 'decision_8', 'reason_8', 'FAIL: is off']
568 ```
569
570
571 -------------------------------------------------------------------------------
572
573 # [\#78 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/78) `closed`: Fix nixos integration
574
575 #### <img src="https://avatars.githubusercontent.com/u/96200?u=9ed15c85825694d00e996d605d728179b830c4fa&v=4" width="50">[Mic92](https://github.com/Mic92) opened issue at [2022-12-29 10:00](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/78):
576
577
578
579 #### <img src="https://avatars.githubusercontent.com/u/65553080?u=1e9e0de760ac0083c86dab588f627a0468cd714e&v=4" width="50">[codecov-commenter](https://github.com/codecov-commenter) commented at [2022-12-29 10:02](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/78#issuecomment-1367203889):
580
581 # [Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/78?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) Report
582 > Merging [#78](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/78?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (6fde9d6) into [master](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/commit/6211b6852b6b35f6f5d18ec2f0e713d2afea5a87?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (6211b68) will **increase** coverage by `0.40%`.
583 > The diff coverage is `n/a`.
584
585 ```diff
586 @@            Coverage Diff             @@
587 ##           master      #78      +/-   ##
588 ==========================================
589 + Coverage   92.79%   93.20%   +0.40%     
590 ==========================================
591   Files           3        3              
592   Lines         736      736              
593   Branches      171      171              
594 ==========================================
595 + Hits          683      686       +3     
596 + Misses         26       24       -2     
597 + Partials       27       26       -1     
598 ```
599
600 | Flag | Coverage Δ | |
601 |---|---|---|
602 | functional_test | `93.20% <ø> (+0.40%)` | :arrow_up: |
603
604 Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#carryforward-flags-in-the-pull-request-comment) to find out more.
605
606 | [Impacted Files](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/78?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) | Coverage Δ | |
607 |---|---|---|
608 | [kconfig\_hardened\_check/\_\_init\_\_.py](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/78/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#diff-a2NvbmZpZ19oYXJkZW5lZF9jaGVjay9fX2luaXRfXy5weQ==) | `93.25% <0.00%> (+0.41%)` | :arrow_up: |
609
610 :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)
611
612 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-01-19 19:58](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/78#issuecomment-1397525515):
613
614 Hello @Mic92,
615
616 Closing, this issue has been fixed in https://github.com/a13xp0p0v/kconfig-hardened-check/pull/77.
617
618 Thanks!
619
620
621 -------------------------------------------------------------------------------
622
623 # [\#77 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/77) `merged`: add get-nixos-kconfig nix script
624
625 #### <img src="https://avatars.githubusercontent.com/u/106462796?v=4" width="50">[o8opi](https://github.com/o8opi) opened issue at [2022-12-29 09:15](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/77):
626
627 Hello,
628
629 This nix script, when run with `nix-build get-nixos-kconfig.nix` will output 3 kernel configuration files (linux_latest, linux_hardened, and the linux_lts)  for NixOS
630
631 Has been tested on Ubuntu 20.04
632
633 #63  relevant
634
635 #### <img src="https://avatars.githubusercontent.com/u/65553080?u=1e9e0de760ac0083c86dab588f627a0468cd714e&v=4" width="50">[codecov-commenter](https://github.com/codecov-commenter) commented at [2023-01-19 15:00](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/77#issuecomment-1397110519):
636
637 # [Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/77?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) Report
638 > Merging [#77](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/77?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (6149a3e) into [master](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/commit/6211b6852b6b35f6f5d18ec2f0e713d2afea5a87?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (6211b68) will **not change** coverage.
639 > The diff coverage is `n/a`.
640
641 ```diff
642 @@           Coverage Diff           @@
643 ##           master      #77   +/-   ##
644 =======================================
645   Coverage   92.79%   92.79%           
646 =======================================
647   Files           3        3           
648   Lines         736      736           
649   Branches      171      171           
650 =======================================
651   Hits          683      683           
652   Misses         26       26           
653   Partials       27       27           
654 ```
655
656 | Flag | Coverage Δ | |
657 |---|---|---|
658 | functional_test | `92.79% <ø> (ø)` | |
659
660 Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#carryforward-flags-in-the-pull-request-comment) to find out more.
661
662
663 :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)
664
665 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-01-19 16:06](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/77#issuecomment-1397219216):
666
667 Thanks a lot, @o8opi!
668
669 It's merged.
670
671 I also generated the NixOS kernel configs using `nix-build get-nixos-kconfig.nix`: https://github.com/a13xp0p0v/kconfig-hardened-check/commit/0267c39d10364e2afb0779f2ce271539eff6f4e1
672
673
674 -------------------------------------------------------------------------------
675
676 # [\#76 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/76) `closed`: iommu=force
677
678 #### <img src="https://avatars.githubusercontent.com/u/74207682?u=fc82f6c725c4a6a1e0e8786b3ecee80b18118c92&v=4" width="50">[d4rklynk](https://github.com/d4rklynk) opened issue at [2022-12-13 17:58](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/76):
679
680 It seems it helps indirectly from DMA attacks (from what I understand). It is recommended by ANSSI.
681
682 From this [PDF](https://www.ssi.gouv.fr/uploads/2019/02/fr_np_linux_configuration-v2.0.pdf) (in french) at the chapter "**5.2.1 Configuration de la mémoire**"
683
684 Or from this [older version](https://www.ssi.gouv.fr/uploads/2019/03/linux_configuration-en-v1.2.pdf) of the same PDF but in english : chapter "**4.3 IOMMU Service (input/output virtualization)**"
685
686 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-01-21 22:03](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/76#issuecomment-1399341218):
687
688 Added this check in https://github.com/a13xp0p0v/kconfig-hardened-check/commit/4e0065c8baf8d40c733f7f4c5c920c07b93c55b6
689
690 Thanks, @d4rklynk!
691
692
693 -------------------------------------------------------------------------------
694
695 # [\#75 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/75) `closed`: Integrity Measurement Architecture 
696 **Labels**: `question`
697
698
699 #### <img src="https://avatars.githubusercontent.com/u/97197406?u=3fc2e7c1b9d9f1b9b1c8e7268aaa11204944694e&v=4" width="50">[JohnVengert](https://github.com/JohnVengert) opened issue at [2022-11-14 04:40](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/75):
700
701 The Integrity Measurement Architecture is a subsystem that is responsible
702  for calculating file hashes. this allows greater security . This option would be ideal
703  to be integrated, 
704
705 Kernel Config -
706
707 ```
708 CONFIG_IMA=y
709 CONFIG_IMA_MEASURE_PCR_IDX=10
710 CONFIG_IMA_LSM_RULES=y
711 CONFIG_IMA_NG_TEMPLATE=y
712 # CONFIG_IMA_SIG_TEMPLATE is not set
713 CONFIG_IMA_DEFAULT_TEMPLATE="ima-ng"
714 # CONFIG_IMA_DEFAULT_HASH_SHA1 is not set
715 # CONFIG_IMA_DEFAULT_HASH_SHA256 is not set
716 CONFIG_IMA_DEFAULT_HASH_SHA512=y
717 CONFIG_IMA_DEFAULT_HASH="sha512"
718 CONFIG_IMA_WRITE_POLICY=y
719 CONFIG_IMA_READ_POLICY=y
720 CONFIG_IMA_APPRAISE=y
721 CONFIG_IMA_ARCH_POLICY=y
722 CONFIG_IMA_APPRAISE_BUILD_POLICY=y
723 CONFIG_IMA_APPRAISE_REQUIRE_FIRMWARE_SIGS=y
724 CONFIG_IMA_APPRAISE_REQUIRE_KEXEC_SIGS=y
725 CONFIG_IMA_APPRAISE_REQUIRE_MODULE_SIGS=y
726 CONFIG_IMA_APPRAISE_REQUIRE_POLICY_SIGS=y
727 CONFIG_IMA_APPRAISE_BOOTPARAM=y
728 CONFIG_IMA_APPRAISE_MODSIG=y
729 CONFIG_IMA_TRUSTED_KEYRING=y
730 CONFIG_IMA_KEYRINGS_PERMIT_SIGNED_BY_BUILTIN_OR_SECONDARY=y
731 CONFIG_IMA_BLACKLIST_KEYRING=y
732 CONFIG_IMA_LOAD_X509=y
733 CONFIG_IMA_X509_PATH="/etc/keys/x509_ima.der"
734 CONFIG_IMA_APPRAISE_SIGNED_INIT is not set (This option breaks memory, do not select)
735 CONFIG_IMA_MEASURE_ASYMMETRIC_KEYS=y
736 CONFIG_IMA_QUEUE_EARLY_BOOT_KEYS=y
737 CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT=y
738 CONFIG_IMA_DISABLE_HTABLE=y
739 CONFIG_EVM=y
740 CONFIG_EVM_ATTR_FSUUID=y
741 CONFIG_EVM_EXTRA_SMACK_XATTRS=y
742 CONFIG_EVM_ADD_XATTRS=y
743 CONFIG_EVM_LOAD_X509=y
744 CONFIG_EVM_X509_PATH="/etc/keys/x509_evm.der"
745
746 ```
747 My system integrates this security 
748 https://sourceforge.net/projects/anti-ransomware/
749
750 Thank you very much
751
752
753
754 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-12-08 13:29](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/75#issuecomment-1342739444):
755
756 Hello @JohnVengert,
757
758 1. As I understand, IMA doesn't have direct influence on Linux **kernel** security.
759 It's important for the userspace security, isn't it?
760
761 2. Does this functionality require any userspace support or actions to work?
762
763 3. You've provided a large list of options. Could you create a shortlist with the most important of them?
764
765 Thanks!
766
767
768 -------------------------------------------------------------------------------
769
770 # [\#74 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/74) `closed`: Add disabling compatibility mode.
771
772 #### <img src="https://avatars.githubusercontent.com/u/7232674?u=dba600128b18073a4e3c33b76f5c601591d8f613&v=4" width="50">[Manouchehri](https://github.com/Manouchehri) opened issue at [2022-10-20 22:00](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/74):
773
774 I'm not a kernel maintainer, so I added myself a new category. I don't think I'm wrong about this one though, here's a few public examples I found within a minute of searching:
775
776 https://google.github.io/security-research/pocs/linux/cve-2021-22555/writeup.html
777 https://bugs.chromium.org/p/project-zero/issues/detail?id=1574
778 https://outflux.net/blog/archives/2010/10/19/cve-2010-2963-v4l-compat-exploit/
779 http://inertiawar.com/compat1/
780 http://inertiawar.com/compat2/
781
782 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-10-22 18:57](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/74#issuecomment-1287883856):
783
784 Hello @Manouchehri,
785
786 Thanks for your pull request and the idea.
787
788 I looked up. That's how `CONFIG_COMPAT` is currently implemented:
789 ```
790 config COMPAT
791         def_bool y
792         depends on IA32_EMULATION || X86_X32_ABI
793 ```
794 So we can't enable/disable it in the menuconfig directly.
795
796 The KSPP project already recommends disabling `IA32_EMULATION` and `X86_X32`:
797 ```
798 CONFIG_IA32_EMULATION    |kconfig| is not set |   kspp   |cut_attack_surface
799 CONFIG_X86_X32           |kconfig| is not set |   kspp   |cut_attack_surface
800 ```
801
802 So maybe adding a separate check for `COMPAT` is not needed.
803
804 But wait, `COMPAT` depends on `X86_X32_ABI` and not `X86_X32`.
805
806 There is a Linux kernel commit `83a44a4f47ad20997aebb311fc678a13cde391d7` (Mar 14 2022)
807 that renamed this config option. I will ask to update it at the KSPP wiki.
808 Then I will add a new check for `X86_X32_ABI`.
809
810 Thank you very much!
811
812 This case shows that from time to time we need to look up all config options that should be disabled.
813 Maybe some of them have been renamed in the Linux kernel.
814
815 #### <img src="https://avatars.githubusercontent.com/u/7232674?u=dba600128b18073a4e3c33b76f5c601591d8f613&v=4" width="50">[Manouchehri](https://github.com/Manouchehri) commented at [2022-10-22 19:02](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/74#issuecomment-1287884800):
816
817 CONFIG_COMPAT depends on the arch too. For example, neither `X86_X32_ABI` or `X86_X32` will cover arm64 systems.
818
819 ```
820 menuconfig COMPAT
821         bool "Kernel support for 32-bit EL0"
822         depends on ARM64_4K_PAGES || EXPERT
823 ```
824
825 https://github.com/torvalds/linux/blob/master/arch/arm64/Kconfig#L1526-L1542
826
827 I don't see the harm in a separate check for `COMPAT`. That flag has been around for years and not changed across architectures IIRC.
828
829 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-10-22 19:06](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/74#issuecomment-1287885578):
830
831 That's a good point!
832 I'll return with the results.
833
834 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-01-14 18:01](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/74#issuecomment-1382873066):
835
836 Hello @Manouchehri,
837
838 I contacted KSPP. Now their recommendations [contain](https://kernsec.org/wiki/index.php?title=Kernel_Self_Protection_Project%2FRecommended_Settings&action=historysubmit&type=revision&diff=4064&oldid=4060) disabling `CONFIG_COMPAT` and `CONFIG_X86_X32_ABI`.
839
840 Please see the commit https://github.com/a13xp0p0v/kconfig-hardened-check/commit/f3ba594b3acbc154eeade43d87a76b90352ab1d1, where I added these KSPP recommendations.
841
842 Thank you for the idea!
843 Closing the PR.
844
845
846 -------------------------------------------------------------------------------
847
848 # [\#73 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/73) `closed`: ERORR?
849
850 #### <img src="https://avatars.githubusercontent.com/u/77776927?v=4" width="50">[alpahca](https://github.com/alpahca) opened issue at [2022-09-24 15:03](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/73):
851
852 i was try to some book(Billimoria, Kaiwan N. Linux Kernel Debugging: Leverage proven tools and advanced techniques to effectively debug Linux kernels and kernel modules (p. 61). Packt Publishing. Kindle Edition. ).
853
854 but.
855
856 $ bin/kconfig-hardened-check -p X86_64 -c ~/lkd_kernels/kconfig.prod01/.config
857 [!] ERROR: --config and --print can't be used together
858
859 what should i do?
860
861 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-09-24 21:18](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/73#issuecomment-1257066908):
862
863 Hi @alpahca,
864
865 Quoting `kconfig-hardened-check --help`:
866 ```
867   -p {X86_64,X86_32,ARM64,ARM}, --print {X86_64,X86_32,ARM64,ARM}
868                         print security hardening preferences for the selected architecture
869   -c CONFIG, --config CONFIG
870                         check the kernel kconfig file against these preferences
871 ```
872
873 So for checking your kernel config simply do this:
874 ```
875 $ bin/kconfig-hardened-check -c ~/lkd_kernels/kconfig.prod01/.config
876 ```
877
878 #### <img src="https://avatars.githubusercontent.com/u/77776927?v=4" width="50">[alpahca](https://github.com/alpahca) commented at [2022-10-11 07:42](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/73#issuecomment-1274233073):
879
880 Oh thx.
881 But... 
882 VirtualBox:~/lkd_kernels/kconfig_prod01$ '/home/ked/kconfig-hardened-check/bin/kconfig-hardened-check' -c '/home/ked/lkd_kernels/kconfig_prod01'
883 [+] Kconfig file to check: /home/ked/lkd_kernels/kconfig_prod01
884 Traceback (most recent call last):
885 File "/home/ked/kconfig-hardened-check/bin/kconfig-hardened-check", line 16, in
886 kconfig_hardened_check.main()
887 File "/home/ked/kconfig-hardened-check/kconfig_hardened_check/init.py", line 976, in main
888 arch, msg = detect_arch(args.config, supported_archs)
889 File "/home/ked/kconfig-hardened-check/kconfig_hardened_check/init.py", line 275, in detect_arch
890 with open(fname, 'r') as f:
891 IsADirectoryError: [Errno 21] Is a directory: '/home/ked/lkd_kernels/kconfig_prod01'
892
893 Uhm... that should be my problem?
894
895 -----Original Message-----
896 From: "Alexander ***@***.***>
897 To: ***@***.***>;
898 Cc: ***@***.***>; ***@***.***>;
899 Sent: 2022-09-25 (일) 06:18:44 (GMT+09:00)
900 Subject: Re: [a13xp0p0v/kconfig-hardened-check] ERORR? (Issue #73)
901
902 Hi @alpahca,
903 Quoting kconfig-hardened-check --help:
904 -p {X86_64,X86_32,ARM64,ARM}, --print {X86_64,X86_32,ARM64,ARM} print security hardening preferences for the selected architecture -c CONFIG, --config CONFIG check the kernel kconfig file against these preferences
905 So for checking your kernel config simply do this:
906 $ bin/kconfig-hardened-check -c ~/lkd_kernels/kconfig.prod01/.config
907
908 Reply to this email directly, view it on GitHub, or unsubscribe.
909 You are receiving this because you were mentioned.Message ID: ***@***.***>
910
911
912 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-10-22 19:27](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/73#issuecomment-1287890539):
913
914 Hi @alpahca,
915
916 Please try to use `-c` with the path to the kconfig file, not a directory.
917
918 Best regards,
919 Alexander
920
921
922 -------------------------------------------------------------------------------
923
924 # [\#71 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/71) `closed`: Config change in 5.19.X
925
926 #### <img src="https://avatars.githubusercontent.com/u/11868071?u=d7a5841263276e1f323827fc21b04345df594a60&v=4" width="50">[Churam](https://github.com/Churam) opened issue at [2022-08-31 08:18](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/71):
927
928 Hello,
929
930 The X86_SMAP option is no longer present in 5.19.X kernels. It is now enforced.
931 ( [commit](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.19.5&id=c5a3d3c01e90e74166f95eec9db6fcc3ba72a9d6) )
932
933 Since it has been removed, the script mark the entry as failed.
934 ```
935 [+] Special report mode: show_fail
936 [+] Kconfig file to check: /opt/KERNEL/linux-5.19.5/.config
937 [+] Detected architecture: X86_64
938 [+] Detected kernel version: 5.19
939 =========================================================================================================================
940               option name               | type  |desired val | decision |      reason      | check result
941 =========================================================================================================================
942 CONFIG_X86_SMAP                         |kconfig|     y      |defconfig | self_protection  | FAIL: not found
943 ```
944
945
946
947 The GCC_PLUGIN_RANDSTRUCT and GCC_PLUGIN_RANDSTRUCT_PERFORMANCE have changed now that CLANG has the feature. ( [commit](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.19.y&id=595b893e2087de306d0781795fb8ec47873596a6) ). They are now nammed RANDSTRUCT_FULL and RANDSTRUCT_PERFORMANCE respectively. 
948
949 At the moment they don't fail but the new entries should be added in the script I think. 
950 ```
951  grep RANDSTRUCT ./.config
952 # CONFIG_RANDSTRUCT_NONE is not set
953 CONFIG_RANDSTRUCT_FULL=y
954 # CONFIG_RANDSTRUCT_PERFORMANCE is not set
955 CONFIG_RANDSTRUCT=y
956 CONFIG_GCC_PLUGIN_RANDSTRUCT=y
957 ```
958
959
960
961 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-09-02 11:42](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/71#issuecomment-1235396338):
962
963 Hi @Churam,
964
965 Thanks for your report!
966
967 I've improved the checks, please have a look.
968
969 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2022-09-06 19:29](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/71#issuecomment-1238566204):
970
971 maybe it would make sense to tag a new release after :cat:
972
973 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-09-09 08:23](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/71#issuecomment-1241663085):
974
975 Hi @anthraxx,
976
977 I have a complex and time-consuming procedure for preparing the kconfig-hardened-check releases.
978
979 I’m planning to do this work for the next Linux kernel release.
980
981
982 -------------------------------------------------------------------------------
983
984 # [\#70 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/70) `closed`: COPR repo with built kernel with suggested recommendations
985
986 #### <img src="https://avatars.githubusercontent.com/u/75043245?u=6d29ec5975073ebb1af663a8bf866715b525d50e&v=4" width="50">[krishjainx](https://github.com/krishjainx) opened issue at [2022-07-21 15:19](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/70):
987
988 Hi. This repository has been incredibly useful to me as of late. I’m trying to do the following: create a COPR repository for example such that it takes the kernel configuration from Fedora’s latest kernel build for say 36 and then applies the recommended options here, handles setting everything on/off etc for everything that depends on that option and everything setting that option depends on while blacklisting certain recommendations such that it doesn’t break certain apps etc. Post doing this it would grab the source code for that kernel versions and build it with those configs and then one would just install the kernel normally.
989
990 How would one go about implementing this? Thank you!
991
992 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-07-21 19:48](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/70#issuecomment-1191870587):
993
994 Hi Krish,
995
996 This approach can be called "creating a kernel flavour". Some distros do that.
997
998 For example, see:
999  - Ubuntu kernel flavours: https://wiki.ubuntu.com/Kernel/Dev/Flavours
1000  - Suse kernel flavours: https://www.suse.com/support/kb/doc/?id=000017133
1001  - The discussion about NixOS hardened kernel: https://github.com/NixOS/nixpkgs/issues/76850
1002
1003 #### <img src="https://avatars.githubusercontent.com/u/75043245?u=6d29ec5975073ebb1af663a8bf866715b525d50e&v=4" width="50">[krishjainx](https://github.com/krishjainx) commented at [2022-07-21 22:18](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/70#issuecomment-1191988714):
1004
1005 Yes, thank you I understand that but how would I have your script/tool change the .config to be more hardened and then have that grab new kernel sources and automatically build like if I was to hold a COPR?
1006
1007 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-07-22 21:00](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/70#issuecomment-1192931275):
1008
1009 Thanks Krish, now I see what you mean.
1010
1011 There is an enhancement #67. Maybe it would help to solve your task.
1012 ```
1013 Create a tool that changes kconfig options according the recommendations
1014 ```
1015 It should use the JSON output of `kconfig-hardened-check` and work with kconfig with [kconfiglib](https://pypi.org/project/kconfiglib/).
1016
1017 What do you think?
1018
1019 #### <img src="https://avatars.githubusercontent.com/u/75043245?u=6d29ec5975073ebb1af663a8bf866715b525d50e&v=4" width="50">[krishjainx](https://github.com/krishjainx) commented at [2022-07-23 03:10](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/70#issuecomment-1193047106):
1020
1021 For sure, this project is perhaps one of the best and most usable for kernel hardening and I would definitely be able to help if you can get started or others with implementing this. Thank you!
1022
1023 #### <img src="https://avatars.githubusercontent.com/u/75043245?u=6d29ec5975073ebb1af663a8bf866715b525d50e&v=4" width="50">[krishjainx](https://github.com/krishjainx) commented at [2022-07-23 03:12](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/70#issuecomment-1193047378):
1024
1025 It would be incredibly useful to instead of being developing sideways independent projects like linux-hardened or grsecurity to be working more close with upstream like you are - getting all the performance improvements, bug fixes and applying all available "vanilla" security fixes and pushing this to distributions using that tool. Then people can work off it. Even if it's not "revolutionary" I definitely believe in the long term it would help make Linux even better!
1026
1027 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-07-24 15:44](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/70#issuecomment-1193343924):
1028
1029 I can't comment about `grsecurity`. This topic is complex... Anyway, they are pioneers in kernel security hardening.
1030
1031 The goal of `KSPP` is to develop kernel self-protection features for the mainline kernel. I hope my `kconfig-hardened-check` project also promotes these security features among Linux distros.
1032
1033
1034 -------------------------------------------------------------------------------
1035
1036 # [\#69 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/69) `open`: Create documentation describing Linux kernel security options
1037 **Labels**: `enhancement`
1038
1039
1040 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) opened issue at [2022-07-04 10:43](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/69):
1041
1042
1043
1044 #### <img src="https://avatars.githubusercontent.com/u/106462796?v=4" width="50">[o8opi](https://github.com/o8opi) commented at [2023-04-09 20:27](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/69#issuecomment-1501206810):
1045
1046 Would love to see this, even if it's just a list of links and pointers to other resources :)
1047
1048
1049 -------------------------------------------------------------------------------
1050
1051 # [\#68 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/68) `closed`: Create a tool reporting mainline kernel versions that support a recommended option
1052 **Labels**: `enhancement`
1053
1054
1055 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) opened issue at [2022-07-04 00:34](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/68):
1056
1057
1058
1059 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-07-17 15:25](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/68#issuecomment-1186547339):
1060
1061 The LKDDb project solves this task. Added info to the README.
1062
1063 Good. Closing the issue.
1064
1065
1066 -------------------------------------------------------------------------------
1067
1068 # [\#67 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/67) `closed`: Create a tool that changes kconfig options according to the recommendations
1069 **Labels**: `enhancement`
1070
1071
1072 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) opened issue at [2022-07-04 00:25](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/67):
1073
1074 It should use the JSON output of kconfig-hardened-check.
1075
1076 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-07-17 13:43](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/67#issuecomment-1186522515):
1077
1078 See https://pypi.org/project/kconfiglib/
1079
1080 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-02-17 16:06](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/67#issuecomment-1434854140):
1081
1082 That tool would also help to filter out the kconfig options that can't be enabled for the given kernel version.
1083
1084 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-06-12 15:32](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/67#issuecomment-1587577476):
1085
1086 This feature is implemented as a part of the `kconfig-hardened-check` tool.
1087
1088 With the `-g` argument, the tool generates a Kconfig fragment with the security hardening options for the selected microarchitecture.
1089
1090 This Kconfig fragment can be merged with the existing Linux kernel config:
1091
1092 ```
1093 $ ./bin/kconfig-hardened-check -g X86_64 > /tmp/fragment
1094 $ cd ~/linux-src/
1095 $ ./scripts/kconfig/merge_config.sh .config /tmp/fragment
1096 Using .config as base
1097 Merging /tmp/fragment
1098 Value of CONFIG_BUG_ON_DATA_CORRUPTION is redefined by fragment /tmp/fragment:
1099 Previous value: # CONFIG_BUG_ON_DATA_CORRUPTION is not set
1100 New value: CONFIG_BUG_ON_DATA_CORRUPTION=y
1101  ...
1102 ```
1103
1104
1105 -------------------------------------------------------------------------------
1106
1107 # [\#66 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/66) `open`: Evaluate performance penalty of the recommended kernel options
1108 **Labels**: `enhancement`
1109
1110
1111 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) opened issue at [2022-07-03 09:57](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/66):
1112
1113 As the first step, @BlackIkeEagle made some performance tests and described the results in [this article](https://blog.herecura.eu/blog/2020-05-30-kconfig-hardening-tests/).
1114
1115 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-12-08 14:46](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/66#issuecomment-1342846087):
1116
1117 Create a solution for automating this process:
1118  1. Take defconfig as a basic kernel configuration.
1119  2. Build the Linux kernel.
1120  3. Start test system with this kernel (a hardware machine may give more consistent results than a virtual machine). If the system doesn't boot, go to step 6.
1121  4. Run the chosen performance tests (hackbench, kernel compilation, network throughput evaluation, etc).
1122  5. Save the test results.
1123  6. Set another kernel option from the kconfig-hardened-check json output and go to step 2 (see #67). If all recommendations are already tested, then proceed to step 7.
1124  7. Analyze the results of the performance testing.
1125
1126 That approach would save us from plenty of boring manual routine.
1127
1128 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-12-08 18:58](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/66#issuecomment-1343190811):
1129
1130 Similar performance testing of a group of  security hardening options may give interesting results as well.
1131
1132
1133 -------------------------------------------------------------------------------
1134
1135 # [\#65 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/65) `closed`: Support checking sysctl security options
1136 **Labels**: `enhancement`
1137
1138
1139 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) opened issue at [2022-07-03 09:50](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/65):
1140
1141 The `OptCheck` class inheritance now allows to implement this feature.
1142
1143 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-08-14 12:36](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/65#issuecomment-1677237521):
1144
1145 Checking sysctl parameters is supported now:
1146 ```
1147 $ ./bin/kconfig-hardened-check 
1148 usage: kconfig-hardened-check [-h] [--version] [-m {verbose,json,show_ok,show_fail}]
1149                               [-c CONFIG] [-l CMDLINE] [-s SYSCTL]
1150                               [-p {X86_64,X86_32,ARM64,ARM}]
1151                               [-g {X86_64,X86_32,ARM64,ARM}]
1152
1153 A tool for checking the security hardening options of the Linux kernel
1154
1155 options:
1156   -h, --help            show this help message and exit
1157   --version             show program's version number and exit
1158   -m {verbose,json,show_ok,show_fail}, --mode {verbose,json,show_ok,show_fail}
1159                         choose the report mode
1160   -c CONFIG, --config CONFIG
1161                         check the security hardening options in the kernel Kconfig file
1162                         (also supports *.gz files)
1163   -l CMDLINE, --cmdline CMDLINE
1164                         check the security hardening options in the kernel cmdline file
1165                         (contents of /proc/cmdline)
1166   -s SYSCTL, --sysctl SYSCTL
1167                         check the security hardening options in the sysctl output file
1168                         (`sudo sysctl -a > file`)
1169   -p {X86_64,X86_32,ARM64,ARM}, --print {X86_64,X86_32,ARM64,ARM}
1170                         print the security hardening recommendations for the selected
1171                         microarchitecture
1172   -g {X86_64,X86_32,ARM64,ARM}, --generate {X86_64,X86_32,ARM64,ARM}
1173                         generate a Kconfig fragment with the security hardening options
1174                         for the selected microarchitecture
1175 ```
1176
1177
1178 -------------------------------------------------------------------------------
1179
1180 # [\#64 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/64) `closed`: script fetch configs from different kernel images for current architecture
1181
1182 #### <img src="https://avatars.githubusercontent.com/u/106462796?v=4" width="50">[o8opi](https://github.com/o8opi) opened issue at [2022-06-01 06:34](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/64):
1183
1184 This script now tries to fetch and/or build the different kernel images for current architecture and derive the kernel configs from them
1185
1186 #### <img src="https://avatars.githubusercontent.com/u/106462796?v=4" width="50">[o8opi](https://github.com/o8opi) commented at [2022-06-01 06:36](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/64#issuecomment-1143174866):
1187
1188 This might resolve #63
1189
1190 #### <img src="https://avatars.githubusercontent.com/u/65553080?u=1e9e0de760ac0083c86dab588f627a0468cd714e&v=4" width="50">[codecov-commenter](https://github.com/codecov-commenter) commented at [2022-06-08 15:30](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/64#issuecomment-1150072367):
1191
1192 # [Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/64?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) Report
1193 > Merging [#64](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/64?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (86b6b08) into [master](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/commit/0d5c56f297fca50a48dfc602a5b4118b8ebdbceb?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (0d5c56f) will **not change** coverage.
1194 > The diff coverage is `n/a`.
1195
1196 ```diff
1197 @@           Coverage Diff           @@
1198 ##           master      #64   +/-   ##
1199 =======================================
1200   Coverage   98.08%   98.08%           
1201 =======================================
1202   Files           3        3           
1203   Lines         625      625           
1204   Branches      139      139           
1205 =======================================
1206   Hits          613      613           
1207   Misses          5        5           
1208   Partials        7        7           
1209 ```
1210
1211 | Flag | Coverage Δ | |
1212 |---|---|---|
1213 | functional_test | `98.08% <ø> (ø)` | |
1214
1215 Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#carryforward-flags-in-the-pull-request-comment) to find out more.
1216
1217 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-06-10 16:49](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/64#issuecomment-1152552051):
1218
1219 Hello @o8opi,
1220
1221 I tried your version of this script in a Docker container with Ubuntu 20.04.2.
1222
1223 It failed with the error:
1224 ```
1225 ...
1226 copying path '/nix/store/l920bx9bw37jd681pk98dfra0j3lanva-libarchive-3.6.1-lib' from 'https://cache.nixos.org'...
1227 copying path '/nix/store/km0c80plib16fp76prmhcdwbag9iqnvf-nix-2.9.1' from 'https://cache.nixos.org'...
1228 copying path '/nix/store/0szyscpg632p7vlj9if5gadwlvwcb91d-nix-2.9.1-dev' from 'https://cache.nixos.org'...
1229 building '/nix/store/yz1y19d71lp53jymd51h4qw9c2663x6a-builder.pl.drv'...
1230 building '/nix/store/c539pzdghlrfcik2qymswm30ycbdj3yz-python3-3.9.13-env.drv'...
1231 created 226 symlinks in user environment
1232 Traceback (most recent call last):
1233   File "/home/a13x/src/kconfig-hardened-check/contrib/./get-nix-kconfig.py", line 61, in <module>
1234     main()
1235   File "/home/a13x/src/kconfig-hardened-check/contrib/./get-nix-kconfig.py", line 16, in main
1236     data = json.loads(proc.stdout)
1237   File "/nix/store/553d7c4xcwp9j1a1gb9cb1s9ry3x1pi9-python3-3.9.13/lib/python3.9/json/__init__.py", line 346, in loads
1238     return _default_decoder.decode(s)
1239   File "/nix/store/553d7c4xcwp9j1a1gb9cb1s9ry3x1pi9-python3-3.9.13/lib/python3.9/json/decoder.py", line 337, in decode
1240     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
1241   File "/nix/store/553d7c4xcwp9j1a1gb9cb1s9ry3x1pi9-python3-3.9.13/lib/python3.9/json/decoder.py", line 355, in raw_decode
1242     raise JSONDecodeError("Expecting value", s, err.value) from None
1243 json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
1244 ```
1245
1246 It looks like ` json.loads()` didn't manage to handle the output of `nix search`.
1247
1248 #### <img src="https://avatars.githubusercontent.com/u/106462796?v=4" width="50">[o8opi](https://github.com/o8opi) commented at [2022-07-16 11:53](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/64#issuecomment-1186164603):
1249
1250 this should work better now
1251
1252 #### <img src="https://avatars.githubusercontent.com/u/106462796?v=4" width="50">[o8opi](https://github.com/o8opi) commented at [2022-07-17 21:53](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/64#issuecomment-1186613685):
1253
1254 I have tested in an Ubuntu-20.04 container and it worked for me, can share Dockerfile if needed :)
1255
1256 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-07-21 19:38](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/64#issuecomment-1191862516):
1257
1258 Hello @o8opi,
1259
1260 Now it works better, but gives a bunch of other errors:
1261 ```
1262 created 223 symlinks in user environment
1263 extract-vmlinux: Cannot find vmlinux.
1264 Usage: extract-ikconfig <kernel-image>
1265 failed to extract config from legacyPackages.x86_64-linux.linuxPackages_5_10_hardened.kernel
1266 extract-vmlinux: Cannot find vmlinux.
1267 Usage: extract-ikconfig <kernel-image>
1268 failed to extract config from legacyPackages.x86_64-linux.linuxPackages_5_15_hardened.kernel
1269 extract-vmlinux: Cannot find vmlinux.
1270 Usage: extract-ikconfig <kernel-image>
1271 failed to extract config from legacyPackages.x86_64-linux.linuxPackages_5_18_hardened.kernel
1272 extract-vmlinux: Cannot find vmlinux.
1273 Usage: extract-ikconfig <kernel-image>
1274 failed to extract config from legacyPackages.x86_64-linux.linuxPackages_hardened.kernel
1275 error: Package ‘linux-4.14.180-176’ in /nix/store/xcba8ikxvdzw7ycg5ncnfq37w9491cn9-source/pkgs/os-specific/linux/kernel/linux-hardkernel-4.14.nix:4 is not supported on ‘x86_64-linux’, refusing to evaluate.
1276
1277        a) To temporarily allow packages that are unsupported for this system, you can use an environment variable
1278           for a single invocation of the nix tools.
1279
1280             $ export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1
1281
1282         Note: For `nix shell`, `nix build`, `nix develop` or any other Nix 2.4+
1283         (Flake) command, `--impure` must be passed in order to read this
1284         environment variable.
1285
1286        b) For `nixos-rebuild` you can set
1287          { nixpkgs.config.allowUnsupportedSystem = true; }
1288        in configuration.nix to override this.
1289
1290        c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
1291          { allowUnsupportedSystem = true; }
1292        to ~/.config/nixpkgs/config.nix.
1293 (use '--show-trace' to show detailed location information)
1294 failed to build legacyPackages.x86_64-linux.linuxPackages_hardkernel_latest.kernel
1295 extract-vmlinux: Cannot find vmlinux.
1296 Usage: extract-ikconfig <kernel-image>
1297 failed to extract config from legacyPackages.x86_64-linux.linuxPackages_latest.kernel
1298 extract-vmlinux: Cannot find vmlinux.
1299 Usage: extract-ikconfig <kernel-image>
1300 failed to extract config from legacyPackages.x86_64-linux.linuxPackages_latest-libre.kernel
1301 extract-vmlinux: Cannot find vmlinux.
1302 Usage: extract-ikconfig <kernel-image>
1303 failed to extract config from legacyPackages.x86_64-linux.linuxPackages_lqx.kernel
1304 error: Package ‘linux-5.18.12-bcachefs-unstable-2022-04-25’ in /nix/store/xcba8ikxvdzw7ycg5ncnfq37w9491cn9-source/pkgs/os-specific/linux/kernel/linux-testing-bcachefs.nix:15 is marked as broken, refusing to evaluate.
1305
1306        a) To temporarily allow broken packages, you can use an environment variable
1307           for a single invocation of the nix tools.
1308
1309             $ export NIXPKGS_ALLOW_BROKEN=1
1310
1311         Note: For `nix shell`, `nix build`, `nix develop` or any other Nix 2.4+
1312         (Flake) command, `--impure` must be passed in order to read this
1313         environment variable.
1314
1315        b) For `nixos-rebuild` you can set
1316          { nixpkgs.config.allowBroken = true; }
1317        in configuration.nix to override this.
1318
1319        c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
1320          { allowBroken = true; }
1321        to ~/.config/nixpkgs/config.nix.
1322 (use '--show-trace' to show detailed location information)
1323 failed to build legacyPackages.x86_64-linux.linuxPackages_testing_bcachefs.kernel
1324 extract-vmlinux: Cannot find vmlinux.
1325 Usage: extract-ikconfig <kernel-image>
1326 failed to extract config from legacyPackages.x86_64-linux.linuxPackages_xanmod.kernel
1327 extract-vmlinux: Cannot find vmlinux.
1328 Usage: extract-ikconfig <kernel-image>
1329 failed to extract config from legacyPackages.x86_64-linux.linuxPackages_xanmod_latest.kernel
1330 extract-vmlinux: Cannot find vmlinux.
1331 Usage: extract-ikconfig <kernel-image>
1332 failed to extract config from legacyPackages.x86_64-linux.linuxPackages_zen.kernel
1333 ```
1334
1335 I see at least three different kinds of errors here.
1336 Could you have a look?
1337
1338 I would also ask you to rebase your branch over `origin/master`.
1339
1340 Thanks!
1341
1342
1343 -------------------------------------------------------------------------------
1344
1345 # [\#63 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/63) `closed`: Fix getting Nix kconfig (contrib)
1346 **Labels**: `bug`
1347
1348
1349 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) opened issue at [2022-04-27 23:30](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/63):
1350
1351 Hello @Mic92, could you help with this Nix problem?
1352
1353 I tested the installation of `kconfig-hardened-check` in a Docker container with Ubuntu 20.04.4 LTS.
1354
1355 It failed with the following error:
1356
1357 ```
1358 a13x@dc92d9d74557:~/src/1/kconfig-hardened-check/contrib$ ./get-nix-kconfig.py 
1359 these 50 paths will be fetched (94.58 MiB download, 374.80 MiB unpacked):
1360   /nix/store/058drky7qcyd04rzqcmxh86xmifw96dx-glibc-2.34-115-bin
1361   /nix/store/1442kn5q9ah0bhhqm99f8nr76diczqgm-gnused-4.8
1362   /nix/store/19xbyxc31snlk60cil7cx6l4xw126ids-gcc-11.2.0
1363   /nix/store/4r26nvzfa1qfjaqgr2bpw2fz8c6qnk3s-gnutar-1.34
1364   /nix/store/58pwclg9yr437h0pfgrnbd0jis8fqasd-gcc-wrapper-11.2.0
1365   /nix/store/5h6q8cmqjd8iqpd99566hrg2a56pwdkc-acl-2.3.1
1366   /nix/store/6rbwy3mf0w8z119bwqs7dcrc2vyql9sf-expand-response-params
1367   /nix/store/7b2vmi7cq7lzw8g6kaihzg2kyilj4slm-bash-interactive-5.1-p16-dev
1368   /nix/store/87xq1difvspida4391y23vylkjdcgllf-linux-headers-5.16
1369   /nix/store/9l06npv9sp8avdraahzi4kqhcp607d8p-tzdata-2022a
1370   /nix/store/9pxskbhf92x9cxvg87nbzw2q1kmkrym6-bash-interactive-5.1-p16-info
1371   /nix/store/9wq21cbqsxpdx4dk0q6gab00fcir04d1-gzip-1.12
1372   /nix/store/a0k6rfn47h9f69p15pg415x6pfpxhsl5-gdbm-1.23
1373   /nix/store/a5xpjds3mlln26469h72v1jmd00jq6lv-xz-5.2.5
1374   /nix/store/ayrsyv7npr0lcbann4k9lxr19x813f0z-glibc-2.34-115
1375   /nix/store/b36ilvc5hhfpcp7kv1kvrkgcxxpmxfsd-zlib-1.2.12
1376   /nix/store/bavmqg7c4366hbiccpsdawbilh68dajy-xz-5.2.5-bin
1377   /nix/store/bndvc0y3v4djij152wiqbyn13zs2xivy-pcre-8.45
1378   /nix/store/bqkx3pi50phcglv0l551jhp96bq8njl0-gnugrep-3.7
1379   /nix/store/c7062r0rh84w3v77pqwdcggrsdlvy1df-findutils-4.9.0
1380   /nix/store/clkdigybx5w29rjxnwnsk76q49gb12k7-ncurses-6.3
1381   /nix/store/d60gkg5dkw4y5kc055n4m0xyvcjz65im-bash-interactive-5.1-p16
1382   /nix/store/dgic5ks4yixhh0havidjwd02rskmqlgp-binutils-wrapper-2.38
1383   /nix/store/dxj6b99zh4fh5z65rqirmcfvffxx5ig0-readline-8.1p2
1384   /nix/store/f2fnhhjanmxganm3xa5inwgvi6wj2ran-bash-interactive-5.1-p16-doc
1385   /nix/store/fcd0m68c331j7nkdxvnnpb8ggwsaiqac-bash-5.1-p16
1386   /nix/store/gm6q7jmajjmnwd29wgbq2jm3x37vsw3h-libffi-3.4.2
1387   /nix/store/hgl0ydlkgs6y6hx9h7k209shw3v7z77j-coreutils-9.0
1388   /nix/store/hym1n0ygqp9wcm7pxn4sfrql3fg7xa09-python3-3.9.12
1389   /nix/store/ik4qlj53grwmg7avzrfrn34bjf6a30ch-libunistring-1.0
1390   /nix/store/jm3nxvmxcm5nvalbv28acvygismcykvj-gnumake-4.3
1391   /nix/store/k3wp5kdxwa4ysb6nh5y9yll5n30cja5m-patch-2.7.6
1392   /nix/store/m2vh2ny7bqpwij1gpmvl5gxj7y4dgr4f-binutils-2.38
1393   /nix/store/n239ln3v669s5fkir2fd8niqawyg6qrv-attr-2.5.1
1394   /nix/store/pmyiksh5sgqzakbr84qsfxqy8fgirmic-stdenv-linux
1395   /nix/store/psijdi9190zgbp053y6dj3ax4y2l70gk-gcc-11.2.0-lib
1396   /nix/store/pvn23vycg674bj6nypjcfyhqbr85rqxa-glibc-2.34-115-dev
1397   /nix/store/qd3g8rk5hx5zkb70idjh6fa12sh6bipg-mailcap-2.1.53
1398   /nix/store/qvs678k05yrv566dmqdnxfbzi4s6ir1n-sqlite-3.38.2
1399   /nix/store/rf3j3p8cvn0dr5wdl65ns9f8wnlca8h6-readline-6.3p08
1400   /nix/store/sj2plsn7wz94dkwvg1wlb11pjch6r70v-diffutils-3.8
1401   /nix/store/v8vpzh3slc5hm4d9id5bim4dsb4d2ndh-openssl-1.1.1n
1402   /nix/store/v990x4cib4dssspn4778rlz46jmm3a9k-expat-2.4.7
1403   /nix/store/vz05jxs509mgp5i5jbrgvgvg4a2p3a3m-ed-1.18
1404   /nix/store/w3zngkrag7vnm7v1q8vnqb71q6a1w8gn-libidn2-2.3.2
1405   /nix/store/wcj03nlvxsjrc1cmpl2nhpn80l5wvf8j-gawk-5.1.1
1406   /nix/store/x6jr3j9hxs8ld8cy69gy9aykrm3iz8rv-patchelf-0.14.5
1407   /nix/store/yjndwl7872iqhw7m97gv7kwgwd5d66s5-bzip2-1.0.6.0.2-bin
1408   /nix/store/zf03nlnk9h724gz7qzzbrzyqif8gbwhq-bzip2-1.0.6.0.2
1409   /nix/store/zghsxxqb2gyz460q4r7jfdc2lpg3rgjw-bash-interactive-5.1-p16-man
1410 copying path '/nix/store/f2fnhhjanmxganm3xa5inwgvi6wj2ran-bash-interactive-5.1-p16-doc' from 'https://cache.nixos.org'...
1411 copying path '/nix/store/9pxskbhf92x9cxvg87nbzw2q1kmkrym6-bash-interactive-5.1-p16-info' from 'https://cache.nixos.org'...
1412 copying path '/nix/store/zghsxxqb2gyz460q4r7jfdc2lpg3rgjw-bash-interactive-5.1-p16-man' from 'https://cache.nixos.org'...
1413 copying path '/nix/store/ik4qlj53grwmg7avzrfrn34bjf6a30ch-libunistring-1.0' from 'https://cache.nixos.org'...
1414 copying path '/nix/store/87xq1difvspida4391y23vylkjdcgllf-linux-headers-5.16' from 'https://cache.nixos.org'...
1415 copying path '/nix/store/w3zngkrag7vnm7v1q8vnqb71q6a1w8gn-libidn2-2.3.2' from 'https://cache.nixos.org'...
1416 copying path '/nix/store/qd3g8rk5hx5zkb70idjh6fa12sh6bipg-mailcap-2.1.53' from 'https://cache.nixos.org'...
1417 copying path '/nix/store/ayrsyv7npr0lcbann4k9lxr19x813f0z-glibc-2.34-115' from 'https://cache.nixos.org'...
1418 copying path '/nix/store/9l06npv9sp8avdraahzi4kqhcp607d8p-tzdata-2022a' from 'https://cache.nixos.org'...
1419 copying path '/nix/store/n239ln3v669s5fkir2fd8niqawyg6qrv-attr-2.5.1' from 'https://cache.nixos.org'...
1420 copying path '/nix/store/fcd0m68c331j7nkdxvnnpb8ggwsaiqac-bash-5.1-p16' from 'https://cache.nixos.org'...
1421 copying path '/nix/store/5h6q8cmqjd8iqpd99566hrg2a56pwdkc-acl-2.3.1' from 'https://cache.nixos.org'...
1422 copying path '/nix/store/zf03nlnk9h724gz7qzzbrzyqif8gbwhq-bzip2-1.0.6.0.2' from 'https://cache.nixos.org'...
1423 copying path '/nix/store/hgl0ydlkgs6y6hx9h7k209shw3v7z77j-coreutils-9.0' from 'https://cache.nixos.org'...
1424 copying path '/nix/store/yjndwl7872iqhw7m97gv7kwgwd5d66s5-bzip2-1.0.6.0.2-bin' from 'https://cache.nixos.org'...
1425 copying path '/nix/store/sj2plsn7wz94dkwvg1wlb11pjch6r70v-diffutils-3.8' from 'https://cache.nixos.org'...
1426 copying path '/nix/store/vz05jxs509mgp5i5jbrgvgvg4a2p3a3m-ed-1.18' from 'https://cache.nixos.org'...
1427 copying path '/nix/store/6rbwy3mf0w8z119bwqs7dcrc2vyql9sf-expand-response-params' from 'https://cache.nixos.org'...
1428 copying path '/nix/store/v990x4cib4dssspn4778rlz46jmm3a9k-expat-2.4.7' from 'https://cache.nixos.org'...
1429 copying path '/nix/store/c7062r0rh84w3v77pqwdcggrsdlvy1df-findutils-4.9.0' from 'https://cache.nixos.org'...
1430 copying path '/nix/store/wcj03nlvxsjrc1cmpl2nhpn80l5wvf8j-gawk-5.1.1' from 'https://cache.nixos.org'...
1431 copying path '/nix/store/psijdi9190zgbp053y6dj3ax4y2l70gk-gcc-11.2.0-lib' from 'https://cache.nixos.org'...
1432 copying path '/nix/store/a0k6rfn47h9f69p15pg415x6pfpxhsl5-gdbm-1.23' from 'https://cache.nixos.org'...
1433 copying path '/nix/store/058drky7qcyd04rzqcmxh86xmifw96dx-glibc-2.34-115-bin' from 'https://cache.nixos.org'...
1434 copying path '/nix/store/jm3nxvmxcm5nvalbv28acvygismcykvj-gnumake-4.3' from 'https://cache.nixos.org'...
1435 copying path '/nix/store/pvn23vycg674bj6nypjcfyhqbr85rqxa-glibc-2.34-115-dev' from 'https://cache.nixos.org'...
1436 copying path '/nix/store/1442kn5q9ah0bhhqm99f8nr76diczqgm-gnused-4.8' from 'https://cache.nixos.org'...
1437 copying path '/nix/store/4r26nvzfa1qfjaqgr2bpw2fz8c6qnk3s-gnutar-1.34' from 'https://cache.nixos.org'...
1438 copying path '/nix/store/9wq21cbqsxpdx4dk0q6gab00fcir04d1-gzip-1.12' from 'https://cache.nixos.org'...
1439 copying path '/nix/store/gm6q7jmajjmnwd29wgbq2jm3x37vsw3h-libffi-3.4.2' from 'https://cache.nixos.org'...
1440 copying path '/nix/store/clkdigybx5w29rjxnwnsk76q49gb12k7-ncurses-6.3' from 'https://cache.nixos.org'...
1441 copying path '/nix/store/v8vpzh3slc5hm4d9id5bim4dsb4d2ndh-openssl-1.1.1n' from 'https://cache.nixos.org'...
1442 copying path '/nix/store/k3wp5kdxwa4ysb6nh5y9yll5n30cja5m-patch-2.7.6' from 'https://cache.nixos.org'...
1443 copying path '/nix/store/x6jr3j9hxs8ld8cy69gy9aykrm3iz8rv-patchelf-0.14.5' from 'https://cache.nixos.org'...
1444 copying path '/nix/store/bndvc0y3v4djij152wiqbyn13zs2xivy-pcre-8.45' from 'https://cache.nixos.org'...
1445 copying path '/nix/store/rf3j3p8cvn0dr5wdl65ns9f8wnlca8h6-readline-6.3p08' from 'https://cache.nixos.org'...
1446 copying path '/nix/store/bqkx3pi50phcglv0l551jhp96bq8njl0-gnugrep-3.7' from 'https://cache.nixos.org'...
1447 copying path '/nix/store/dxj6b99zh4fh5z65rqirmcfvffxx5ig0-readline-8.1p2' from 'https://cache.nixos.org'...
1448 copying path '/nix/store/a5xpjds3mlln26469h72v1jmd00jq6lv-xz-5.2.5' from 'https://cache.nixos.org'...
1449 copying path '/nix/store/d60gkg5dkw4y5kc055n4m0xyvcjz65im-bash-interactive-5.1-p16' from 'https://cache.nixos.org'...
1450 copying path '/nix/store/bavmqg7c4366hbiccpsdawbilh68dajy-xz-5.2.5-bin' from 'https://cache.nixos.org'...
1451 copying path '/nix/store/7b2vmi7cq7lzw8g6kaihzg2kyilj4slm-bash-interactive-5.1-p16-dev' from 'https://cache.nixos.org'...
1452 copying path '/nix/store/b36ilvc5hhfpcp7kv1kvrkgcxxpmxfsd-zlib-1.2.12' from 'https://cache.nixos.org'...
1453 copying path '/nix/store/m2vh2ny7bqpwij1gpmvl5gxj7y4dgr4f-binutils-2.38' from 'https://cache.nixos.org'...
1454 copying path '/nix/store/19xbyxc31snlk60cil7cx6l4xw126ids-gcc-11.2.0' from 'https://cache.nixos.org'...
1455 copying path '/nix/store/dgic5ks4yixhh0havidjwd02rskmqlgp-binutils-wrapper-2.38' from 'https://cache.nixos.org'...
1456 copying path '/nix/store/qvs678k05yrv566dmqdnxfbzi4s6ir1n-sqlite-3.38.2' from 'https://cache.nixos.org'...
1457 copying path '/nix/store/58pwclg9yr437h0pfgrnbd0jis8fqasd-gcc-wrapper-11.2.0' from 'https://cache.nixos.org'...
1458 copying path '/nix/store/hym1n0ygqp9wcm7pxn4sfrql3fg7xa09-python3-3.9.12' from 'https://cache.nixos.org'...
1459
1460 copying path '/nix/store/pmyiksh5sgqzakbr84qsfxqy8fgirmic-stdenv-linux' from 'https://cache.nixos.org'...
1461 Traceback (most recent call last):
1462   File "/home/a13x/src/1/kconfig-hardened-check/contrib/./get-nix-kconfig.py", line 30, in <module>
1463     main()
1464   File "/home/a13x/src/1/kconfig-hardened-check/contrib/./get-nix-kconfig.py", line 16, in main
1465     data = json.loads(proc.stdout)
1466   File "/nix/store/hym1n0ygqp9wcm7pxn4sfrql3fg7xa09-python3-3.9.12/lib/python3.9/json/__init__.py", line 346, in loads
1467     return _default_decoder.decode(s)
1468   File "/nix/store/hym1n0ygqp9wcm7pxn4sfrql3fg7xa09-python3-3.9.12/lib/python3.9/json/decoder.py", line 337, in decode
1469     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
1470   File "/nix/store/hym1n0ygqp9wcm7pxn4sfrql3fg7xa09-python3-3.9.12/lib/python3.9/json/decoder.py", line 355, in raw_decode
1471     raise JSONDecodeError("Expecting value", s, err.value) from None
1472 json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
1473 ```
1474
1475 Hoping for your help with Nix, @Mic92!
1476
1477 #### <img src="https://avatars.githubusercontent.com/u/106462796?v=4" width="50">[o8opi](https://github.com/o8opi) commented at [2022-12-28 21:16](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/63#issuecomment-1366920764):
1478
1479 Hello, is this still relevant ?
1480
1481 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-12-28 22:11](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/63#issuecomment-1366954405):
1482
1483 Hello @o8opi,
1484
1485 It would be nice to fix this script or remove it.
1486
1487 Is it possible to get a Nix kernel config somewhere without building the Linux kernel for NixOS?
1488
1489 Thank you!
1490
1491 #### <img src="https://avatars.githubusercontent.com/u/96200?u=9ed15c85825694d00e996d605d728179b830c4fa&v=4" width="50">[Mic92](https://github.com/Mic92) commented at [2022-12-29 10:00](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/63#issuecomment-1367202486):
1492
1493 The script was fixed in https://github.com/a13xp0p0v/kconfig-hardened-check/pull/78
1494
1495 #### <img src="https://avatars.githubusercontent.com/u/96200?u=9ed15c85825694d00e996d605d728179b830c4fa&v=4" width="50">[Mic92](https://github.com/Mic92) commented at [2022-12-29 10:01](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/63#issuecomment-1367203173):
1496
1497 I don't think the kernel config can be easily get otherwise. It is generated by nix code depending on enabled features and kernel versions.
1498
1499 #### <img src="https://avatars.githubusercontent.com/u/96200?u=9ed15c85825694d00e996d605d728179b830c4fa&v=4" width="50">[Mic92](https://github.com/Mic92) commented at [2022-12-29 10:02](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/63#issuecomment-1367204327):
1500
1501 However there is https://github.com/cachix/install-nix-action combined https://github.com/marketplace/actions/create-pull-request could automatically keep this up-to-date.
1502
1503 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-01-19 16:15](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/63#issuecomment-1397233625):
1504
1505 Hello @Mic92,
1506
1507 Closing, this issue has been fixed in https://github.com/a13xp0p0v/kconfig-hardened-check/pull/77.
1508
1509 Thanks!
1510
1511
1512 -------------------------------------------------------------------------------
1513
1514 # [\#62 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/62) `merged`: Add BLK_DEV_FD_RAWCMD
1515 **Labels**: `kernel_maintainer_feedback`
1516
1517
1518 #### <img src="https://avatars.githubusercontent.com/u/150761?u=f98bb82be5009ecefd6ee9bc3d60fcf082f8cf49&v=4" width="50">[evdenis](https://github.com/evdenis) opened issue at [2022-04-27 18:15](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/62):
1519
1520 See commit torvalds/linux@233087ca0636 ("floppy: disable FDRAWCMD by default")
1521
1522 Signed-off-by: Denis Efremov <efremov@linux.com>
1523
1524 #### <img src="https://avatars.githubusercontent.com/u/65553080?u=1e9e0de760ac0083c86dab588f627a0468cd714e&v=4" width="50">[codecov-commenter](https://github.com/codecov-commenter) commented at [2022-04-27 18:16](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/62#issuecomment-1111331853):
1525
1526 # [Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/62?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) Report
1527 > Merging [#62](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/62?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (bbe60e7) into [master](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/commit/61bfef8931bcefc1abb6d3d46e169c8372ce729b?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (61bfef8) will **increase** coverage by `0.01%`.
1528 > The diff coverage is `100.00%`.
1529
1530 ```diff
1531 @@            Coverage Diff             @@
1532 ##           master      #62      +/-   ##
1533 ==========================================
1534 + Coverage   90.32%   90.33%   +0.01%     
1535 ==========================================
1536   Files           3        3              
1537   Lines         589      590       +1     
1538   Branches      137      137              
1539 ==========================================
1540 + Hits          532      533       +1     
1541   Misses         29       29              
1542   Partials       28       28              
1543 ```
1544
1545 | Flag | Coverage Δ | |
1546 |---|---|---|
1547 | functional_test | `90.33% <100.00%> (+0.01%)` | :arrow_up: |
1548
1549 Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#carryforward-flags-in-the-pull-request-comment) to find out more.
1550
1551 | [Impacted Files](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/62?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) | Coverage Δ | |
1552 |---|---|---|
1553 | [kconfig\_hardened\_check/\_\_init\_\_.py](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/62/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#diff-a2NvbmZpZ19oYXJkZW5lZF9jaGVjay9fX2luaXRfXy5weQ==) | `90.34% <100.00%> (+0.01%)` | :arrow_up: |
1554
1555 ------
1556
1557 [Continue to review full report at Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/62?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov).
1558 > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)
1559 > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
1560 > Powered by [Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/62?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov). Last update [61bfef8...bbe60e7](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/62?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov).
1561
1562 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-04-28 11:41](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/62#issuecomment-1112102364):
1563
1564 Thanks @evdenis!
1565 👍
1566
1567
1568 -------------------------------------------------------------------------------
1569
1570 # [\#61 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/61) `closed`: Let user select configs without absolute path
1571
1572 #### <img src="https://avatars.githubusercontent.com/u/29118926?v=4" width="50">[dmknght](https://github.com/dmknght) opened issue at [2022-03-26 15:15](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/61):
1573
1574 ## System info:
1575 Parrot OS 5.0, python 3
1576 kconfig-hardened-check version 5.14
1577 I've tried all options in help menu and I didn't find anything similar to my idea
1578
1579 ## Idea
1580 1. Create an option to list all config. Maybe it supports search as well.
1581 2. Let user select module without absolute path. For example, when I do Debian packaging for this tool, the configs are at `/usr/lib/python3/dist-packages/kconfig_hardened_check/config_files/` and users don't know where to search configs / modules.
1582 Solution:
1583 1. Add a `__init__.py` file into `config_files`. By this, folder `configs` is a module of the whole project.
1584 2. You can do `from kconfig-hardnerned-check.<any path> import config_files`. Absolute path of the module will be `config_files.__path__[0]`
1585 3. All modules are listed by `walk_dir(config_files.__path__[0])`. By this, you can have an option in argv to list all configs
1586 4. When user provide `-c` flag, like `-c distros/debian.config`, absolute path is merged with `config_files.__path__[0]` so there's no need to know absolute path.
1587
1588 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-04-08 18:06](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/61#issuecomment-1093149751):
1589
1590 Hello @dmknght,
1591
1592 Thanks for writing!
1593
1594 Actually, the config files in `kconfig_hardened_check/config_files/` are provided as examples that are used for developing and testing of this tool. These configs are updated not that often, they don't cover all major distros.
1595
1596 The main use case for users is to check their own kernel config. The example from Fedora:
1597 ```
1598 ./bin/kconfig-hardened-check -c /boot/config-5.16.11-100.fc34.x86_64
1599 ```
1600 So I don't think users care about the location of these example config files. How do you think?
1601
1602 #### <img src="https://avatars.githubusercontent.com/u/29118926?v=4" width="50">[dmknght](https://github.com/dmknght) commented at [2022-05-06 05:37](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/61#issuecomment-1119275930):
1603
1604 > Hello @dmknght,
1605
1606 > Thanks for writing!
1607
1608 > Actually, the config files in `kconfig_hardened_check/config_files/` are provided as examples that are used for developing and testing of this tool. These configs are updated not that often, they don't cover all major distros.
1609
1610 > The main use case for users is to check their own kernel config. The example from Fedora:
1611
1612 > ```
1613 > ./bin/kconfig-hardened-check -c /boot/config-5.16.11-100.fc34.x86_64
1614 > ```
1615
1616 > So I don't think users care about the location of these example config files. How do you think?
1617
1618 Hello! Sorry for very late reply. I had issue with my mail notification LuL. Anyway, I think that's a very interesting point that i didn't know. In this case, I think `kconfig-hardened-check` can have a flag like `auto check` to do the command automatically. The workflow is like:
1619 1. Check if there is `config file` that matches `kernel version` at `/boot/`
1620 2. If exists, run the system check automatically
1621 3. If doesn't exists, tells user to try some examples. In this case, i think absolute path of examples is needed.
1622
1623 What do you think about this? To me I think it's easier to user to just do `run and read` the result without thinking about wrong profiles.
1624
1625 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2022-05-07 12:00](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/61#issuecomment-1120197457):
1626
1627 Some distros don't expose kernel config at /boot and I don't see why average user would be interested in checking example config which is probably totally unrelated to their system.
1628
1629 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-05-08 13:33](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/61#issuecomment-1120420075):
1630
1631 I agree with @Bernhard40.
1632
1633 @dmknght, I would avoid adding the code for searching the kernel config on a local machine.
1634
1635 Moreover, Linux kernel developers often use the `kconfig-hardened-check` tool for the configs of the kernels that they develop (not the config of the local machine).
1636
1637 Thanks!
1638
1639 #### <img src="https://avatars.githubusercontent.com/u/29118926?v=4" width="50">[dmknght](https://github.com/dmknght) commented at [2022-05-09 08:49](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/61#issuecomment-1120822656):
1640
1641 > @dmknght, I would avoid adding the code for searching the kernel config on a local machine.
1642
1643 Well it's not that hard. From what i checked, you just need to get kernel version, and map the path `/boot/config-<kernel version>`
1644
1645 > Moreover, Linux kernel developers often use the kconfig-hardened-check tool for the configs of the kernels that they develop (not the config of the local machine).
1646 Well i see. So i guess I can close the issue now because the scope is different.
1647
1648
1649 -------------------------------------------------------------------------------
1650
1651 # [\#60 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/60) `merged`: UBSAN_SANITIZE_ALL not available on ARM
1652
1653 #### <img src="https://avatars.githubusercontent.com/u/7194705?u=be917f131efce086bc9785f2b606107afe2d2fc3&v=4" width="50">[cyanidium](https://github.com/cyanidium) opened issue at [2022-03-26 14:29](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/60):
1654
1655 ARCH_HAS_UBSAN_SANITIZE_ALL is not selected for arm arch, which prevents selection of CONFIG_UBSAN_SANITIZE_ALL
1656
1657 https://github.com/torvalds/linux/blob/master/arch/arm/Kconfig
1658 https://github.com/torvalds/linux/blob/master/lib/Kconfig.ubsan
1659
1660 #### <img src="https://avatars.githubusercontent.com/u/65553080?u=1e9e0de760ac0083c86dab588f627a0468cd714e&v=4" width="50">[codecov-commenter](https://github.com/codecov-commenter) commented at [2022-03-26 14:30](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/60#issuecomment-1079705754):
1661
1662 # [Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/60?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) Report
1663 > Merging [#60](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/60?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (b9c72b3) into [master](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/commit/b0b91b58adc962da01c7fc45cef662ae1b462828?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (b0b91b5) will **increase** coverage by `0.01%`.
1664 > The diff coverage is `100.00%`.
1665
1666 ```diff
1667 @@            Coverage Diff             @@
1668 ##           master      #60      +/-   ##
1669 ==========================================
1670 + Coverage   91.46%   91.48%   +0.01%     
1671 ==========================================
1672   Files           3        3              
1673   Lines         586      587       +1     
1674   Branches      133      134       +1     
1675 ==========================================
1676 + Hits          536      537       +1     
1677   Misses         25       25              
1678   Partials       25       25              
1679 ```
1680
1681 | Flag | Coverage Δ | |
1682 |---|---|---|
1683 | functional_test | `91.48% <100.00%> (+0.01%)` | :arrow_up: |
1684
1685 Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#carryforward-flags-in-the-pull-request-comment) to find out more.
1686
1687 | [Impacted Files](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/60?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) | Coverage Δ | |
1688 |---|---|---|
1689 | [kconfig\_hardened\_check/\_\_init\_\_.py](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/60/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#diff-a2NvbmZpZ19oYXJkZW5lZF9jaGVjay9fX2luaXRfXy5weQ==) | `91.50% <100.00%> (+0.01%)` | :arrow_up: |
1690
1691 ------
1692
1693 [Continue to review full report at Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/60?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov).
1694 > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)
1695 > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
1696 > Powered by [Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/60?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov). Last update [b0b91b5...b9c72b3](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/60?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov).
1697
1698 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-04-08 16:43](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/60#issuecomment-1093077908):
1699
1700 Hello @cyanidium, 
1701
1702 Thanks for your PR.
1703
1704 You are right, UBSAN_SANITIZE_ALL is not available for arm for now.
1705 See the discussion for more info https://github.com/KSPP/linux/issues/25#issuecomment-928154612
1706
1707 I'm going to merge your branch.
1708 Thanks!
1709
1710
1711 -------------------------------------------------------------------------------
1712
1713 # [\#59 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/59) `merged`: EFI mitigations can't be enabled if EFI is not set
1714
1715 #### <img src="https://avatars.githubusercontent.com/u/7194705?u=be917f131efce086bc9785f2b606107afe2d2fc3&v=4" width="50">[cyanidium](https://github.com/cyanidium) opened issue at [2022-03-15 12:38](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/59):
1716
1717 Both EFI_DISABLE_PCI_DMA and RESET_ATTACK_MITIGATION depend on EFI, but if EFI is not set, neither config is required.
1718
1719 Useful on embedded devices that use u-boot or similar instead of EFI.
1720
1721
1722
1723
1724 -------------------------------------------------------------------------------
1725
1726 # [\#58 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/58) `closed`: CONFIG_TRIM_UNUSED_KSYMS and CONFIG_MODULES not in sync
1727
1728 #### <img src="https://avatars.githubusercontent.com/u/11868071?u=d7a5841263276e1f323827fc21b04345df594a60&v=4" width="50">[Churam](https://github.com/Churam) opened issue at [2022-01-17 17:17](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/58):
1729
1730 It seems there is a problem with the current stable kernel (5.15.14 at the date of this issue). 
1731
1732 The kernel option TRIM_UNUSED_KSYMS is defined in my config as: 
1733 ```
1734 Symbol: TRIM_UNUSED_KSYMS [=n]
1735 Type  : bool
1736 Defined at init/Kconfig:2301
1737 Prompt: Trim unused exported kernel symbols
1738 Depends on: MODULES [=n] && !COMPILE_TEST [=n]
1739 Visible if: MODULES [=n] && !COMPILE_TEST [=n] && EXPERT [=y]
1740 Location: 
1741 (1) -> Enable loadable module support (MODULES [=n])
1742
1743 ```
1744 Or the script (with the setup above) outputs me: 
1745 CONFIG_TRIM_UNUSED_KSYMS                     |      y      |    my    | cut_attack_surface |   FAIL: not found
1746
1747 But as the hardening requires to have MODULES = n (is not set) it is impossible to set TRIM_UNUSED_KSYMS through menuconfig.
1748
1749
1750
1751 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-01-21 15:53](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/58#issuecomment-1018632628):
1752
1753 @Churam thanks for your report!
1754
1755 Fixed.
1756
1757 The output for your case now:
1758 ```
1759 CONFIG_TRIM_UNUSED_KSYMS   |   y   |   my   | cut_attack_surface |  OK: CONFIG_MODULES "is not set"
1760 ```
1761
1762 #### <img src="https://avatars.githubusercontent.com/u/11868071?u=d7a5841263276e1f323827fc21b04345df594a60&v=4" width="50">[Churam](https://github.com/Churam) commented at [2022-01-24 11:04](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/58#issuecomment-1019976819):
1763
1764 Fix OK
1765 Output is now as expected, closing issue
1766
1767
1768 -------------------------------------------------------------------------------
1769
1770 # [\#57 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/57) `closed`: CONFIG_AMD_IOMMU_V2 = m appears also to be correct
1771
1772 #### <img src="https://avatars.githubusercontent.com/u/15869?u=31910a5ba7214eaf12efd39cbdf71b69af1b7db0&v=4" width="50">[brandonweeks](https://github.com/brandonweeks) opened issue at [2022-01-10 09:40](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/57):
1773
1774 ```
1775 CONFIG_AMD_IOMMU = y
1776 CONFIG_AMD_IOMMU_V2 = m
1777 ```
1778 appears to correctly setup the AMD v2 IOMMU on supported hardware (tested on NixOS) and is the config option used by [Fedora/RHEL](https://gitlab.com/cki-project/kernel-ark/-/blob/os-build/redhat/configs/common/generic/x86/x86_64/CONFIG_AMD_IOMMU_V2).
1779
1780 If you agree with this assessment, any pointers on how to add an OR to the existing AND conditional for `CONFIG_AMD_IOMMU`?
1781
1782 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-01-21 15:29](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/57#issuecomment-1018612527):
1783
1784 Hello @brandonweeks 
1785
1786 Could you give any details on tests you mentioned?
1787
1788 Thanks!
1789
1790
1791 -------------------------------------------------------------------------------
1792
1793 # [\#56 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/56) `open`: Add RISC-V support
1794 **Labels**: `enhancement`
1795
1796
1797 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) opened issue at [2021-11-21 12:07](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/56):
1798
1799 It would be nice to have `kconfig-hardened-check` adapted for `RISC-V` kernel configs.  
1800
1801 #### <img src="https://avatars.githubusercontent.com/u/125879?v=4" width="50">[cybernet](https://github.com/cybernet) commented at [2021-12-24 13:35](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/56#issuecomment-1000842582):
1802
1803 👍
1804
1805
1806 -------------------------------------------------------------------------------
1807
1808 # [\#55 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/55) `closed`: Should slub_debug be considered a hardening cmd line parameter?
1809 **Labels**: `question`
1810
1811
1812 #### <img src="https://avatars.githubusercontent.com/u/3797768?v=4" width="50">[morfikov](https://github.com/morfikov) opened issue at [2021-10-28 21:16](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/55):
1813
1814 [According to this](https://github.com/a13xp0p0v/kconfig-hardened-check/blob/2b5bf3548b6a7edbf7cd74278d570b658f9ab34a/kconfig_hardened_check/__init__.py#L13-L21), the `slub_debug` is a hardening cmd line parameter. But when you use this option, you will see the following in the syslog on newer kernels:
1815
1816 ```
1817 kernel: **********************************************************
1818 kernel: **   NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE   **
1819 kernel: **                                                      **
1820 kernel: ** This system shows unhashed kernel memory addresses   **
1821 kernel: ** via the console, logs, and other interfaces. This    **
1822 kernel: ** might reduce the security of your system.            **
1823 kernel: **                                                      **
1824 kernel: ** If you see this message and you are not debugging    **
1825 kernel: ** the kernel, report this immediately to your system   **
1826 kernel: ** administrator!                                       **
1827 kernel: **                                                      **
1828 kernel: **   NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE   **
1829 kernel: **********************************************************
1830 ```
1831 More [here](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=792702911f581f7793962fbeb99d5c3a1b28f4c3) and [here](https://patchwork.kernel.org/project/linux-mm/patch/20210214161348.369023-4-timur@kernel.org/).
1832
1833 So, should users use slub_debug=FZP or slub_debug=ZP?
1834
1835 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2021-11-09 19:26](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/55#issuecomment-964465176):
1836
1837 Hello @morfikov!
1838
1839 My code comment in `__init__.py` is a note for future development within https://github.com/a13xp0p0v/kconfig-hardened-check/issues/46. It's not a final decision.
1840
1841 Currently I consider `slub_debug=F` and `slub_debug=Z` as debugging features, as you can see at the [Linux Kernel Defence Map](https://github.com/a13xp0p0v/linux-kernel-defence-map).
1842
1843 And I will have to learn more about `init_on_free` and `slub_debug=P` to choose between them.
1844
1845 Thanks!
1846
1847
1848 -------------------------------------------------------------------------------
1849
1850 # [\#54 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/54) `merged`: Add BLK_DEV_FD
1851 **Labels**: `kernel_maintainer_feedback`
1852
1853
1854 #### <img src="https://avatars.githubusercontent.com/u/150761?u=f98bb82be5009ecefd6ee9bc3d60fcf082f8cf49&v=4" width="50">[evdenis](https://github.com/evdenis) opened issue at [2021-09-10 15:41](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/54):
1855
1856 Floppy driver was written many years ago. It was designed to
1857 work in a single-threaded environment (many global variables)
1858 and to work on real hardware which has significant delays
1859 (floppy drives are slow). Nowadays, when we use virtual
1860 devices (which are fast) and multi-core cpus, floppy driver
1861 shows its problems including deadlocking/livelocking and
1862 other security-related issues. However, we can't just
1863 rewrite it because lack of real hardware and compatibility
1864 with existing userspace tools, many of which rely on
1865 undocumented driver behavior.
1866
1867 Here are some CVEs related to floppy driver:
1868  - CVE-2014-1737 privileges escalation in FDRAWCMD ioctl
1869  - CVE-2014-1738 info leak from kernel heap in FDRAWCMD ioctl
1870  - CVE-2018-7755 kernel pointer lead in FDGETPRM ioctl
1871  - CVE-2019-14283 integer overflow and out-of-bounds read in set_geometry
1872  - CVE-2019-14284 denial of service in setup_format_params
1873  - CVE-2020-9383 out-of-bounds read in set_fdc
1874  - CVE-2021-20261 race condition in floppy_revalidate,
1875    floppy_check_events
1876
1877 As pointed by Linus [1]:
1878 > The only users are virtualization, and even they are going away
1879 > because floppies are so small, and other things have become more
1880 > standard anyway (ie USB disk) or easier to emulate (NVMe or whatever).
1881 > So I suspect the only reason floppy is used even in that area is just
1882 > legacy "we haven't bothered updating to anything better and we have
1883 > old scripts and images that work".
1884
1885 CONFIG_BLK_DEV_FD is not enabled in defconfig on x86_64.
1886 Many distros already require root access for /dev/fd0.
1887 However, qemu (5.2.0) still enables floppy device by default.
1888
1889 [1] https://lore.kernel.org/all/CAHk-=whFAAV_TOLFNnj=wu4mD2L9OvgB6n2sKDdmd8buMKFv8A@mail.gmail.com/
1890
1891 #### <img src="https://avatars.githubusercontent.com/u/65553080?u=1e9e0de760ac0083c86dab588f627a0468cd714e&v=4" width="50">[codecov-commenter](https://github.com/codecov-commenter) commented at [2021-09-10 21:23](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/54#issuecomment-917220941):
1892
1893 # [Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/54?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) Report
1894 > Merging [#54](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/54?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (17d70c5) into [master](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/commit/b54dca6a96b7a07d3d1aec56b5a1df6386bb7d61?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (b54dca6) will **increase** coverage by `0.01%`.
1895 > The diff coverage is `100.00%`.
1896
1897 [![Impacted file tree graph](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/54/graphs/tree.svg?width=650&height=150&src=pr&token=GOOVXMV5Kb&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/54?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)
1898
1899 ```diff
1900 @@            Coverage Diff             @@
1901 ##           master      #54      +/-   ##
1902 ==========================================
1903 + Coverage   92.95%   92.96%   +0.01%     
1904 ==========================================
1905   Files           3        3              
1906   Lines         511      512       +1     
1907   Branches      116      116              
1908 ==========================================
1909 + Hits          475      476       +1     
1910   Misses         18       18              
1911   Partials       18       18              
1912 ```
1913
1914 | Flag | Coverage Δ | |
1915 |---|---|---|
1916 | functional_test | `92.96% <100.00%> (+0.01%)` | :arrow_up: |
1917
1918 Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#carryforward-flags-in-the-pull-request-comment) to find out more.
1919
1920 | [Impacted Files](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/54?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) | Coverage Δ | |
1921 |---|---|---|
1922 | [kconfig\_hardened\_check/\_\_init\_\_.py](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/54/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#diff-a2NvbmZpZ19oYXJkZW5lZF9jaGVjay9fX2luaXRfXy5weQ==) | `93.02% <100.00%> (+0.01%)` | :arrow_up: |
1923
1924 ------
1925
1926 [Continue to review full report at Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/54?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov).
1927 > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)
1928 > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
1929 > Powered by [Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/54?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov). Last update [b54dca6...17d70c5](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/54?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov).
1930
1931 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2021-09-10 21:28](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/54#issuecomment-917223378):
1932
1933 Thanks a lot @evdenis :)
1934 The pull request is merged.
1935
1936
1937 -------------------------------------------------------------------------------
1938
1939 # [\#53 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/53) `closed`: Justification of UBSAN-related choices?
1940 **Labels**: `kernel_maintainer_feedback`
1941
1942
1943 #### <img src="https://avatars.githubusercontent.com/u/601177?v=4" width="50">[equaeghe](https://github.com/equaeghe) opened issue at [2021-09-04 21:22](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/53):
1944
1945 Currently, `UBSAN`-related choices are as follows:
1946
1947 https://github.com/a13xp0p0v/kconfig-hardened-check/blob/4dc94be8a5e0c3a0889679f7079aa93c7f44464d/kconfig_hardened_check/__init__.py#L421-L423
1948
1949 It is unclear to me why the last two are chosen. `UBSAN_MISC=y` seems like a good thing, as it enables more checks. `UBSAN_TRAP=y` seems like a bad thing, as it enables denial of service attacks. Furthermore, if I understand things correctly, `UBSAN_SANITIZE_ALL=y` would be needed to practically activate `UBSAN`.
1950
1951 Is my understanding correct, or a misunderstanding (which is perfectly possible). In the latter case, I would be grateful for a pointer to an appropriate resource.
1952
1953 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2021-09-10 13:40](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/53#issuecomment-916912883):
1954
1955 Hello @equaeghe 
1956
1957 Thanks for your question.
1958
1959 Please have a look, @kees wrote about that in his article about security-related things in the Linux kernel 5.7:
1960 https://outflux.net/blog/archives/2020/09/21/security-things-in-linux-v5-7/
1961
1962 Quote:
1963 ```
1964 For runtime checking, the Undefined Behavior Sanitizer has an option for adding runtime array bounds checking
1965 for catching things like this where the compiler cannot perform a static analysis of the index values.
1966
1967 ...
1968
1969 It was, however, not separate (via kernel Kconfig) until Elena Petrova and I split it out into
1970 CONFIG_UBSAN_BOUNDS, which is fast enough for production kernel use. 
1971
1972 ...
1973
1974 Since UBSAN (and the other Sanitizers) only WARN() by default, system owners need to
1975 set panic_on_warn=1 too if they want to defend against attacks targeting these kinds of flaws.
1976 Because of this, and to avoid bloating the kernel image with all the warning messages, I introduced
1977 CONFIG_UBSAN_TRAP which effectively turns these conditions into a BUG() without needing
1978 additional sysctl settings.
1979 ```
1980
1981 Does that provide answers to your questions?
1982
1983 #### <img src="https://avatars.githubusercontent.com/u/601177?v=4" width="50">[equaeghe](https://github.com/equaeghe) commented at [2021-09-10 14:04](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/53#issuecomment-916929875):
1984
1985 Thanks, that explains why `UBSAN_TRAP=y`. I am still unclear why `UBSAN_MISC is not set` and why nothing is said about `UBSAN_SANITIZE_ALL`.
1986
1987 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2021-09-10 14:56](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/53#issuecomment-916967782):
1988
1989 It looks like other UBSAN modes are for kernel debugging, not for hardening:
1990 ```
1991 [*]   Perform checking for bit-shift overflows
1992 [*]   Perform checking for integer divide-by-zero
1993 [*]   Perform checking for non-boolean values used as boolean
1994 [*]   Perform checking for out of bounds enum values
1995 [*]   Perform checking for misaligned pointer usage
1996 ```
1997 Previously they were collected under UBSAN_MISC, but now I see that they are separate since the kernel commit  c637693b20da8706b7f48d96882c9c80ae935151. I will have a closer look at them.
1998
1999 I will also test UBSAN_SANITIZE_ALL behavior.
2000
2001 Thanks @equaeghe !
2002
2003 #### <img src="https://avatars.githubusercontent.com/u/1110841?u=e5e99e1ac8260e791433baa2423f7d173eea4c1c&v=4" width="50">[kees](https://github.com/kees) commented at [2021-09-10 18:50](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/53#issuecomment-917133371):
2004
2005 `UBSAN_SANITIZE_ALL` is needed to gain coverage over the kernel as a whole. Otherwise, only opted-in things will have the UBSAN features applied.
2006
2007 I.e. for production workloads, I recommend:
2008
2009 ```
2010 CONFIG_UBSAN=y
2011 CONFIG_UBSAN_BOUNDS=y
2012 CONFIG_UBSAN_SANITIZE_ALL=y
2013 ```
2014
2015 and depending on one's crash tolerances, either use `panic_on_warn=1` or `CONFIG_UBSAN_TRAP=y`.
2016
2017 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2021-09-10 21:20](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/53#issuecomment-917219349):
2018
2019 Thank you very much @kees !
2020
2021
2022 -------------------------------------------------------------------------------
2023
2024 # [\#52 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/52) `closed`: Add RANDOMIZE_KSTACK_OFFSET_DEFAULT
2025
2026 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) opened issue at [2021-08-25 19:44](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/52):
2027
2028 Randomize kernel stack offset on syscall entry
2029
2030 The kernel stack offset can be randomized (after pt_regs) by
2031 roughly 5 bits of entropy, frustrating memory corruption
2032 attacks that depend on stack address determinism or
2033 cross-syscall address exposures. This feature is controlled
2034 by kernel boot param "randomize_kstack_offset=on/off", and this
2035 config chooses the default boot state.
2036
2037 #### <img src="https://avatars.githubusercontent.com/u/65553080?u=1e9e0de760ac0083c86dab588f627a0468cd714e&v=4" width="50">[codecov-commenter](https://github.com/codecov-commenter) commented at [2021-08-25 19:46](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/52#issuecomment-905823752):
2038
2039 # [Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/52?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) Report
2040 > Merging [#52](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/52?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (5d12e64) into [master](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/commit/57379d8c851656116e2b149e3f1d4003c17d22d9?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (57379d8) will **increase** coverage by `0.01%`.
2041 > The diff coverage is `100.00%`.
2042
2043 [![Impacted file tree graph](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/52/graphs/tree.svg?width=650&height=150&src=pr&token=GOOVXMV5Kb&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/52?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)
2044
2045 ```diff
2046 @@            Coverage Diff             @@
2047 ##           master      #52      +/-   ##
2048 ==========================================
2049 + Coverage   92.87%   92.88%   +0.01%     
2050 ==========================================
2051   Files           3        3              
2052   Lines         505      506       +1     
2053   Branches      115      115              
2054 ==========================================
2055 + Hits          469      470       +1     
2056   Misses         18       18              
2057   Partials       18       18              
2058 ```
2059
2060 | Flag | Coverage Δ | |
2061 |---|---|---|
2062 | functional_test | `92.88% <100.00%> (+0.01%)` | :arrow_up: |
2063
2064 Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#carryforward-flags-in-the-pull-request-comment) to find out more.
2065
2066 | [Impacted Files](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/52?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) | Coverage Δ | |
2067 |---|---|---|
2068 | [kconfig\_hardened\_check/\_\_init\_\_.py](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/52/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#diff-a2NvbmZpZ19oYXJkZW5lZF9jaGVjay9fX2luaXRfXy5weQ==) | `92.94% <100.00%> (+0.01%)` | :arrow_up: |
2069
2070 ------
2071
2072 [Continue to review full report at Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/52?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov).
2073 > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)
2074 > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
2075 > Powered by [Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/52?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov). Last update [57379d8...5d12e64](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/52?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov).
2076
2077 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2021-09-10 12:14](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/52#issuecomment-916859414):
2078
2079 Hi @anthraxx 
2080
2081 You might be busy, so I've made the fixes myself in the commit b54dca6a96b7a07d3d1aec56b5a1df6386bb7d61.
2082 Hope you wouldn't mind.
2083
2084 Thanks!
2085 Alexander
2086
2087 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2021-09-10 12:15](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/52#issuecomment-916860190):
2088
2089 @a13xp0p0v nah, i was just about to make it KSPP official hence the delay. should have communicated it. Will create a followup PR marking it as kspp soon :cat:
2090
2091 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2021-09-10 13:45](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/52#issuecomment-916916530):
2092
2093 @anthraxx , ah, OK!
2094
2095 Sure, looking forward to your new pull request!
2096
2097
2098 -------------------------------------------------------------------------------
2099
2100 # [\#51 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/51) `merged`: Added cbl-mariner kernel configuration file.
2101
2102 #### <img src="https://avatars.githubusercontent.com/u/25109036?u=507c0397c0e27f6fc1a1b3115f293c66b8056199&v=4" width="50">[Hacks4Snacks](https://github.com/Hacks4Snacks) opened issue at [2021-08-19 20:49](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/51):
2103
2104 Hello,
2105
2106 I have added the CBL-Mariner 1.0 distribution kernel configuration file.
2107
2108 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2021-08-20 17:22](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/51#issuecomment-902842367):
2109
2110 Hello @Hacks4Snacks,
2111 Could you please add the corresponding info to `kconfig_hardened_check/config_files/links.txt` and update your pull request?
2112 Thank you!
2113
2114 #### <img src="https://avatars.githubusercontent.com/u/25109036?u=507c0397c0e27f6fc1a1b3115f293c66b8056199&v=4" width="50">[Hacks4Snacks](https://github.com/Hacks4Snacks) commented at [2021-08-20 17:42](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/51#issuecomment-902853201):
2115
2116 Sure thing! A link to the publicly available configuration has been added. @a13xp0p0v
2117
2118 #### <img src="https://avatars.githubusercontent.com/u/65553080?u=1e9e0de760ac0083c86dab588f627a0468cd714e&v=4" width="50">[codecov-commenter](https://github.com/codecov-commenter) commented at [2021-08-20 18:11](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/51#issuecomment-902869062):
2119
2120 # [Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/51?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) Report
2121 > Merging [#51](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/51?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (a5686b1) into [master](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/commit/38bde65d9df70a6b1ec772b93b07e98778cb7e34?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov) (38bde65) will **not change** coverage.
2122 > The diff coverage is `n/a`.
2123
2124 [![Impacted file tree graph](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/51/graphs/tree.svg?width=650&height=150&src=pr&token=GOOVXMV5Kb&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/51?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)
2125
2126 ```diff
2127 @@           Coverage Diff           @@
2128 ##           master      #51   +/-   ##
2129 =======================================
2130   Coverage   92.87%   92.87%           
2131 =======================================
2132   Files           3        3           
2133   Lines         505      505           
2134   Branches      115      115           
2135 =======================================
2136   Hits          469      469           
2137   Misses         18       18           
2138   Partials       18       18           
2139 ```
2140
2141 | Flag | Coverage Δ | |
2142 |---|---|---|
2143 | functional_test | `92.87% <ø> (ø)` | |
2144
2145 Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov#carryforward-flags-in-the-pull-request-comment) to find out more.
2146
2147
2148 ------
2149
2150 [Continue to review full report at Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/51?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov).
2151 > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov)
2152 > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
2153 > Powered by [Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/51?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov). Last update [38bde65...a5686b1](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/51?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alexander+Popov).
2154
2155 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2021-08-20 18:22](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/51#issuecomment-902874845):
2156
2157 Merged. Thanks @Hacks4Snacks!
2158
2159
2160 -------------------------------------------------------------------------------
2161
2162 # [\#50 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/50) `open`: Allow redefining rules and expanding rule sets
2163 **Labels**: `enhancement`
2164
2165
2166 #### <img src="https://avatars.githubusercontent.com/u/65050545?u=3d095cc7726e6bbf544ea4857c4223033ea90921&v=4" width="50">[petervanvugt](https://github.com/petervanvugt) opened issue at [2021-02-20 01:10](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/50):
2167
2168 I have found this tool quite helpful for quickly auditing embedded kernel configs. However, I've been finding that on embedded systems, I often have unique, application-specific security requirements:
2169
2170 - Embedded SoC vendors often have drivers that haven't made it into mainline that need to be checked (e.g. special HW RNG drivers, TZ drivers, PMIC drivers)
2171 - The application may want to even further prioritize the correct operation of the system over performance or reliability (i.e. be willing to sacrifice battery life, CPU bandwidth, or resistance to DoS attacks to increase hardness)
2172 - Since the required kernel functionality is fully defined (e.g. we know we'll _never_ need FAT filesystem support, don't want UART or kernel console driver, don't want USB gadget drivers, etc.), specify that unused drivers must be removed, lest they be leveraged by an attacker
2173
2174 I propose moving the config tests currently hard-coded in `__init__` into a set of yaml configs that can be included by a top-level config, like this:
2175 ```
2176 # Includes are optional. Recursively walk through them, each test/error will be tagged with the source yaml
2177 # Last included definition for a CONFIG_ is used
2178 includes:
2179   - kspp.yaml
2180   - clipos.yaml
2181   - my.yaml
2182   - soc_a.yaml
2183 # Tests
2184 tests: !!seq [
2185   # Description of test
2186   RANDOMIZE_BASE: {
2187     # Test passes if CONFIG=value
2188     require: value,
2189     # Test passes if config not found, or "is not set"
2190     # require: is not set,
2191     # Optional: only test if other config is set to something
2192     if_config: MODULES,
2193     # Optional: only test specific kernel versions
2194     if_kernel_ver_gt_eq: 5.9,
2195     if_kernel_ver_lt: 5.8,
2196     # Optional: only test specific architectures
2197     if_arch: [X86_64, ARM64, X86_32],
2198   },
2199   # Example: require CONFIG_BUG=y
2200   BUG: {
2201     require: y,
2202   },
2203 ]
2204 ```
2205 This would enable the config requirements to be layered, similar to the way kernel `defconfigs` can be layered (i.e. arch | Android | SoC vendor | device). I have some free time next week to implement this if you're open to it.
2206
2207 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2021-02-21 22:15](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/50#issuecomment-782937216):
2208
2209 Hello @petervanvugt,
2210
2211 Thanks for your initiative!
2212
2213 May I ask you to describe your use-case in details?
2214 Which new requirements to `kconfig-hardened-check` behavior does it have?
2215
2216 Maybe a layered yaml that you propose is not a single solution for your use-case.
2217
2218 Moreover, I see that your use-case relates to this discussion: https://github.com/a13xp0p0v/kconfig-hardened-check/pull/9#issuecomment-453810119
2219 I think we can define some common solution.
2220
2221 Now about the syntax of check definitions.
2222 - Currently all checks are grouped together in `kconfig_hardened_check/__init__.py`.
2223 - The check definitions are very short.
2224
2225 So I can observe them altogether. That helps me to understand and maintain these checks, which is not an easy task.
2226 That is my main rationale.
2227
2228 Here you propose a completely different syntax.
2229 I think we should discuss it before we start coding.
2230 My thoughts:
2231 1. Can we separate changing check definition syntax from changing `kconfig-hardened-check` behavior?
2232 2. The given syntax example doesn't cover all check types that we have. Could you please write *all* current checks in your new syntax? I think we need that for making the decision.
2233
2234 (I'm travelling till the beginning of March, excuse me for delayed replies)
2235
2236 Best regards,
2237 Alexander
2238
2239 #### <img src="https://avatars.githubusercontent.com/u/65050545?u=3d095cc7726e6bbf544ea4857c4223033ea90921&v=4" width="50">[petervanvugt](https://github.com/petervanvugt) commented at [2021-02-23 02:26](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/50#issuecomment-783833502):
2240
2241 Hi @a13xp0p0v ,
2242
2243 My use essentially falls into three cases:
2244
2245 1. My system has kconfigs **not in mainline that must always be set**.
2246  
2247 _For example_, I might want to verify `PANIC_ON_DATA_CORRUPTION` [from Android](https://android.googlesource.com/kernel/msm/+/7b49b86d3aa3d0c6400454a346bad1bbdf0cc78f%5E%21/) is enabled, as a defensive measure, because I'd rather the system immediately reboot at the first sign things are going off the rails, rather than risk being exploited by an attacker.
2248
2249 2. My system has kconfigs that **are in mainline, which are only in play for my hardware**.
2250
2251 _For example_, I may want to verify that my chip's `CONFIG_<HWVENDOR>_HWRANDOM` is enabled, because I'm using it as a cryptographically secure source of enropy.
2252
2253 3. My system has kconfigs that **are in mainline, which many/most users want enabled, but I want disabled**, because they add no benefit, and some nonzero risk.
2254
2255 _For example_, if I'm building an embedded system that uses NXP's i.MX line, I may want to verify `CONFIG_SERIAL_IMX` and `CONFIG_SERIAL_IMX_CONSOLE` are not enabled, because I want to be absolutely certain that the serial drivers and associated kernel console drivers haven't been included. Or, in a similar vein to **(1)**, I may want to enable `CONFIG_PANIC_ON_OOPS` because I prioritize the correctness of my system over its availability.
2256
2257 [EDIT] Another, potentially stronger example I have run into recently is `PROC_PAGE_MONITOR`. The grsecurity patch set removes it for good reason, because access to `/proc/<pid>/smaps` can leak memory mapping information defeating ASLR. While there are mitigations all recent versions of the kernel to prevent insufficiently privileged processes from reading the map of a more privileged process, there have been a few race conditions and side channels that have been shown to circumvent this. So, it is reasonable that many users will want to disable this altogether. However, Android's *libmeminfo* needs to read this entry to compute process memory utilization, which is pretty hard to live without in some applications.
2258
2259 Can we serve all these use cases?
2260
2261 Clearly, there a few paths that could be taken here. We could add these requirements to the very compact representation in `kconfig_hardened_check/__init__.py`. And for **(1)** and **(2)**, we could likely produce some combination of AND/OR kconfig checks (albeit sometimes non-trivial) that keeps the check from generating unnecessarily noisy output/false positives when run on configs for non-applicable hardware, or for kernels that don't fully track mainline. But this wouldn't solve for **(3)**, unless we require the tool be specially patched for such cases, or we add runtime args that turn on each of these checks.
2262
2263 If we want to be able to specify additional requirements at runtime and/or override requirements at runtime, we need a way to specify alternate requirements. This is why I am proposing representing the requirements as runtime configuration, rather than code. As to how we would represent some of the more complex requirements, I am proposing we break them down into requirements that each only check one config each, optionally only checked for some combination of specific architectures/kernel versions/`CONFIG_`s.
2264
2265 We could take configs whose names changed, such as this:
2266 ```
2267 282     l += [OR(OptCheck('self_protection', 'defconfig', 'STACKPROTECTOR_STRONG', 'y'),
2268 283              OptCheck('self_protection', 'defconfig', 'CC_STACKPROTECTOR_STRONG', 'y'))]
2269 ```
2270 and split them into two separate requirements, the first one for kernels >= 4.18, and the second one for kernels >= 3.14 and < 4.18.
2271
2272 The most complex requirement I see is this one:
2273 ```
2274 307     if arch == 'ARM64':
2275 ...
2276 310         l += [OR(OptCheck('self_protection', 'defconfig', 'HARDEN_EL2_VECTORS', 'y'),
2277 311                  AND(OptCheck('self_protection', 'defconfig', 'RANDOMIZE_BASE', 'y'),
2278 312                      VerCheck((5, 9))))] # HARDEN_EL2_VECTORS was included in RANDOMIZE_BASE in v5.9
2279 ```
2280 which could be split into two requirements: one for `RANDOMIZE_BASE` on kernels >= 5.9 for ARM64, and a second check for `HARDEN_EL2_VECTORS` on older kernels >= 4.17 and < 5.9, also for ARM64. This would keep the requirements more readable in the long run.
2281
2282 What do you think?
2283
2284 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2021-03-05 19:16](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/50#issuecomment-791625966):
2285
2286 @petervanvugt thanks a lot for describing your use-cases.
2287 I think they match with [this one](https://github.com/a13xp0p0v/kconfig-hardened-check/pull/9#issuecomment-453810119).
2288 I want to make them possible.
2289
2290 I think `kconfig-hardened-check` should allow to override the default checks and append custom checks.
2291 As a first step, we need some simple solution without changing the check description syntax.
2292 Then we can ponder over the check description syntax.
2293
2294 I will experiment with that.
2295 If you create any prototype, please share!
2296
2297 #### <img src="https://avatars.githubusercontent.com/u/10352354?u=97ab0d446ea4204b959ae74734f8436c78de18e7&v=4" width="50">[egberts](https://github.com/egberts) commented at [2021-08-31 13:08](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/50#issuecomment-909221366):
2298
2299 other use case is prevent leakage of kernel pointers to log file, /proc directory files, or terminal output.  
2300
2301 Which is just a bunch of debugs and dmesg turned off. 
2302
2303
2304 another one is the one provided by Whonix.org (a KSPP variant) which is more rigorous form of kernel security. 
2305
2306 Another one is for Spectre, et. al., mitigation and that has a bunch of config s as well.
2307
2308 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2023-04-23 07:33](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/50#issuecomment-1518980838):
2309
2310 I implemented a part of this feature in `override_expected_value()`.
2311
2312 1. Implementation: https://github.com/a13xp0p0v/kconfig-hardened-check/commit/c1090722157b531261a7cf0257f2dccb744bd93d
2313
2314 2. Unit-test: https://github.com/a13xp0p0v/kconfig-hardened-check/commit/7194de8dfe8b6232166eded1516eb7fdd21c14ed
2315
2316 3.  Refinement of the CONFIG_ARCH_MMAP_RND_BITS check using this feature: https://github.com/a13xp0p0v/kconfig-hardened-check/commit/9bbea5b5bad45aac84aadf83536e31f9bd5e395e
2317
2318
2319 -------------------------------------------------------------------------------
2320
2321 # [\#49 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/49) `closed`: Some checks seem to be at odds with what the recommended settings are
2322
2323 #### <img src="https://avatars.githubusercontent.com/u/14325582?v=4" width="50">[wdormann](https://github.com/wdormann) opened issue at [2021-02-11 14:34](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/49):
2324
2325 I did not go through them all, but these in particular stuck out to me:
2326
2327 ```
2328 CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE     | is not set  |  clipos  |  self_protection   |   FAIL: CONFIG_GCC_PLUGIN_RANDSTRUCT not "y"
2329 CONFIG_STACKLEAK_METRICS                     | is not set  |  clipos  |  self_protection   |   FAIL: CONFIG_GCC_PLUGIN_STACKLEAK not "y"
2330 CONFIG_STACKLEAK_RUNTIME_DISABLE             | is not set  |  clipos  |  self_protection   |   FAIL: CONFIG_GCC_PLUGIN_STACKLEAK not "y"
2331 ```
2332
2333 If I'm reading this properly, the recommended setting for these is ```not set```
2334 However, the specific tests show as ```FAIL``` because they are ```not "y"```
2335
2336 Perhaps I'm just interpreting the report incorrectly, but at first glance it would appear that the check for the desired result is wrong.
2337
2338
2339 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2021-02-11 15:06](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/49#issuecomment-777552022):
2340
2341 Hi @wdormann,
2342
2343 Thanks for your question.
2344 The output is correct, let me explain.
2345
2346 ```
2347 CONFIG_GCC_PLUGIN_RANDSTRUCT                 |      y      |   kspp   |  self_protection   |   FAIL: not found
2348 ...
2349 CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE     | is not set  |  clipos  |  self_protection   |   FAIL: CONFIG_GCC_PLUGIN_RANDSTRUCT not "y"
2350 ```
2351 `RANDSTRUCT` is disabled and the first check fails.
2352 The `RANDSTRUCT_PERFORMANCE` feature is dependent on `RANDSTRUCT`.
2353 That's why the second check fails too with the explanation: `CONFIG_GCC_PLUGIN_RANDSTRUCT not "y"`.
2354
2355 The situation with `STACKLEAK_METRICS` and `STACKLEAK_RUNTIME_DISABLE` is similar.
2356 These checks fail because they depend on `STACKLEAK` which is not `"y"`.
2357
2358 #### <img src="https://avatars.githubusercontent.com/u/14325582?v=4" width="50">[wdormann](https://github.com/wdormann) commented at [2021-02-11 15:19](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/49#issuecomment-777570144):
2359
2360 Reading comprehension is apparently important!
2361 Thanks for the clarification.
2362
2363
2364 -------------------------------------------------------------------------------
2365
2366 # [\#48 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/48) `merged`: Do not check CONFIG_HARDEN_EL2_VECTORS for v5.9+
2367
2368 #### <img src="https://avatars.githubusercontent.com/u/20878259?v=4" width="50">[pgils](https://github.com/pgils) opened issue at [2020-10-19 13:45](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/48):
2369
2370 The CONFIG_HARDEN_EL2_VECTORS Kconfig was removed in Linux 5.9: torvalds/linux@a59a2ed.
2371
2372 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-10-21 15:06](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/48#issuecomment-713644849):
2373
2374 Hi @pgils, thanks for your pull request!
2375
2376 In fact HARDEN_EL2_VECTORS is now included in RANDOMIZE_BASE.
2377 So simple check of the kernel version is not enough.
2378
2379 I think of making nested ComplexOptCheck possible to write such a rule.
2380
2381 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-10-22 16:12](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/48#issuecomment-714601175):
2382
2383 Hi @pgils,
2384 I added nested `ComplexOptChecks` support, merged and improved your rule.
2385 Thanks!
2386
2387 #### <img src="https://avatars.githubusercontent.com/u/20878259?v=4" width="50">[pgils](https://github.com/pgils) commented at [2020-10-24 14:14](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/48#issuecomment-715921069):
2388
2389 thanks @a13xp0p0v, that's a nice feature!
2390
2391 Do you think it would be worthwhile using this for complex dependencies such as this one for `ARM64_PTR_AUTH` which currently `'FAIL'`s for my ARMv8-A config but is not selectable in `menuconfig`?:
2392 ```
2393 (CC_HAS_SIGN_RETURN_ADDRESS [=n] || CC_HAS_BRANCH_PROT_PAC_RET [=n]) \
2394     && AS_HAS_PAC [=n] \
2395     && (LD_IS_LLD [=n] \
2396         || LD_VERSION [=235000000]>=233010000 
2397         || CC_IS_GCC [=y] && GCC_VERSION [=100200]<90100) \
2398     && (!CC_IS_CLANG [=n] || AS_HAS_CFI_NEGATE_RA_STATE [=y]) \
2399     && (!FUNCTION_GRAPH_TRACER [=n] || DYNAMIC_FTRACE_WITH_REGS [=n])
2400 ```
2401
2402 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-10-30 18:16](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/48#issuecomment-719717934):
2403
2404 @pgils, I guess you can't enable `ARM64_PTR_AUTH` because your current toolchain doesn't fit the requirements.
2405 I would recommend improving the toolchain to get this nice feature.
2406
2407 See the output about my toolchain (in Fedora 32):
2408 ```
2409 Depends on: (CC_HAS_SIGN_RETURN_ADDRESS [=y] || CC_HAS_BRANCH_PROT_PAC_RET [=y]) && AS_HAS_PAC [=y] && (LD_IS_LLD [=n] || LD_VERSION [=234000000]>=233010000 || CC_IS_GCC [=y] && GCC_VERSION [=90201]<90100) && (!CC_IS_CLANG [=n] || AS_HAS_CFI_NEGATE_RA_STATE [=y]) && (!FUNCTION_GRAPH_TRACER [=n] || DYNAMIC_FTRACE_WITH_REGS [=n])
2410 ```
2411
2412
2413 -------------------------------------------------------------------------------
2414
2415 # [\#47 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/47) `closed`: Please support /proc/config.gz
2416
2417 #### <img src="https://avatars.githubusercontent.com/u/3797768?v=4" width="50">[morfikov](https://github.com/morfikov) opened issue at [2020-10-13 14:58](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/47):
2418
2419 Currently only uncompressed `config-*` files in /boot/ are supported, but the current kernel config can also be accessed via `/proc/config.gz` . There's no way to use this file. Please support this path as well. 
2420
2421 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-10-14 12:25](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/47#issuecomment-708366463):
2422
2423 No problem, I would recommend this:
2424 ```
2425   # zcat /proc/config.gz > my.config
2426   # ./bin/kconfig-hardened-check -c my.config
2427 ```
2428
2429 #### <img src="https://avatars.githubusercontent.com/u/3797768?v=4" width="50">[morfikov](https://github.com/morfikov) commented at [2020-10-14 13:43](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/47#issuecomment-708410948):
2430
2431 Yes, I know, but this is the same as just using `-c /boot/config-*` . I thought of using `/proc/config.gz` because in such case a user would just use one file no matter what kernel version he's using. When you decompress the file first, it's an extra step which could be eliminated to simplify the whole process and make it easier.
2432
2433 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-10-21 14:44](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/47#issuecomment-713629103):
2434
2435 Not all kernels provide the kernel config via `/proc/config.gz`.
2436 For example, RHEL, Fedora, Ubuntu, Debian don't do that.
2437
2438 I think we can use `zcat` separately, if we need.
2439
2440
2441 -------------------------------------------------------------------------------
2442
2443 # [\#46 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/46) `closed`: CPU specific options and the kernel cmd line 
2444 **Labels**: `enhancement`
2445
2446
2447 #### <img src="https://avatars.githubusercontent.com/u/3797768?v=4" width="50">[morfikov](https://github.com/morfikov) opened issue at [2020-10-04 15:39](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/46):
2448
2449 I have an Intel CPU, and when I run `kconfig-hardened-check` I get the following FAILs:
2450
2451 ```
2452 CONFIG_AMD_IOMMU                             |      y      |defconfig |  self_protection   |   FAIL: "is not set"
2453 CONFIG_AMD_IOMMU_V2                          |      y      |    my    |  self_protection   |   FAIL: not found
2454 ```
2455
2456 It would be nice to have such CPU specific options hidden in the results. 
2457
2458 The behavior of some options can be controlled via the kernel cmd line, for instance:
2459
2460 ```
2461 CONFIG_SLUB_DEBUG_ON                         |      y      |    my    |  self_protection   |   FAIL: "is not set"
2462 CONFIG_X86_VSYSCALL_EMULATION                | is not set  |  clipos  | cut_attack_surface |   FAIL: "y"
2463 ```
2464
2465 If a user set `slub_debug=FZP` and `vsyscall=none` in the kernel cmd line, I think he would achieve the same behavior. So, `kconfig-hardened-check` could check such kernel cmd line options before giving a FAIL. 
2466
2467 What do you think about such improvements? 
2468
2469 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-10-05 10:09](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/46#issuecomment-703535817):
2470
2471 Hi @morfikov, thanks for your ideas.
2472
2473 1. I think we can group AMD_IOMMU recommendations with the corresponding ones for Intel using `OR`.
2474 That would allow to avoid incorrect FAIL reports.
2475
2476 2. Parsing the kernel command line is a nice feature, it's on my TODO list. Moreover, we can get it from `/proc/cmdline` without additional privileges, which is nice.
2477
2478 I'm going to work on `kconfig-hardened-check` in the coming days.
2479 If you want to participate, come on, your pull requests will be welcome!
2480
2481 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2020-10-05 11:03](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/46#issuecomment-703560552):
2482
2483 I always seen this project scope as simple kernel config checker not running system audit tool and I believe in old  unix mantra _Do One Thing and Do It Well_ so I'm skeptical about this additions. Taking  `/proc/cmdline` into account would mean same config would yield different result across systems. Having OR between amd and intel features make it less useful for distros which would want them all.
2484
2485 I think end users are capable of ignoring amd warnings when they have intel cpu and the opposite and also be aware o what they added to their cmdline.
2486
2487 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-10-05 11:55](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/46#issuecomment-703583549):
2488
2489 Hi @Bernhard40 
2490
2491 > Having OR between amd and intel features make it less useful for distros which would want them all.
2492
2493 Hm, you are right. I would agree on that point.
2494
2495 > Taking /proc/cmdline into account would mean same config would yield different result across systems
2496
2497 I would propose a compromise: add a separate flag for checking `/proc/cmdline` (disabled by default).
2498 Is it OK for you?
2499
2500 In fact, I see checking cmdline parameters as a very big improvement.
2501 There are several important cases when checking kernel config is not enough for a correct conclusion about the kernel security.
2502 Examples: `mitigations`, `page_poison`, `init_on_alloc/init_on_free` and some others.
2503
2504 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2020-10-05 20:35](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/46#issuecomment-703873764):
2505
2506 > I would propose a compromise: add a separate flag for checking /proc/cmdline (disabled by default).
2507 > Is it OK for you?
2508
2509 I don't mind if you are ready to maintain it.
2510
2511 > In fact, I see checking cmdline parameters as a very big improvement.
2512 > There are several important cases when checking kernel config is not enough for a correct conclusion about the kernel security.
2513
2514 Yes but for now checking kernel config is the only thing this project ever promised (see readme). Conclusions about kernel security needs expanding the project scope which may be a rabbit hole as if you add cmdlne support then sysctl support should be next etc.
2515
2516 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-10-05 21:01](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/46#issuecomment-703886769):
2517
2518 @Bernhard40, I'll do my best.
2519
2520 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2022-05-28 19:19](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/46#issuecomment-1140317020):
2521
2522 Now kconfig-hardened-check supports checking kernel cmdline parameters.
2523
2524 Cool!
2525
2526 ```
2527 usage: kconfig-hardened-check [-h] [--version] [-p {X86_64,X86_32,ARM64,ARM}]
2528                               [-c CONFIG]
2529                               [-l CMDLINE]
2530                               [-m {verbose,json,show_ok,show_fail}]
2531
2532 A tool for checking the security hardening options of the Linux kernel
2533
2534 optional arguments:
2535   -h, --help            show this help message and exit
2536   --version             show program's version number and exit
2537   -p {X86_64,X86_32,ARM64,ARM}, --print {X86_64,X86_32,ARM64,ARM}
2538                         print security hardening preferences for the selected architecture
2539   -c CONFIG, --config CONFIG
2540                         check the kernel kconfig file against these preferences
2541   -l CMDLINE, --cmdline CMDLINE
2542                         check the kernel cmdline file against these preferences
2543   -m {verbose,json,show_ok,show_fail}, --mode {verbose,json,show_ok,show_fail}
2544                         choose the report mode
2545 ```
2546
2547
2548 -------------------------------------------------------------------------------
2549
2550 # [\#45 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/45) `closed`: Request for command line options to display only OK/FAIL items
2551
2552 #### <img src="https://avatars.githubusercontent.com/u/14027079?u=379b0b0fcecea8820dea0f220dc09e3342cc4519&v=4" width="50">[fonic](https://github.com/fonic) opened issue at [2020-07-13 10:07](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/45):
2553
2554 I'd like to request command line options to reduce output to OK/FAIL items only, e.g.
2555 ```
2556 -o, --ok      only list items checked as OK
2557 -f, --fail    only list items checked as FAIL
2558 ```
2559
2560 This would make it much easier to work through the list of settings when hardening kernel configurations, especially if one only applies few at a time to test their impact.
2561
2562 This tool is great, many thanks!
2563
2564 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-07-15 11:55](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/45#issuecomment-658724615):
2565
2566 Hello @fonic,
2567
2568 Please see `show_ok` and `show_fail` modes:
2569 ```
2570 usage: kconfig-hardened-check [-h] [--version] [-p {X86_64,X86_32,ARM64,ARM}]
2571                               [-c CONFIG]
2572                               [-m {verbose,json,show_ok,show_fail}]
2573
2574 Checks the hardening options in the Linux kernel config
2575
2576 optional arguments:
2577   -h, --help            show this help message and exit
2578   --version             show program's version number and exit
2579   -p {X86_64,X86_32,ARM64,ARM}, --print {X86_64,X86_32,ARM64,ARM}
2580                         print hardening preferences for selected architecture
2581   -c CONFIG, --config CONFIG
2582                         check the kernel config file against these preferences
2583   -m {verbose,json,show_ok,show_fail}, --mode {verbose,json,show_ok,show_fail}
2584                         choose the report mode
2585 ```
2586
2587 Output example:
2588 ```
2589 $ ./bin/kconfig-hardened-check -c kconfig_hardened_check/config_files/distros/ubuntu-focal.config -m show_ok
2590 [+] Special report mode: show_ok
2591 [+] Config file to check: kconfig_hardened_check/config_files/distros/ubuntu-focal.config
2592 [+] Detected architecture: X86_64
2593 [+] Detected kernel version: 5.4
2594 =========================================================================================================================
2595                  option name                 | desired val | decision |       reason       |   check result
2596 =========================================================================================================================
2597 CONFIG_BUG                                   |      y      |defconfig |  self_protection   |   OK
2598 CONFIG_SLUB_DEBUG                            |      y      |defconfig |  self_protection   |   OK
2599 CONFIG_STACKPROTECTOR_STRONG                 |      y      |defconfig |  self_protection   |   OK
2600 CONFIG_STRICT_KERNEL_RWX                     |      y      |defconfig |  self_protection   |   OK
2601 CONFIG_STRICT_MODULE_RWX                     |      y      |defconfig |  self_protection   |   OK
2602 CONFIG_IOMMU_SUPPORT                         |      y      |defconfig |  self_protection   |   OK
2603 CONFIG_MICROCODE                             |      y      |defconfig |  self_protection   |   OK
2604 CONFIG_RETPOLINE                             |      y      |defconfig |  self_protection   |   OK
2605 CONFIG_X86_SMAP                              |      y      |defconfig |  self_protection   |   OK
2606 CONFIG_SYN_COOKIES                           |      y      |defconfig |  self_protection   |   OK
2607 CONFIG_X86_UMIP                              |      y      |defconfig |  self_protection   |   OK: CONFIG_X86_INTEL_UMIP "y"
2608 CONFIG_PAGE_TABLE_ISOLATION                  |      y      |defconfig |  self_protection   |   OK
2609 CONFIG_RANDOMIZE_MEMORY                      |      y      |defconfig |  self_protection   |   OK
2610 CONFIG_INTEL_IOMMU                           |      y      |defconfig |  self_protection   |   OK
2611 CONFIG_AMD_IOMMU                             |      y      |defconfig |  self_protection   |   OK
2612 CONFIG_VMAP_STACK                            |      y      |defconfig |  self_protection   |   OK
2613 CONFIG_RANDOMIZE_BASE                        |      y      |defconfig |  self_protection   |   OK
2614 CONFIG_THREAD_INFO_IN_TASK                   |      y      |defconfig |  self_protection   |   OK
2615 CONFIG_DEBUG_WX                              |      y      |   kspp   |  self_protection   |   OK
2616 CONFIG_SCHED_STACK_END_CHECK                 |      y      |   kspp   |  self_protection   |   OK
2617 CONFIG_SLAB_FREELIST_HARDENED                |      y      |   kspp   |  self_protection   |   OK
2618 CONFIG_SLAB_FREELIST_RANDOM                  |      y      |   kspp   |  self_protection   |   OK
2619 CONFIG_SHUFFLE_PAGE_ALLOCATOR                |      y      |   kspp   |  self_protection   |   OK
2620 CONFIG_FORTIFY_SOURCE                        |      y      |   kspp   |  self_protection   |   OK
2621 CONFIG_INIT_ON_ALLOC_DEFAULT_ON              |      y      |   kspp   |  self_protection   |   OK
2622 CONFIG_HARDENED_USERCOPY                     |      y      |   kspp   |  self_protection   |   OK
2623 CONFIG_MODULE_SIG                            |      y      |   kspp   |  self_protection   |   OK
2624 CONFIG_MODULE_SIG_ALL                        |      y      |   kspp   |  self_protection   |   OK
2625 CONFIG_MODULE_SIG_SHA512                     |      y      |   kspp   |  self_protection   |   OK
2626 CONFIG_INIT_ON_FREE_DEFAULT_ON               |      y      |   kspp   |  self_protection   |   OK: CONFIG_PAGE_POISONING "y"
2627 CONFIG_DEFAULT_MMAP_MIN_ADDR                 |    65536    |   kspp   |  self_protection   |   OK
2628 CONFIG_INTEL_IOMMU_SVM                       |      y      |  clipos  |  self_protection   |   OK
2629 CONFIG_RESET_ATTACK_MITIGATION               |      y      |    my    |  self_protection   |   OK
2630 CONFIG_SECURITY                              |      y      |defconfig |  security_policy   |   OK
2631 CONFIG_SECURITY_YAMA                         |      y      |   kspp   |  security_policy   |   OK
2632 CONFIG_SECURITY_WRITABLE_HOOKS               | is not set  |    my    |  security_policy   |   OK: not found
2633 CONFIG_SECURITY_LOCKDOWN_LSM                 |      y      |  clipos  |  security_policy   |   OK
2634 CONFIG_SECURITY_LOCKDOWN_LSM_EARLY           |      y      |  clipos  |  security_policy   |   OK
2635 CONFIG_SECURITY_SAFESETID                    |      y      |    my    |  security_policy   |   OK
2636 CONFIG_SECCOMP                               |      y      |defconfig | cut_attack_surface |   OK
2637 CONFIG_SECCOMP_FILTER                        |      y      |defconfig | cut_attack_surface |   OK
2638 CONFIG_STRICT_DEVMEM                         |      y      |defconfig | cut_attack_surface |   OK
2639 CONFIG_ACPI_CUSTOM_METHOD                    | is not set  |   kspp   | cut_attack_surface |   OK
2640 CONFIG_COMPAT_BRK                            | is not set  |   kspp   | cut_attack_surface |   OK
2641 CONFIG_DEVKMEM                               | is not set  |   kspp   | cut_attack_surface |   OK
2642 CONFIG_COMPAT_VDSO                           | is not set  |   kspp   | cut_attack_surface |   OK
2643 CONFIG_OABI_COMPAT                           | is not set  |   kspp   | cut_attack_surface |   OK: not found
2644 CONFIG_X86_PTDUMP                            | is not set  |grsecurity| cut_attack_surface |   OK
2645 CONFIG_ZSMALLOC_STAT                         | is not set  |grsecurity| cut_attack_surface |   OK
2646 CONFIG_PAGE_OWNER                            | is not set  |grsecurity| cut_attack_surface |   OK
2647 CONFIG_DEBUG_KMEMLEAK                        | is not set  |grsecurity| cut_attack_surface |   OK
2648 CONFIG_BINFMT_AOUT                           | is not set  |grsecurity| cut_attack_surface |   OK: not found
2649 CONFIG_DRM_LEGACY                            | is not set  |maintainer| cut_attack_surface |   OK
2650 CONFIG_X86_IOPL_IOPERM                       | is not set  | lockdown | cut_attack_surface |   OK: not found
2651 CONFIG_MMIOTRACE_TEST                        | is not set  | lockdown | cut_attack_surface |   OK
2652 CONFIG_X86_INTEL_TSX_MODE_OFF                |      y      |  clipos  | cut_attack_surface |   OK
2653 CONFIG_INTEGRITY                             |      y      |defconfig |userspace_hardening |   OK
2654
2655 [+] Config check is finished: 'OK' - 57 / 'FAIL' - 79 (suppressed in output)
2656 ```
2657
2658 #### <img src="https://avatars.githubusercontent.com/u/14027079?u=379b0b0fcecea8820dea0f220dc09e3342cc4519&v=4" width="50">[fonic](https://github.com/fonic) commented at [2020-07-15 15:14](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/45#issuecomment-658827875):
2659
2660 Awesome, just tested it. That makes an already great tool even better. Many thanks!
2661
2662
2663 -------------------------------------------------------------------------------
2664
2665 # [\#44 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/44) `closed`: KSPP future in defconf linux distribution.
2666
2667 #### <img src="https://avatars.githubusercontent.com/u/3471772?v=4" width="50">[bryn1u](https://github.com/bryn1u) opened issue at [2020-05-10 18:01](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/44):
2668
2669 Hello,
2670
2671 Im just curious what is the status of implementing KSPP to default kernel of linux GNU distribution ? Why linux distributions dont impelment for example most of kspp solutions for example steackleak or gcc hardeneing ? I use most of kspp feature based on your script Alexander and kernel works like a charm. Someone can explain to me ?
2672
2673 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2020-05-11 11:40](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/44#issuecomment-626650276):
2674
2675 Some settings may affect performance, debugability, support for older userspace software, etc.
2676
2677 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-05-18 09:58](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/44#issuecomment-630078520):
2678
2679 > Some settings may affect performance, debugability, support for older userspace software, etc.
2680
2681 I agree. 
2682 Moreover, kernel self-protection features often give different performance penalty for different kinds of workload. It's difficult to find one kernel configuration that makes everyone happy.
2683
2684 I think Linux distributions could provide several kernel flavours for different purposes (e.g. generic, hardened, low-latency), to improve the situation.
2685
2686 I'm sure @kees has more insights about this.
2687
2688 #### <img src="https://avatars.githubusercontent.com/u/1110841?u=e5e99e1ac8260e791433baa2423f7d173eea4c1c&v=4" width="50">[kees](https://github.com/kees) commented at [2020-05-18 15:16](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/44#issuecomment-630251690):
2689
2690 Yup! There is an open bug with KSPP to provide a defconfig fragment selection interface to the upstream kernel. You can see more details here:
2691 https://github.com/KSPP/linux/issues/14
2692
2693 #### <img src="https://avatars.githubusercontent.com/u/3471772?v=4" width="50">[bryn1u](https://github.com/bryn1u) commented at [2020-05-20 21:06](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/44#issuecomment-631726899):
2694
2695 Okey. Thanks guys for your work and explanation.
2696
2697
2698 -------------------------------------------------------------------------------
2699
2700 # [\#43 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/43) `merged`: Upgrading to Ubuntu 20.04 kernel config
2701
2702 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) opened issue at [2020-05-05 09:12](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/43):
2703
2704 Hi @a13xp0p0v, 
2705
2706 Here is the Ubuntu kernel configuration update.
2707
2708 Best regards.
2709
2710 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-05-06 21:41](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/43#issuecomment-624906056):
2711
2712 Thanks @HacKurx!
2713
2714
2715 -------------------------------------------------------------------------------
2716
2717 # [\#42 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/42) `closed`: add tests
2718
2719 #### <img src="https://avatars.githubusercontent.com/u/3125993?v=4" width="50">[shamilbi](https://github.com/shamilbi) opened issue at [2020-04-14 12:10](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/42):
2720
2721
2722
2723 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-04-24 23:29](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/42#issuecomment-619279461):
2724
2725 Hello @shamilbi !
2726 Could you please describe the purpose of this PR?
2727 By the way, tests for `kconfig-hardened-check` already exist as GitHub Actions (kind of continuous integration).
2728
2729 #### <img src="https://avatars.githubusercontent.com/u/3125993?v=4" width="50">[shamilbi](https://github.com/shamilbi) commented at [2020-04-25 07:33](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/42#issuecomment-619335943):
2730
2731 > Hello @shamilbi !
2732 > Could you please describe the purpose of this PR?
2733 > By the way, tests for `kconfig-hardened-check` already exist as GitHub Actions (kind of continuous integration).
2734
2735 If files `tests/results/**/*.check` are proper results of kconfig-hardened-check applied to `kconfig_hardened_check/config_files/**/*.config` then this PR just compares output of a current kconfig_hardened_check (a current commit) with those proper results.
2736 This gives you an exact diff in output from a last commit
2737
2738 #### <img src="https://avatars.githubusercontent.com/u/3125993?v=4" width="50">[shamilbi](https://github.com/shamilbi) commented at [2020-04-25 07:43](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/42#issuecomment-619337059):
2739
2740 [My workflows file](https://github.com/shamilbi/kconfig-hardened-check/blob/master/.github/workflows/test-master.yml)
2741
2742 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-05-06 21:19](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/42#issuecomment-624897025):
2743
2744 Yes, sometimes I use ouput diff during the `kconfig-hardened-check` development.
2745 However I don't think we need to commit the output results to the repository.
2746 Thank you anyway.
2747
2748
2749 -------------------------------------------------------------------------------
2750
2751 # [\#41 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/41) `merged`: Add CONFIG_INPUT_EVBUG
2752
2753 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) opened issue at [2020-04-09 11:38](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/41):
2754
2755 Hi @a13xp0p0v,
2756
2757 The "evbug" module records key events and mouse movements in the system log.
2758 Useful for debugging, this is a security threat, its use can be hijacked as a keylogger.
2759
2760 An attacker will be able to retrieve your passwords using this module.
2761
2762 Thank you.
2763
2764 Best regards,
2765
2766 #### <img src="https://avatars.githubusercontent.com/u/8655789?u=4694f03b321aa2287d9fe05155adcddb23272e81&v=4" width="50">[codecov-io](https://github.com/codecov-io) commented at [2020-04-09 11:39](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/41#issuecomment-611482374):
2767
2768 # [Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/41?src=pr&el=h1) Report
2769 > Merging [#41](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/41?src=pr&el=desc) into [master](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/commit/100a39e2b01dadd2d27ed805cbe2b4ead7fc8b05&el=desc) will **increase** coverage by `0.01%`.
2770 > The diff coverage is `100.00%`.
2771
2772 [![Impacted file tree graph](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/41/graphs/tree.svg?width=650&height=150&src=pr&token=GOOVXMV5Kb)](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/41?src=pr&el=tree)
2773
2774 ```diff
2775 @@            Coverage Diff             @@
2776 ##           master      #41      +/-   ##
2777 ==========================================
2778 + Coverage   93.19%   93.20%   +0.01%     
2779 ==========================================
2780   Files           3        3              
2781   Lines         470      471       +1     
2782   Branches      100      100              
2783 ==========================================
2784 + Hits          438      439       +1     
2785   Misses         17       17              
2786   Partials       15       15              
2787 ```
2788
2789 | Flag | Coverage Δ | |
2790 |---|---|---|
2791 | #functional_test | `93.20% <100.00%> (+0.01%)` | :arrow_up: |
2792
2793 | [Impacted Files](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/41?src=pr&el=tree) | Coverage Δ | |
2794 |---|---|---|
2795 | [kconfig\_hardened\_check/\_\_init\_\_.py](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/41/diff?src=pr&el=tree#diff-a2NvbmZpZ19oYXJkZW5lZF9jaGVjay9fX2luaXRfXy5weQ==) | `93.27% <100.00%> (+0.01%)` | :arrow_up: |
2796
2797 ------
2798
2799 [Continue to review full report at Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/41?src=pr&el=continue).
2800 > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
2801 > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
2802 > Powered by [Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/41?src=pr&el=footer). Last update [100a39e...a7e1677](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/41?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
2803
2804
2805 -------------------------------------------------------------------------------
2806
2807 # [\#40 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/40) `merged`: pylint some code
2808
2809 #### <img src="https://avatars.githubusercontent.com/u/3125993?v=4" width="50">[shamilbi](https://github.com/shamilbi) opened issue at [2020-04-08 07:01](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/40):
2810
2811
2812
2813 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-04-09 15:35](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/40#issuecomment-611595095):
2814
2815 Thanks @shamilbi.
2816 Merged.
2817
2818
2819 -------------------------------------------------------------------------------
2820
2821 # [\#39 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/39) `closed`: VerCheck: work with 3-digit kernel versions
2822
2823 #### <img src="https://avatars.githubusercontent.com/u/3125993?v=4" width="50">[shamilbi](https://github.com/shamilbi) opened issue at [2020-04-03 15:54](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/39):
2824
2825
2826
2827 #### <img src="https://avatars.githubusercontent.com/u/8655789?u=4694f03b321aa2287d9fe05155adcddb23272e81&v=4" width="50">[codecov-io](https://github.com/codecov-io) commented at [2020-04-03 16:25](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/39#issuecomment-608535796):
2828
2829 # [Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/39?src=pr&el=h1) Report
2830 > Merging [#39](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/39?src=pr&el=desc) into [master](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/commit/bdac2c22b96b3a682801674efed92fddc8a347b0&el=desc) will **increase** coverage by `0.60%`.
2831 > The diff coverage is `76.92%`.
2832
2833 [![Impacted file tree graph](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/39/graphs/tree.svg?width=650&height=150&src=pr&token=GOOVXMV5Kb)](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/39?src=pr&el=tree)
2834
2835 ```diff
2836 @@            Coverage Diff             @@
2837 ##           master      #39      +/-   ##
2838 ==========================================
2839 + Coverage   93.10%   93.70%   +0.60%     
2840 ==========================================
2841   Files           2        2              
2842   Lines         464      461       -3     
2843   Branches      100      101       +1     
2844 ==========================================
2845   Hits          432      432              
2846 + Misses         17       15       -2     
2847 + Partials       15       14       -1     
2848 ```
2849
2850 | Flag | Coverage Δ | |
2851 |---|---|---|
2852 | #functional_test | `93.70% <76.92%> (+0.60%)` | :arrow_up: |
2853
2854 | [Impacted Files](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/39?src=pr&el=tree) | Coverage Δ | |
2855 |---|---|---|
2856 | [kconfig\_hardened\_check/\_\_init\_\_.py](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/39/diff?src=pr&el=tree#diff-a2NvbmZpZ19oYXJkZW5lZF9jaGVjay9fX2luaXRfXy5weQ==) | `93.80% <76.92%> (+0.61%)` | :arrow_up: |
2857
2858 ------
2859
2860 [Continue to review full report at Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/39?src=pr&el=continue).
2861 > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
2862 > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
2863 > Powered by [Codecov](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/39?src=pr&el=footer). Last update [bdac2c2...97b9f90](https://codecov.io/gh/a13xp0p0v/kconfig-hardened-check/pull/39?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
2864
2865 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-04-06 13:32](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/39#issuecomment-609796546):
2866
2867 Hello @shamilbi,
2868 Thanks for your work!
2869
2870 Yes, the kernel version consists of 3 numbers (not digits). 
2871 Example from the main kernel Makefile:
2872 ```
2873 VERSION = 5
2874 PATCHLEVEL = 6
2875 SUBLEVEL = 0
2876 ```
2877
2878 New features come during the merge window of a new release of the mainline kernel.
2879 It is defined by 2 numbers - `version` and `patchlevel`.
2880 More info: https://www.kernel.org/doc/html/latest/process/2.Process.html
2881 That's why currently only two numbers are checked and IMO that's enough.
2882
2883 Thanks!
2884 Alexander
2885
2886 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-04-07 15:47](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/39#issuecomment-610465555):
2887
2888 @shamilbi, could you please move pylint fixes to a separate pull request?
2889 I would like to merge it. Thanks!
2890
2891 #### <img src="https://avatars.githubusercontent.com/u/3125993?v=4" width="50">[shamilbi](https://github.com/shamilbi) commented at [2020-04-08 08:35](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/39#issuecomment-610828778):
2892
2893 > @shamilbi, could you please move pylint fixes to a separate pull request?
2894 > I would like to merge it. Thanks!
2895 OK, done
2896
2897
2898 -------------------------------------------------------------------------------
2899
2900 # [\#38 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/38) `closed`: graphics related options
2901 **Labels**: `kernel_maintainer_feedback`
2902
2903
2904 #### <img src="https://avatars.githubusercontent.com/u/5088003?v=4" width="50">[danvet](https://github.com/danvet) opened issue at [2020-04-03 08:52](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/38):
2905
2906 Discussion with dmitry yukov on twitter:
2907
2908 CONFIG_DRM_LEGACY: Really old drivers from the 90s, with unfixable by design security holes. Unfortunately userspace for one modern driver (drm/nouveau) has used until just a few years ago by accident (we didn't delete all the old legacy driver setup code), so can't remove it all completely yet from kernel sources.
2909
2910 CONFIG_FB: Old display subsystem from the 90s, essentially unmaintained for over 10 years, would need serious effort to get up to speed with modern security best practices. This even includes the minimal fbdev emulation support built on top of drm gpu drivers, since the issues are in core fbdev code.
2911
2912 CONFIG_VT: Maybe the most disputed of all, but a lot of the console drivers this exposes to userspace are also from the 90s, and without CONFIG_FB this isn't really useful even for a desktop. A hardened distro definitely wants to make sure this is not set at all.
2913
2914
2915
2916 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2020-04-03 12:03](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/38#issuecomment-608395946):
2917
2918 > You need at least one virtual terminal device in order to make use of your keyboard and monitor. Therefore, only people configuring an embedded system would want to say N here in order to save some memory; the only way to log into such a system is then via a serial or network connection.
2919
2920 Is this comment from [CONFIG_VT](https://cateee.net/lkddb/web-lkddb/VT.html) wrong then?
2921
2922 #### <img src="https://avatars.githubusercontent.com/u/5088003?v=4" width="50">[danvet](https://github.com/danvet) commented at [2020-04-03 12:32](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/38#issuecomment-608407778):
2923
2924 This comment hasn't been updated since decades (I checked historical trees ...). Nowadays Xorg and wayland compositors should be able to run without a VT. And kmscon (although abandoned due to lack of interest) can provide you a userspace implementation of VTs if you don't want to run X11 or wayland, using pseudo TTYs (like a terminal emulator).
2925
2926 A paranoid desktop distro imo should really not have VT enabled, and ofc whatever compositor they opt for (wayland, X11, or something like kmscon) needs to be walled in with a container.
2927
2928 But the comment is also correct in that without a userspace compositor you indeed will only be able to log in through the network or serial lines.
2929
2930 #### <img src="https://avatars.githubusercontent.com/u/5088003?v=4" width="50">[danvet](https://github.com/danvet) commented at [2020-04-03 12:42](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/38#issuecomment-608412082):
2931
2932 Maybe an addition: If you want multi-user switching without CONFIG_VT then you need something like systemd's logind, so that the (forced) handover of input and output devices works correctly. But the VT subsystem's only role there is as an rpc between compositors, it has 0 functionality to actually force compositors to hand over devices to the next compositor (which is what logind does, using some of the new ioctl calls added specifically for this for both input and drm subsystems).
2933
2934 So if you want actual secure multi-user switching then you should be running with all that new stuff already anyway (and then CONFIG_VT really shouldn't be enabled, to prevent creating a mess).
2935
2936 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-04-03 17:03](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/38#issuecomment-608553993):
2937
2938 Thanks @danvet !
2939 Done: https://github.com/a13xp0p0v/kconfig-hardened-check/commit/75bed5d6178375a64f93ced4795ee0cf47442df1
2940
2941 #### <img src="https://avatars.githubusercontent.com/u/5088003?v=4" width="50">[danvet](https://github.com/danvet) commented at [2020-04-03 17:24](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/38#issuecomment-608563651):
2942
2943 Thanks, looks neat. Hopefully this pushes a few more people to make this happen finally.
2944
2945 #### <img src="https://avatars.githubusercontent.com/u/1095328?u=91175c42d0de0ad8ba9f70cc6b9a41bbfbe70de8&v=4" width="50">[dvyukov](https://github.com/dvyukov) commented at [2020-04-03 17:28](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/38#issuecomment-608565745):
2946
2947 @a13xp0p0v Are these enabled in any distros for which you have canned configs?
2948
2949 @danvet I just noticed on the current upstream HEAD:
2950 ```
2951 $ rm .config
2952 $ make defconfig
2953 $ egrep "CONFIG_VT=|CONFIG_FB=" .config
2954 CONFIG_VT=y
2955 CONFIG_FB=y
2956 ```
2957 So that may be the first step :)
2958
2959 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-04-03 20:18](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/38#issuecomment-608639217):
2960
2961 @dvyukov, yes, these are enabled in many distributions:
2962 ```
2963 AOSP_Pixel3A:
2964   CONFIG_DRM_LEGACY    | is not set  |maintainer| cut_attack_surface |   OK
2965   CONFIG_FB            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
2966   CONFIG_VT            | is not set  |maintainer| cut_attack_surface |   OK
2967
2968 AmazonLinux2:
2969   CONFIG_DRM_LEGACY    | is not set  |maintainer| cut_attack_surface |   OK
2970   CONFIG_FB            | is not set  |maintainer| cut_attack_surface |   FAIL: "m"
2971   CONFIG_VT            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
2972
2973 ubuntu-bionic-generic:
2974   CONFIG_DRM_LEGACY    | is not set  |maintainer| cut_attack_surface |   OK
2975   CONFIG_FB            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
2976   CONFIG_VT            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
2977
2978 oracle-uek6:
2979   CONFIG_DRM_LEGACY    | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
2980   CONFIG_FB            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
2981   CONFIG_VT            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
2982
2983 Archlinux-hardened:
2984   CONFIG_DRM_LEGACY    | is not set  |maintainer| cut_attack_surface |   OK
2985   CONFIG_FB            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
2986   CONFIG_VT            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
2987
2988 clearlinux-master:
2989   CONFIG_DRM_LEGACY    | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
2990   CONFIG_FB            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
2991   CONFIG_VT            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
2992
2993 SLE15:
2994   CONFIG_DRM_LEGACY    | is not set  |maintainer| cut_attack_surface |   OK
2995   CONFIG_FB            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
2996   CONFIG_VT            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
2997
2998 openSUSE-15.1:
2999   CONFIG_DRM_LEGACY    | is not set  |maintainer| cut_attack_surface |   OK
3000   CONFIG_FB            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
3001   CONFIG_VT            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
3002
3003 pentoo-livecd:
3004   CONFIG_DRM_LEGACY    | is not set  |maintainer| cut_attack_surface |   OK
3005   CONFIG_FB            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
3006   CONFIG_VT            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
3007
3008 rhel-8.0:
3009   CONFIG_DRM_LEGACY    | is not set  |maintainer| cut_attack_surface |   OK
3010   CONFIG_FB            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
3011   CONFIG_VT            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
3012
3013 nixpkgs-linux_hardened:
3014   CONFIG_DRM_LEGACY    | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
3015   CONFIG_FB            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
3016   CONFIG_VT            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
3017
3018 debian-buster:
3019   CONFIG_DRM_LEGACY    | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
3020   CONFIG_FB            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
3021   CONFIG_VT            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
3022
3023 Alpinelinux-edge:
3024   CONFIG_DRM_LEGACY    | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
3025   CONFIG_FB            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
3026   CONFIG_VT            | is not set  |maintainer| cut_attack_surface |   FAIL: "y"
3027 ```
3028
3029 #### <img src="https://avatars.githubusercontent.com/u/1080275?v=4" width="50">[arndb](https://github.com/arndb) commented at [2020-04-04 09:48](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/38#issuecomment-609004574):
3030
3031 The hyperv framebuffer driver came up on the mailing list recently when I noticed a patch to add support for arm64 and suggested having it converted to DRM. Other hardware-independent drivers that don't seem to have a DRM counterpart at the moment are the UEFI framebuffer that is often used in the absence of a hardware specific driver and the goldfish driver for Android device emulation.
3032
3033 It might help to also look at each distro to see which device drivers are enabled for DRM_LEGACY and FBDEV, as there may be others that are important and need to be converted.
3034
3035 #### <img src="https://avatars.githubusercontent.com/u/5088003?v=4" width="50">[danvet](https://github.com/danvet) commented at [2020-04-04 11:12](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/38#issuecomment-609012871):
3036
3037 @dvyukov the trouble is you'll break pretty much any general purpose distro with this stuff disabled. Iirc most compositors keel over if they can't open a vt (but they should all have options to survive without one). Plus since neither kmscon nor system-consoled ever happened for real no kernel console without these, so all the whitebeards will be screaming with their pitchforks. Really not something you can do in a defconfig unfortunately.
3038
3039 @arndb yeah there was simpledrm also back around kmscon to make this happen, but it didn't. For everything else we seem to have a small community of people now pushing out drm drivers for all these things, but more is always welcome. A drm driver in less that 1kloc is fairly standard nowadays, trouble only happens if you have a strange new constraint.
3040
3041 Wrt DRM_LEGACY and FBDEV drivers in general, I get the impression that distros which enable them just enable everything, because. E.g. debian still enables DRM_LEGACY, but they long ago stopped shipping the corresponding userspace drivers. So just plain nonsense in their defconfig (and a CVE when you load drm/nouveau.ko because backwards compat)
3042
3043
3044 -------------------------------------------------------------------------------
3045
3046 # [\#37 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/37) `closed`: conflict with the latest grsecurity
3047
3048 #### <img src="https://avatars.githubusercontent.com/u/50359848?v=4" width="50">[pythonmandev](https://github.com/pythonmandev) opened issue at [2020-03-30 14:20](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/37):
3049
3050 CONFIG_REFCOUNT_FULL conflict with PAX_REFCOUNT
3051 PAGE_TABLE_ISOLATION conflict with PAX_MEMORY_UDEREF
3052 VMAP_STACK conflict with GRKERNSEC_KSTACKOVERFLOW
3053 SECURITY_YAMA conflict with GRKERNSEC
3054 RANDOMIZE_BASE also can not enable.
3055
3056 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-03-31 11:29](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/37#issuecomment-606569944):
3057
3058 Hello @pythonmandev!
3059 What do you mean saying "latest grsecurity"?
3060
3061 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2020-03-31 11:38](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/37#issuecomment-606574067):
3062
3063 its not an openly available patchset anymore hence i suggest to not take it into account. I would think differently if it would be open source, but sadly its not.
3064
3065
3066 -------------------------------------------------------------------------------
3067
3068 # [\#36 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/36) `closed`: null
3069
3070 #### <img src="(unknown)" width="50">[(unknown)]((unknown)) opened issue at [2020-03-30 14:13](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/36):
3071
3072 null
3073
3074
3075
3076
3077 -------------------------------------------------------------------------------
3078
3079 # [\#35 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/35) `closed`: can't add version check for constraints in a logical product
3080
3081 #### <img src="https://avatars.githubusercontent.com/u/785111?u=8feaa758657096dbcadcd190fbea88e371aab7be&v=4" width="50">[tych0](https://github.com/tych0) opened issue at [2020-03-26 17:44](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/35):
3082
3083 If I try to do:
3084
3085 ```
3086 diff --git a/kconfig_hardened_check/__init__.py b/kconfig_hardened_check/__init__.py
3087 index 3fcb5e0..1c31c40 100755
3088 --- a/kconfig_hardened_check/__init__.py
3089 +++ b/kconfig_hardened_check/__init__.py
3090 @@ -251,8 +251,8 @@ def construct_checklist(checklist, arch):
3091          checklist.append(OptCheck('MICROCODE',                   'y', 'defconfig', 'self_protection')) # is needed for mitigating CPU bugs
3092          checklist.append(OptCheck('RETPOLINE',                   'y', 'defconfig', 'self_protection'))
3093          checklist.append(OptCheck('X86_SMAP',                    'y', 'defconfig', 'self_protection'))
3094 -        checklist.append(OR(OptCheck('X86_UMIP',                 'y', 'defconfig', 'self_protection'), \
3095 -                            OptCheck('X86_INTEL_UMIP',           'y', 'defconfig', 'self_protection')))
3096 +        checklist.append(OR(AND(OptCheck('X86_UMIP',                 'y', 'defconfig', 'self_protection'), VerCheck((5, 5))), \
3097 +                            AND(OptCheck('X86_INTEL_UMIP',           'y', 'defconfig', 'self_protection'), VerCheck((4, 14)))))
3098          checklist.append(OptCheck('SYN_COOKIES',                 'y', 'defconfig', 'self_protection')) # another reason?
3099      if arch == 'X86_64':
3100          checklist.append(OptCheck('PAGE_TABLE_ISOLATION',        'y', 'defconfig', 'self_protection'))
3101 ```
3102
3103 I get:
3104
3105 ```
3106 Traceback (most recent call last):
3107   File "/home/tycho/.local/bin/kconfig-hardened-check", line 10, in <module>
3108     sys.exit(main())
3109   File "/home/tycho/.local/lib/python3.7/site-packages/kconfig_hardened_check/__init__.py", line 611, in main
3110     check_config_file(config_checklist, args.config, arch)
3111   File "/home/tycho/.local/lib/python3.7/site-packages/kconfig_hardened_check/__init__.py", line 554, in check_config_file
3112     perform_checks(checklist, parsed_options)
3113   File "/home/tycho/.local/lib/python3.7/site-packages/kconfig_hardened_check/__init__.py", line 519, in perform_checks
3114     o.state = parsed_options.get(o.name, None)
3115 AttributeError: can't set attribute
3116 ```
3117
3118 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-03-28 20:54](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/35#issuecomment-605518372):
3119
3120 Hello @tych0!
3121 I'm glad that you had a look at this project!
3122 How are you doing? :)
3123
3124 Yes, currently the combination of `ComplexOptCheck` objects is not supported (there have been no cases that needed it).
3125
3126 The original logic behind `X86_UMIP` check:
3127  - if `X86_UMIP` or `X86_INTEL_UMIP` is set to `y`, then `OK`;
3128  - otherwise `FAIL`.
3129
3130 What is the purpose of combining `UMIP` check with version check?
3131
3132 I designed `VerCheck` for cases like that:
3133  - if `REFCOUNT_FULL` is set to `y`, then `OK`;
3134  - if kernel version >= `5.5`, then `OK` (since `REFCOUNT_FULL` is enabled by default and dropped since v5.5);
3135  - otherwise `FAIL`.
3136
3137 N.B. There is an implicit drawback with checking kernel versions.
3138 Some kernel features are backported to previous stable kernels.
3139 That's why checking the version can give false positive or false negative result.
3140 Detailed example: https://github.com/a13xp0p0v/kconfig-hardened-check/pull/32
3141
3142 Thanks!
3143
3144 #### <img src="https://avatars.githubusercontent.com/u/785111?u=8feaa758657096dbcadcd190fbea88e371aab7be&v=4" width="50">[tych0](https://github.com/tych0) commented at [2020-03-29 14:51](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/35#issuecomment-605648635):
3145
3146 On Sat, Mar 28, 2020 at 01:55:08PM -0700, Alexander Popov wrote:
3147 > Hello @tych0!
3148 > I'm glad that you had a look at this project!
3149 > How are you doing? :)
3150
3151 Good, just hacking away :)
3152
3153 > Yes, currently the combination of `ComplexOptCheck` objects is not supported (there have been no cases that needed it).
3154
3155 > The original logic behind `X86_UMIP` check:
3156 >  - if `X86_UMIP` or `X86_INTEL_UMIP` is set to `y`, then `OK`;
3157 >  - otherwise `FAIL`.
3158
3159 > What is the purpose of combining `UMIP` check with version check?
3160
3161 It's only present in 4.15 or greater; I'm running a 4.14 kernel and
3162 kconfig-hardened-check is complaining at me :)
3163
3164 > I designed `VerCheck` for cases like that:
3165 >  - if `REFCOUNT_FULL` is set to `y`, then `OK`;
3166 >  - if kernel version >= `5.5`, then `OK` (since `REFCOUNT_FULL` is enabled by default and dropped since v5.5);
3167 >  - otherwise `FAIL`.
3168
3169 > N.B. There is an implicit drawback with checking kernel versions.
3170 > Some kernel features are backported to previous stable kernels.
3171 > That's why checking the version can give false positive or false negative result.
3172 > Detailed example: https://github.com/a13xp0p0v/kconfig-hardened-check/pull/32
3173
3174 "Not present" is also risky though, if people don't have some of the
3175 dependencies of a feature enabled. A version whitelist seems the best.
3176
3177 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-03-30 21:12](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/35#issuecomment-606252748):
3178
3179 >> What is the purpose of combining `UMIP` check with version check?
3180
3181 > It's only present in 4.15 or greater; I'm running a 4.14 kernel and kconfig-hardened-check is complaining at me :)
3182
3183 Yes, that's good. The tool inspires you to switch onto a newer kernel :)
3184
3185 > "Not present" is also risky though, if people don't have some of the
3186 dependencies of a feature enabled. 
3187
3188 You know, I haven't seen any example of such unmet dependencies. I suppose that kernel feature dependencies are resolved by Kconfig.
3189
3190 > A version whitelist seems the best.
3191
3192 I would like to avoid version checking as much as possible.
3193 Relying on kernel version brings so many troubles!
3194 For example:
3195  - sometimes new features are backported to previous stable kernels,
3196  - sometimes Linux distributions cherry-pick features into their kernels,
3197  - some Linux distributions have custom kernel versioning scheme -- look at Ubuntu or Red Hat.
3198
3199 Finally, the most important aspect.
3200 I like that kernels of different versions are checked against the same list of recommendations.
3201 Hence they can be compared using `OK/FAIL` numbers that are printed by the tool in the end:
3202 ```
3203 [+] config check is finished: 'OK' - 55 / 'FAIL' - 77
3204 ```
3205
3206 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-04-10 16:49](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/35#issuecomment-612117051):
3207
3208 @tych0 your issue reminded me the idea to create some formatted annotations, that can be used for muting checks for a particular kernel. That was discussed in #9.
3209 Thank you.
3210
3211 #### <img src="https://avatars.githubusercontent.com/u/785111?u=8feaa758657096dbcadcd190fbea88e371aab7be&v=4" width="50">[tych0](https://github.com/tych0) commented at [2020-04-10 16:55](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/35#issuecomment-612119721):
3212
3213 Sorry, I read this and forgot to respond :)
3214
3215 > Yes, that's good. The tool inspires you to switch onto a newer kernel :)
3216
3217 Yes, but switching is not so easy sometimes, because of institutional challenges. If we want to add this to our CI to check our kernel configs or something, it would be nice to exclude stuff that doesn't exist in our kernel. I can do this manually, but it would be nicer to have this knowledge baked into the script.
3218
3219 > You know, I haven't seen any example of such unmet dependencies. I suppose that kernel feature dependencies are resolved by Kconfig.
3220
3221 Consider GCC_PLUGIN_STACKLEAK; we'll report "Not present" if the user hasn't set CONFIG_GCC_PLUGINS=n, but it really should be an error.
3222
3223 #### <img src="https://avatars.githubusercontent.com/u/785111?u=8feaa758657096dbcadcd190fbea88e371aab7be&v=4" width="50">[tych0](https://github.com/tych0) commented at [2020-04-10 16:56](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/35#issuecomment-612119803):
3224
3225 Anwyay, I'll check out the updates, thanks :)
3226
3227
3228 -------------------------------------------------------------------------------
3229
3230 # [\#34 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/34) `merged`: GrapheneOS is the continuation of CopperheadOS
3231
3232 #### <img src="https://avatars.githubusercontent.com/u/50278627?v=4" width="50">[madaidan](https://github.com/madaidan) opened issue at [2020-03-22 19:44](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/34):
3233
3234 "CopperheadOS" is the project's legacy name which is now being used for a scam focused on attacking GrapheneOS, the true continuation.
3235
3236 https://twitter.com/DanielMicay/status/1171170734380654597
3237
3238 https://twitter.com/DanielMicay/status/1160831422908829696
3239
3240 https://old.reddit.com/r/CopperheadOS/comments/8qdnn3/goodbye/
3241
3242 https://github.com/yegortimoshenko/copperhead-takeover
3243
3244
3245
3246
3247 -------------------------------------------------------------------------------
3248
3249 # [\#33 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/33) `closed`: CONFIG_STATIC_USERMODEHELPER
3250
3251 #### <img src="https://avatars.githubusercontent.com/u/543852?v=4" width="50">[anthonyryan1](https://github.com/anthonyryan1) opened issue at [2020-03-20 22:25](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/33):
3252
3253 I read over the CLIP OS notes regarding this option, and they also mention that they are not currently using it in the second paragraph.
3254
3255 It seems to be that this option isn't actually helpful unless you've already got a usermode helper program?
3256
3257 Just questioning the wisdom of this option as I imagine some people will just enable everything they see here, and may wind up with this pointing at a non-existent binary.
3258
3259 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2020-03-21 10:52](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/33#issuecomment-602026415):
3260
3261 Yes, this option needs userspace support and yes, blindly enabling everything may cause harm.
3262
3263 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-03-23 15:22](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/33#issuecomment-602670488):
3264
3265 @Bernhard40, absolutely agree.
3266 N.B. There is a comment about `STATIC_USERMODEHELPER` in the source code:
3267 ```
3268 checklist.append(OptCheck('STATIC_USERMODEHELPER', 'y', 'clipos', 'self_protection')) # needs userspace support (systemd)
3269 ```
3270
3271
3272 -------------------------------------------------------------------------------
3273
3274 # [\#32 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/32) `closed`: Fix LDISC_AUTOLOAD check
3275
3276 #### <img src="https://avatars.githubusercontent.com/u/50278627?v=4" width="50">[madaidan](https://github.com/madaidan) opened issue at [2020-03-09 18:01](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/32):
3277
3278 CONFIG_LDISC_AUTOLOAD has existed since v4.14, not v5.1: https://lkml.org/lkml/2019/4/15/890
3279
3280 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-03-14 09:52](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/32#issuecomment-599034709):
3281
3282 Hello @madaidan,
3283
3284 Thanks for noticing that!
3285
3286 CONFIG_LDISC_AUTOLOAD was introduced in 5.1:
3287 changelog https://kernelnewbies.org/Linux_5.1
3288 upstream commit https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7c0cca7c847e6e019d67b7d793efbbe3b947d004
3289
3290 I checked, it was later backported to stable kernels 4.14, 4.9 and 4.4.
3291 So we can't have a correct check based on a kernel version.
3292 For example this option exists in kernel 4.4.216, but doesn't exist in 4.5.
3293
3294 I think the correct approach here is to add another type of check that can distinguish "is not set" and "not found".
3295
3296 What do you think?
3297
3298 #### <img src="https://avatars.githubusercontent.com/u/50278627?v=4" width="50">[madaidan](https://github.com/madaidan) commented at [2020-03-14 20:29](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/32#issuecomment-599131303):
3299
3300 How about a whitelist of allowed versions? So it checks for 4.4, 4.9, 4.14 or ≥5.1 but not 4.5.
3301
3302 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-03-31 11:46](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/32#issuecomment-606577240):
3303
3304 Hm, I got an idea.
3305 I'll try to create a new check that the option __exists__ in the config.
3306 So for `LDISC_AUTOLOAD` we can create a rule `(exists) AND (is not set)`.
3307
3308 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-03-31 14:13](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/32#issuecomment-606654029):
3309
3310 Done!
3311 Thanks!
3312
3313
3314 -------------------------------------------------------------------------------
3315
3316 # [\#31 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/31) `merged`: Update config files
3317
3318 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) opened issue at [2020-02-24 20:27](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/31):
3319
3320 Hi @a13xp0p0v, 
3321
3322 Here are the updates of the distributions configuration files. I also had to update some links.
3323 Please note that we now have the majority of configurations with versions >= to linux 5.3 🧙‍♂️
3324
3325 See you soon.
3326
3327 Best regards,
3328
3329 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-02-27 17:36](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/31#issuecomment-592084682):
3330
3331 Thanks, @HacKurx!
3332
3333 N.B. I'm going to work on support of new kernel releases in the near future.
3334
3335 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2020-03-04 19:09](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/31#issuecomment-594761475):
3336
3337 @a13xp0p0v, 
3338 > N.B. I'm going to work on support of new kernel releases in the near future.
3339
3340 https://kernsec.org/wiki/index.php?title=Kernel_Self_Protection_Project/Recommended_Settings&diff=4001&oldid=prev
3341
3342 :wink:
3343
3344 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-03-04 19:55](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/31#issuecomment-594797254):
3345
3346 Yes, thanks, I'm already working on that!
3347
3348
3349 -------------------------------------------------------------------------------
3350
3351 # [\#30 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/30) `closed`: Has CONFIG_REFCOUNT_FULL and VMAP_STACK been removed from Kernel-5.5 ?
3352
3353 #### <img src="https://avatars.githubusercontent.com/u/3471772?v=4" width="50">[bryn1u](https://github.com/bryn1u) opened issue at [2020-02-01 12:24](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/30):
3354
3355 Hey everyone,
3356
3357 Im trying to configure Kernel-5.5 config and i don't see CONFIG_REFCOUNT_FULL option and the same with VMAP_STACK.
3358 I use Kernel-5.3 for now and there is an option available. Soo should i think that this option is no longer available ?
3359
3360 Thanks !
3361
3362 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2020-02-02 13:05](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/30#issuecomment-581133592):
3363
3364 `CONFIG_REFCOUNT_FULL` was removed but `CONFIG_VMAP_STACK` is still available.
3365
3366 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-02-05 16:54](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/30#issuecomment-582504214):
3367
3368 Yes, `REFCOUNT_FULL` was removed...
3369 Have to find a way how to check it without false positive.
3370
3371 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2020-02-06 12:30](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/30#issuecomment-582884278):
3372
3373 @a13xp0p0v there is kernel version printed in config header, like:
3374
3375 ```
3376 #
3377 # Automatically generated file; DO NOT EDIT.
3378 # Linux/x86 5.5.2 Kernel Configuration
3379 #
3380 ```
3381
3382 maybe you can parse those?
3383
3384 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-02-06 15:25](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/30#issuecomment-582957059):
3385
3386 Yes, it looks like we have to add some limited kernel version checking...
3387
3388 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-02-06 15:29](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/30#issuecomment-582959470):
3389
3390 I may have time to work on that only after OffensiveCon.
3391 Does anybody want to prepare a pull request?
3392
3393 #### <img src="https://avatars.githubusercontent.com/u/3471772?v=4" width="50">[bryn1u](https://github.com/bryn1u) commented at [2020-02-09 13:03](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/30#issuecomment-583842999):
3394
3395 Hey,
3396
3397 Is a CONFIG_HAVE_ARCH_VMAP_STACK in Kernel-5.5.2 equivalent to
3398 CONFIG_VMAPSTACK ?
3399
3400 Thanks !
3401
3402 czw., 6 lut 2020 o 16:29 Alexander Popov <notifications@github.com>
3403 napisał(a):
3404
3405 > I may have time to work on that only after OffensiveCon.
3406 > Does anybody want to prepare a pull request?
3407 >
3408 > —
3409 > You are receiving this because you authored the thread.
3410 > Reply to this email directly, view it on GitHub
3411 > <https://github.com/a13xp0p0v/kconfig-hardened-check/issues/30?email_source=notifications&email_token=AA2PTHCFMA26NITNFRMNTU3RBQUHBA5CNFSM4KOS3L22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEK7UC3Q#issuecomment-582959470>,
3412 > or unsubscribe
3413 > <https://github.com/notifications/unsubscribe-auth/AA2PTHBA772R35Y6MYOQS6DRBQUHBANCNFSM4KOS3L2Q>
3414 > .
3415 >
3416
3417 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2020-02-10 14:32](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/30#issuecomment-584150411):
3418
3419 > Is a CONFIG_HAVE_ARCH_VMAP_STACK in Kernel-5.5.2 equivalent to
3420 > CONFIG_VMAPSTACK ?
3421
3422 No `CONFIG_HAVE_ARCH_VMAP_STACK` tells only if `VMAP_STACK` is available for specific cpu architecture. `CONFIG_VMAP_STACK` tells if `VMAP_STACK` is enabled.
3423
3424 You can check that [VMAP_STACK definitely still exist up to 5.6-rc](https://cateee.net/lkddb/web-lkddb/VMAP_STACK.html).
3425
3426 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-03-05 11:03](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/30#issuecomment-595170199):
3427
3428 Hello!
3429
3430 Worked with that issue in 0ace19012b626203d14332090cdcd40ed2237100, 918b12cf6f652ad148c885d1a802459e73d20c48 and 17c22224ac5b20c3d0ed49e7859642756e178bd9.
3431
3432 Also have a look at 61b5ca3c8f95212141284be8eb4036c8c1bda9e7: that fixes the false positive report about LDISC_AUTOLOAD for old kernels.
3433
3434
3435 -------------------------------------------------------------------------------
3436
3437 # [\#29 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/29) `closed`: Recommend PANIC_ON_OOPS
3438
3439 #### <img src="https://avatars.githubusercontent.com/u/50278627?v=4" width="50">[madaidan](https://github.com/madaidan) opened issue at [2020-01-13 21:28](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/29):
3440
3441 This causes the kernel to panic on an oops.
3442
3443 Recommended by the KSPP and CLIP OS.
3444
3445 https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project/Recommended_Settings
3446
3447 > \# Reboot devices immediately if kernel experiences an Oops.
3448 > CONFIG_PANIC_ON_OOPS=y
3449 > CONFIG_PANIC_TIMEOUT=-1
3450
3451 https://docs.clip-os.org/clipos/kernel.html
3452
3453 > CONFIG_PANIC_ON_OOPS=y
3454 > CONFIG_PANIC_TIMEOUT=-1
3455 >
3456 >    Prevent potential further exploitation of a bug by immediately panicking the kernel.
3457
3458 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-01-14 09:23](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/29#issuecomment-574081092):
3459
3460 Hello @madaidan,
3461
3462 Yes, I saw this KSPP recommendation.
3463 I personally don't support it because it provides easy denial-of-service attack for the whole system (there are a lot of BUG()'s in the kernel).
3464
3465 In my opinion having CONFIG_BUG is enough. If we have kernel oops in the process context, the offending/attacking process is killed.
3466
3467 #### <img src="https://avatars.githubusercontent.com/u/50278627?v=4" width="50">[madaidan](https://github.com/madaidan) commented at [2020-01-14 16:52](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/29#issuecomment-574269683):
3468
3469 I think the kernel exploits this can prevent are more important than DoS.
3470
3471 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-01-16 10:06](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/29#issuecomment-575078024):
3472
3473 > I think the kernel exploits this can prevent are more important than DoS.
3474
3475 Could you please give a real example of the exploit that:
3476   1. is NOT blocked by having `CONFIG_BUG=y`,
3477 and
3478   2. is blocked by having `CONFIG_PANIC_ON_OOPS=y`.
3479
3480 Thanks!
3481
3482 #### <img src="https://avatars.githubusercontent.com/u/50278627?v=4" width="50">[madaidan](https://github.com/madaidan) commented at [2020-01-16 17:30](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/29#issuecomment-575259978):
3483
3484 This is a good example since it explicitly mentions panic_on_oops: https://googleprojectzero.blogspot.com/2018/09/a-cache-invalidation-bug-in-linux.html
3485
3486 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-01-17 15:10](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/29#issuecomment-575664888):
3487
3488 > This is a good example since it explicitly mentions panic_on_oops: https://googleprojectzero.blogspot.com/2018/09/a-cache-invalidation-bug-in-linux.html
3489
3490 No, sorry, that's a wrong example.
3491
3492 In that exploit Jann Horn used the output of `WARN_ON_ONCE()`.
3493 Having `CONFIG_PANIC_ON_OOPS=y` doesn't prevent his method, since kernel continues to run after `WARN_ON_ONCE()` anyway.
3494
3495 Moreover, let me quote Jann about CONFIG_PANIC_ON_OOPS:
3496 ```
3497 It is off by default in the upstream kernel - and enabling it by default in distributions
3498 would probably be a bad idea -, but it is e.g. enabled by Android.
3499 ```
3500
3501 If some users want to enable it anyway, they can always use `kernel.panic_on_oops` sysctl or the corresponding kernel command line parameter.
3502
3503 #### <img src="https://avatars.githubusercontent.com/u/50278627?v=4" width="50">[madaidan](https://github.com/madaidan) commented at [2020-01-20 17:34](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/29#issuecomment-576372137):
3504
3505 Alright. Fair enough.
3506
3507
3508 -------------------------------------------------------------------------------
3509
3510 # [\#28 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/28) `closed`: Don't give errors about CONFIG_PAGE_POISONING when using an alternative
3511
3512 #### <img src="https://avatars.githubusercontent.com/u/50278627?v=4" width="50">[madaidan](https://github.com/madaidan) opened issue at [2020-01-09 19:36](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/28):
3513
3514 Some people use `CONFIG_INIT_ON_ALLOC_DEFAULT_ON`/`CONFIG_INIT_ON_FREE_DEFAULT_ON` or linux-hardened's `CONFIG_PAGE_SANITIZE` (for LTS kernels) instead of `CONFIG_PAGE_POISONING`. People using these alternatives will get pointless errors that may confuse them.
3515
3516 It would be better if the errors were only shown when not using these.
3517
3518 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2020-01-09 19:38](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/28#issuecomment-572720806):
3519
3520 I would love this :P
3521
3522 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-01-10 15:26](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/28#issuecomment-573079631):
3523
3524 As I remember, all these features are different in some sense.
3525 Are you sure that they are alternative to each other?
3526
3527 #### <img src="https://avatars.githubusercontent.com/u/50278627?v=4" width="50">[madaidan](https://github.com/madaidan) commented at [2020-01-10 16:40](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/28#issuecomment-573110783):
3528
3529 As far as I know, they all have the same goal which is to overwrite memory to prevent use-after-free but they have some slight differences as `PAGE_POISONING` forces debugging bloat (as it is actually a debugging feature) which makes `init_on_{,free,alloc}` or `PAGE_SANITIZE` (which was dropped in newer linux-hardened versions for `init_on_{,free,alloc}`) better.
3530
3531 `init_on_{,free,alloc}` actually disables itself when `PAGE_POISONING` is being used to prevent conflict.
3532
3533 https://github.com/torvalds/linux/commit/6471384af2a6530696fc0203bafe4de41a23c9ef
3534
3535 > If either SLUB poisoning or page poisoning is enabled, those options take
3536 precedence over init_on_alloc and init_on_free: initialization is only
3537 applied to unpoisoned allocations.
3538
3539 Also notice that linux-hardened and ClipOS do not enable `PAGE_POISONING` but use the others instead.
3540
3541 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-01-14 10:28](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/28#issuecomment-574108331):
3542
3543 @madaidan, thanks for the details.
3544 So yes, `PAGE_POISONING` is a debugging feature.
3545 It provides less erasing than `INIT_ON_FREE_DEFAULT_ON`.
3546
3547 I joined these checks with OR giving preference to `INIT_ON_FREE_DEFAULT_ON`.
3548 Please see the linked commit.
3549
3550 #### <img src="https://avatars.githubusercontent.com/u/50278627?v=4" width="50">[madaidan](https://github.com/madaidan) commented at [2020-01-14 16:55](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/28#issuecomment-574271418):
3551
3552 Great, thanks.
3553
3554
3555 -------------------------------------------------------------------------------
3556
3557 # [\#27 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27) `closed`: add nix build files
3558
3559 #### <img src="https://avatars.githubusercontent.com/u/96200?u=9ed15c85825694d00e996d605d728179b830c4fa&v=4" width="50">[Mic92](https://github.com/Mic92) opened issue at [2020-01-02 09:02](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27):
3560
3561
3562
3563 #### <img src="https://avatars.githubusercontent.com/u/96200?u=9ed15c85825694d00e996d605d728179b830c4fa&v=4" width="50">[Mic92](https://github.com/Mic92) commented at [2020-01-02 10:44](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27#issuecomment-570172617):
3564
3565 These are all possible kernel configurations:
3566 There might be duplicate since linux-latest is basically linux-5.4.
3567 I am not sure which configuration you want to include in this repository.
3568 Maybe _hardened, _latest and the default kernel.
3569
3570 [nixpkgs-linux_latest-libre-config.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/4015570/nixpkgs-linux_latest-libre-config.txt)
3571 [nixpkgs-linux_latest_hardened-config.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/4015571/nixpkgs-linux_latest_hardened-config.txt)
3572 [nixpkgs-linux_testing_hardened-config.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/4015572/nixpkgs-linux_testing_hardened-config.txt)
3573 [nixpkgs-linux_hardened-config.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/4015573/nixpkgs-linux_hardened-config.txt)
3574 [nixpkgs-linux_latest-config.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/4015574/nixpkgs-linux_latest-config.txt)
3575 [nixpkgs-linux_testing_bcachefs-config.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/4015575/nixpkgs-linux_testing_bcachefs-config.txt)
3576 [nixpkgs-linux_testing-config.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/4015576/nixpkgs-linux_testing-config.txt)
3577 [nixpkgs-linux_5_4-config.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/4015577/nixpkgs-linux_5_4-config.txt)
3578 [nixpkgs-linux_5_3-config.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/4015578/nixpkgs-linux_5_3-config.txt)
3579 [nixpkgs-linux_4_9-config.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/4015579/nixpkgs-linux_4_9-config.txt)
3580 [nixpkgs-linux_4_14-config.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/4015580/nixpkgs-linux_4_14-config.txt)
3581 [nixpkgs-linux_4_4-config.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/4015581/nixpkgs-linux_4_4-config.txt)
3582 [nixpkgs-linux_4_19-config.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/4015582/nixpkgs-linux_4_19-config.txt)
3583 [nixpkgs-linux_mptcp_94-config.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/4015583/nixpkgs-linux_mptcp_94-config.txt)
3584 [nixpkgs-linux_mptcp_95-config.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/4015584/nixpkgs-linux_mptcp_95-config.txt)
3585 [nixpkgs-linux_mptcp-config.txt](https://github.com/a13xp0p0v/kconfig-hardened-check/files/4015585/nixpkgs-linux_mptcp-config.txt)
3586
3587 #### <img src="https://avatars.githubusercontent.com/u/96200?u=9ed15c85825694d00e996d605d728179b830c4fa&v=4" width="50">[Mic92](https://github.com/Mic92) commented at [2020-01-02 10:47](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27#issuecomment-570173237):
3588
3589 This is the output for our hardened kernel:
3590 cc @joachifm (hardened maintainer)
3591
3592 ```
3593 [+] Trying to detect architecture in "kconfig/nixpkgs-linux_hardened-config.txt"...
3594 [+] Detected architecture: X86_64
3595 [+] Checking "kconfig/nixpkgs-linux_hardened-config.txt" against hardening preferences...
3596                  option name                 | desired val | decision |       reason       |   check result
3597 =========================================================================================================================
3598 CONFIG_BUG                                   |      y      |defconfig |  self_protection   |   OK
3599 CONFIG_STRICT_KERNEL_RWX                     |      y      |defconfig |  self_protection   |   OK
3600 CONFIG_STACKPROTECTOR_STRONG                 |      y      |defconfig |  self_protection   |   OK
3601 CONFIG_SLUB_DEBUG                            |      y      |defconfig |  self_protection   |   OK
3602 CONFIG_STRICT_MODULE_RWX                     |      y      |defconfig |  self_protection   |   OK
3603 CONFIG_MICROCODE                             |      y      |defconfig |  self_protection   |   OK
3604 CONFIG_RETPOLINE                             |      y      |defconfig |  self_protection   |   OK
3605 CONFIG_X86_SMAP                              |      y      |defconfig |  self_protection   |   OK
3606 CONFIG_X86_UMIP                              |      y      |defconfig |  self_protection   |   OK: CONFIG_X86_INTEL_UMIP "y"
3607 CONFIG_IOMMU_SUPPORT                         |      y      |defconfig |  self_protection   |   OK
3608 CONFIG_SYN_COOKIES                           |      y      |defconfig |  self_protection   |   OK
3609 CONFIG_PAGE_TABLE_ISOLATION                  |      y      |defconfig |  self_protection   |   OK
3610 CONFIG_RANDOMIZE_MEMORY                      |      y      |defconfig |  self_protection   |   OK
3611 CONFIG_INTEL_IOMMU                           |      y      |defconfig |  self_protection   |   OK
3612 CONFIG_AMD_IOMMU                             |      y      |defconfig |  self_protection   |   OK
3613 CONFIG_VMAP_STACK                            |      y      |defconfig |  self_protection   |   OK
3614 CONFIG_RANDOMIZE_BASE                        |      y      |defconfig |  self_protection   |   OK
3615 CONFIG_THREAD_INFO_IN_TASK                   |      y      |defconfig |  self_protection   |   OK
3616 CONFIG_BUG_ON_DATA_CORRUPTION                |      y      |   kspp   |  self_protection   |   OK
3617 CONFIG_DEBUG_WX                              |      y      |   kspp   |  self_protection   |   OK
3618 CONFIG_SCHED_STACK_END_CHECK                 |      y      |   kspp   |  self_protection   |   OK
3619 CONFIG_SLAB_FREELIST_HARDENED                |      y      |   kspp   |  self_protection   |   OK
3620 CONFIG_SLAB_FREELIST_RANDOM                  |      y      |   kspp   |  self_protection   |   OK
3621 CONFIG_SHUFFLE_PAGE_ALLOCATOR                |      y      |   kspp   |  self_protection   |   FAIL: not found
3622 CONFIG_FORTIFY_SOURCE                        |      y      |   kspp   |  self_protection   |   OK
3623 CONFIG_GCC_PLUGINS                           |      y      |   kspp   |  self_protection   |   OK
3624 CONFIG_GCC_PLUGIN_RANDSTRUCT                 |      y      |   kspp   |  self_protection   |   OK
3625 CONFIG_GCC_PLUGIN_LATENT_ENTROPY             |      y      |   kspp   |  self_protection   |   OK
3626 CONFIG_DEBUG_LIST                            |      y      |   kspp   |  self_protection   |   OK
3627 CONFIG_DEBUG_SG                              |      y      |   kspp   |  self_protection   |   OK
3628 CONFIG_DEBUG_CREDENTIALS                     |      y      |   kspp   |  self_protection   |   OK
3629 CONFIG_DEBUG_NOTIFIERS                       |      y      |   kspp   |  self_protection   |   OK
3630 CONFIG_PAGE_POISONING                        |      y      |   kspp   |  self_protection   |   OK
3631 CONFIG_HARDENED_USERCOPY                     |      y      |   kspp   |  self_protection   |   OK
3632 CONFIG_HARDENED_USERCOPY_FALLBACK            | is not set  |   kspp   |  self_protection   |   OK
3633 CONFIG_MODULE_SIG                            |      y      |   kspp   |  self_protection   |   FAIL: "is not set"
3634 CONFIG_MODULE_SIG_ALL                        |      y      |   kspp   |  self_protection   |   FAIL: not found
3635 CONFIG_MODULE_SIG_SHA512                     |      y      |   kspp   |  self_protection   |   FAIL: not found
3636 CONFIG_MODULE_SIG_FORCE                      |      y      |   kspp   |  self_protection   |   FAIL: not found
3637 CONFIG_DEFAULT_MMAP_MIN_ADDR                 |    65536    |   kspp   |  self_protection   |   OK
3638 CONFIG_REFCOUNT_FULL                         |      y      |   kspp   |  self_protection   |   OK
3639 CONFIG_INIT_STACK_ALL                        |      y      |  clipos  |  self_protection   |   OK: CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL "y"
3640 CONFIG_INIT_ON_ALLOC_DEFAULT_ON              |      y      |  clipos  |  self_protection   |   FAIL: not found
3641 CONFIG_INIT_ON_FREE_DEFAULT_ON               |      y      |  clipos  |  self_protection   |   FAIL: not found
3642 CONFIG_SECURITY_DMESG_RESTRICT               |      y      |  clipos  |  self_protection   |   FAIL: "is not set"
3643 CONFIG_DEBUG_VIRTUAL                         |      y      |  clipos  |  self_protection   |   FAIL: "is not set"
3644 CONFIG_STATIC_USERMODEHELPER                 |      y      |  clipos  |  self_protection   |   FAIL: "is not set"
3645 CONFIG_SLAB_MERGE_DEFAULT                    | is not set  |  clipos  |  self_protection   |   FAIL: "y"
3646 CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE     | is not set  |  clipos  |  self_protection   |   FAIL: "y"
3647 CONFIG_GCC_PLUGIN_STACKLEAK                  |      y      |  clipos  |  self_protection   |   FAIL: not found
3648 CONFIG_STACKLEAK_METRICS                     | is not set  |  clipos  |  self_protection   |   FAIL: CONFIG_GCC_PLUGIN_STACKLEAK is needed
3649 CONFIG_STACKLEAK_RUNTIME_DISABLE             | is not set  |  clipos  |  self_protection   |   FAIL: CONFIG_GCC_PLUGIN_STACKLEAK is needed
3650 CONFIG_RANDOM_TRUST_CPU                      | is not set  |  clipos  |  self_protection   |   OK
3651 CONFIG_INTEL_IOMMU_SVM                       |      y      |  clipos  |  self_protection   |   FAIL: "is not set"
3652 CONFIG_INTEL_IOMMU_DEFAULT_ON                |      y      |  clipos  |  self_protection   |   FAIL: "is not set"
3653 CONFIG_SLUB_DEBUG_ON                         |      y      |    my    |  self_protection   |   FAIL: "is not set"
3654 CONFIG_RESET_ATTACK_MITIGATION               |      y      |    my    |  self_protection   |   FAIL: "is not set"
3655 CONFIG_PAGE_POISONING_NO_SANITY              | is not set  |    my    |  self_protection   |   FAIL: "y"
3656 CONFIG_PAGE_POISONING_ZERO                   | is not set  |    my    |  self_protection   |   FAIL: "y"
3657 CONFIG_AMD_IOMMU_V2                          |      y      |    my    |  self_protection   |   FAIL: "m"
3658 CONFIG_SECURITY                              |      y      |defconfig |  security_policy   |   OK
3659 CONFIG_SECURITY_YAMA                         |      y      |   kspp   |  security_policy   |   OK
3660 CONFIG_SECURITY_LOADPIN                      |      y      |    my    |  security_policy   |   FAIL: "is not set"
3661 CONFIG_SECURITY_LOCKDOWN_LSM                 |      y      |    my    |  security_policy   |   FAIL: not found
3662 CONFIG_SECURITY_LOCKDOWN_LSM_EARLY           |      y      |    my    |  security_policy   |   FAIL: not found
3663 CONFIG_LOCK_DOWN_KERNEL_FORCE_CONFIDENTIALITY|      y      |    my    |  security_policy   |   FAIL: not found
3664 CONFIG_SECCOMP                               |      y      |defconfig | cut_attack_surface |   OK
3665 CONFIG_SECCOMP_FILTER                        |      y      |defconfig | cut_attack_surface |   OK
3666 CONFIG_STRICT_DEVMEM                         |      y      |defconfig | cut_attack_surface |   OK
3667 CONFIG_MODULES                               | is not set  |   kspp   | cut_attack_surface |   FAIL: "y"
3668 CONFIG_DEVMEM                                | is not set  |   kspp   | cut_attack_surface |   FAIL: "y"
3669 CONFIG_IO_STRICT_DEVMEM                      |      y      |   kspp   | cut_attack_surface |   OK
3670 CONFIG_ACPI_CUSTOM_METHOD                    | is not set  |   kspp   | cut_attack_surface |   OK
3671 CONFIG_COMPAT_BRK                            | is not set  |   kspp   | cut_attack_surface |   OK
3672 CONFIG_DEVKMEM                               | is not set  |   kspp   | cut_attack_surface |   OK
3673 CONFIG_COMPAT_VDSO                           | is not set  |   kspp   | cut_attack_surface |   OK: not found
3674 CONFIG_BINFMT_MISC                           | is not set  |   kspp   | cut_attack_surface |   FAIL: "y"
3675 CONFIG_INET_DIAG                             | is not set  |   kspp   | cut_attack_surface |   FAIL: "y"
3676 CONFIG_KEXEC                                 | is not set  |   kspp   | cut_attack_surface |   FAIL: "y"
3677 CONFIG_PROC_KCORE                            | is not set  |   kspp   | cut_attack_surface |   OK
3678 CONFIG_LEGACY_PTYS                           | is not set  |   kspp   | cut_attack_surface |   OK
3679 CONFIG_HIBERNATION                           | is not set  |   kspp   | cut_attack_surface |   FAIL: "y"
3680 CONFIG_LEGACY_VSYSCALL_NONE                  |      y      |   kspp   | cut_attack_surface |   OK
3681 CONFIG_IA32_EMULATION                        | is not set  |   kspp   | cut_attack_surface |   OK
3682 CONFIG_X86_X32                               | is not set  |   kspp   | cut_attack_surface |   OK
3683 CONFIG_MODIFY_LDT_SYSCALL                    | is not set  |   kspp   | cut_attack_surface |   FAIL: "y"
3684 CONFIG_X86_PTDUMP                            | is not set  |grsecurity| cut_attack_surface |   FAIL: "m"
3685 CONFIG_ZSMALLOC_STAT                         | is not set  |grsecurity| cut_attack_surface |   OK
3686 CONFIG_PAGE_OWNER                            | is not set  |grsecurity| cut_attack_surface |   OK
3687 CONFIG_DEBUG_KMEMLEAK                        | is not set  |grsecurity| cut_attack_surface |   OK
3688 CONFIG_BINFMT_AOUT                           | is not set  |grsecurity| cut_attack_surface |   OK: not found
3689 CONFIG_KPROBES                               | is not set  |grsecurity| cut_attack_surface |   FAIL: "y"
3690 CONFIG_UPROBES                               | is not set  |grsecurity| cut_attack_surface |   FAIL: "y"
3691 CONFIG_GENERIC_TRACER                        | is not set  |grsecurity| cut_attack_surface |   FAIL: "y"
3692 CONFIG_PROC_VMCORE                           | is not set  |grsecurity| cut_attack_surface |   OK: not found
3693 CONFIG_PROC_PAGE_MONITOR                     | is not set  |grsecurity| cut_attack_surface |   FAIL: "y"
3694 CONFIG_USELIB                                | is not set  |grsecurity| cut_attack_surface |   FAIL: "y"
3695 CONFIG_CHECKPOINT_RESTORE                    | is not set  |grsecurity| cut_attack_surface |   OK
3696 CONFIG_USERFAULTFD                           | is not set  |grsecurity| cut_attack_surface |   FAIL: "y"
3697 CONFIG_HWPOISON_INJECT                       | is not set  |grsecurity| cut_attack_surface |   OK: not found
3698 CONFIG_MEM_SOFT_DIRTY                        | is not set  |grsecurity| cut_attack_surface |   OK: not found
3699 CONFIG_DEVPORT                               | is not set  |grsecurity| cut_attack_surface |   FAIL: "y"
3700 CONFIG_DEBUG_FS                              | is not set  |grsecurity| cut_attack_surface |   FAIL: "y"
3701 CONFIG_NOTIFIER_ERROR_INJECTION              | is not set  |grsecurity| cut_attack_surface |   OK
3702 CONFIG_ACPI_TABLE_UPGRADE                    | is not set  | lockdown | cut_attack_surface |   FAIL: "y"
3703 CONFIG_ACPI_APEI_EINJ                        | is not set  | lockdown | cut_attack_surface |   OK: not found
3704 CONFIG_PROFILING                             | is not set  | lockdown | cut_attack_surface |   FAIL: "y"
3705 CONFIG_BPF_SYSCALL                           | is not set  | lockdown | cut_attack_surface |   FAIL: "y"
3706 CONFIG_MMIOTRACE_TEST                        | is not set  | lockdown | cut_attack_surface |   OK: not found
3707 CONFIG_KSM                                   | is not set  |  clipos  | cut_attack_surface |   FAIL: "y"
3708 CONFIG_KALLSYMS                              | is not set  |  clipos  | cut_attack_surface |   FAIL: "y"
3709 CONFIG_X86_VSYSCALL_EMULATION                | is not set  |  clipos  | cut_attack_surface |   FAIL: "y"
3710 CONFIG_MAGIC_SYSRQ                           | is not set  |  clipos  | cut_attack_surface |   FAIL: "y"
3711 CONFIG_KEXEC_FILE                            | is not set  |  clipos  | cut_attack_surface |   FAIL: "y"
3712 CONFIG_USER_NS                               | is not set  |  clipos  | cut_attack_surface |   FAIL: "y"
3713 CONFIG_LDISC_AUTOLOAD                        | is not set  |  clipos  | cut_attack_surface |   FAIL: "y"
3714 CONFIG_MMIOTRACE                             | is not set  |    my    | cut_attack_surface |   OK
3715 CONFIG_LIVEPATCH                             | is not set  |    my    | cut_attack_surface |   OK: not found
3716 CONFIG_IP_DCCP                               | is not set  |    my    | cut_attack_surface |   FAIL: "m"
3717 CONFIG_IP_SCTP                               | is not set  |    my    | cut_attack_surface |   FAIL: "m"
3718 CONFIG_FTRACE                                | is not set  |    my    | cut_attack_surface |   FAIL: "y"
3719 CONFIG_BPF_JIT                               | is not set  |    my    | cut_attack_surface |   FAIL: "y"
3720 CONFIG_ARCH_MMAP_RND_BITS                    |     32      |  clipos  |userspace_hardening |   FAIL: "28"
3721
3722 [+] config check is finished: 'OK' - 66 / 'FAIL' - 57
3723 ```
3724
3725 #### <img src="https://avatars.githubusercontent.com/u/96200?u=9ed15c85825694d00e996d605d728179b830c4fa&v=4" width="50">[Mic92](https://github.com/Mic92) commented at [2020-01-02 10:51](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27#issuecomment-570174082):
3726
3727 cc @fpletz @andir @flokli @nequissimus regarding security/kernel maintenance.
3728
3729 #### <img src="https://avatars.githubusercontent.com/u/628342?u=948c2401c073b8097e8ec160019140fb6043f266&v=4" width="50">[NeQuissimus](https://github.com/NeQuissimus) commented at [2020-01-02 16:07](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27#issuecomment-570253840):
3730
3731 There is no (official) open source grsecurity for recent kernels. But for the other options, I'd be interested in a discussion in the nixpkgs repo.
3732
3733 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-01-02 23:11](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27#issuecomment-570392431):
3734
3735 Hello @Mic92,
3736
3737 > I am not sure which configuration you want to include in this repository.
3738 > Maybe _hardened, _latest and the default kernel.
3739
3740 I would like to have only the default and hardened config for NixOS.
3741 That's useful for a brief comparison of kernel hardening adoption by various Linux distributions.
3742 By the way, we don't have a goal to collect all the latest configs from all the distributions.
3743 @HacKurx updates them from time to time.
3744
3745 Hello @NeQuissimus,
3746
3747 > There is no (official) open source grsecurity for recent kernels. 
3748
3749 Yes.
3750 And do you mean that there is an unofficial grsecurity patch for recent kernels available in public?
3751
3752 > But for the other options, I'd be interested in a discussion in the nixpkgs repo.
3753
3754 I would be glad to join that discussion.
3755 I've accumulated some knowledge about the vanilla kernel hardening.
3756 Please see my Linux Kernel Defence Map https://github.com/a13xp0p0v/linux-kernel-defence-map.
3757 It shows the the relationships between:
3758  - Vulnerability classes,
3759  - Exploitation techniques,
3760  - Bug detection mechanisms,
3761  - Defense technologies.
3762
3763 It could be useful for making a decision about enabling kernel hardening config options.
3764
3765 @Mic92 @fpletz @andir @flokli @NeQuissimus,
3766 Does NixOS have a documentation describing the difference between its hardened and default kernels?
3767
3768 Thanks!
3769
3770 #### <img src="https://avatars.githubusercontent.com/u/628342?u=948c2401c073b8097e8ec160019140fb6043f266&v=4" width="50">[NeQuissimus](https://github.com/NeQuissimus) commented at [2020-01-03 00:29](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27#issuecomment-570414239):
3771
3772 I was thinking of minipli but I guess those are only for 4.9.
3773
3774 I opened NixOS/nixpkgs#76850, which links to the kernel flags we set for the standard kernel builds and for the hardened one.
3775 Unfortunately I do not think there is good documentation.
3776
3777 #### <img src="https://avatars.githubusercontent.com/u/96200?u=9ed15c85825694d00e996d605d728179b830c4fa&v=4" width="50">[Mic92](https://github.com/Mic92) commented at [2020-01-03 08:37](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27#issuecomment-570503332):
3778
3779 > Hello @Mic92,
3780
3781 > > I am not sure which configuration you want to include in this repository.
3782 > > Maybe _hardened, _latest and the default kernel.
3783
3784 > I would like to have only the default and hardened config for NixOS.
3785 > That's useful for a brief comparison of kernel hardening adoption by various Linux distributions.
3786 > By the way, we don't have a goal to collect all the latest configs from all the distributions.
3787 > @HacKurx updates them from time to time.
3788
3789 Fair enough I think the other changes that are actually part of this pull request should be still useful though.
3790
3791 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-01-10 14:12](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27#issuecomment-573050822):
3792
3793 > Fair enough I think the other changes that are actually part of this pull request should be still useful though.
3794
3795 Hi @Mic92,
3796 Could you have a look at my comments for your PR https://github.com/a13xp0p0v/kconfig-hardened-check/pull/26 ?
3797 I need some clarifications to be able to integrate your work.
3798 Thanks!
3799
3800 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2020-02-24 20:57](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27#issuecomment-590544879):
3801
3802 Hi,
3803
3804 I haven't tested NixOS yet, is there a quick and easy way to retrieve the kernel configuration or it's only dynamically generated?
3805 I only find this but without config files:
3806 https://hydra.nixos.org/job/nixos/release-19.09/nixpkgs.linuxPackages_latest_hardened.kernel.x86_64-linux
3807
3808 Beside the point, I'm not a fan of that :
3809 https://github.com/NixOS/nixpkgs/commit/1b9bf8fa7559d1bbf030f3fe3513d25eada65a41
3810
3811 #### <img src="https://avatars.githubusercontent.com/u/96200?u=9ed15c85825694d00e996d605d728179b830c4fa&v=4" width="50">[Mic92](https://github.com/Mic92) commented at [2020-02-25 09:26](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27#issuecomment-590768293):
3812
3813 @HacKurx It's generated by nix code. Can you explain why a RANDSTRUCT read from /dev/random is better than a checksum over the linux kernel tarball? From my understanding, once that a package is build, one could extract the seed from the build. In that way reproducible builds would give us other properties i.e. verifying a correct build.
3814
3815 #### <img src="https://avatars.githubusercontent.com/u/41977?u=ba54c9de3752a1aa05a462e38bd6e84bdc26a2bb&v=4" width="50">[joachifm](https://github.com/joachifm) commented at [2020-02-25 17:26](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27#issuecomment-590976475):
3816
3817 @Mic92 I agree with you. I think it's fair to say that any compile-time randomization is rendered (nearly) pointless by publishing the image.  In our case, the value is likely to change whenever source/config changes, so might be considered "better" than a static seed value (whether it makes any real difference is another matter).  I think users who really care about this type of mitigation should build their own kernel with a custom seed (support for this was added in a later patch, iirc).
3818
3819 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2020-02-25 21:10](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27#issuecomment-591070826):
3820
3821 @Mic92, @joachifm,
3822 The person who recompile a kernel from your source should have another seed (not your) for more security.
3823 It seems preferable to me of change the SEED variable every time you update the nix kernel. Use a compilation based of a date or the kernel number for example.
3824
3825 #### <img src="https://avatars.githubusercontent.com/u/41977?u=ba54c9de3752a1aa05a462e38bd6e84bdc26a2bb&v=4" width="50">[joachifm](https://github.com/joachifm) commented at [2020-02-25 22:20](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27#issuecomment-591100811):
3826
3827 @HacKurx note that `${src}` in the snippet you linked above expands to a string that contains both the checksum of the linux source tarball and the version number: it is certain to change in case of version bumps.  
3828
3829 I wouldn't mind including more information in the seed construction to further increase the likelihood that it will differ between builds, but whatever is added needs to preserve determinism (in the sense that same inputs give same output).  
3830
3831 Reproducibility is a key goal for Nix/NixPkgs and usually overrides other concerns.  In this case, I think giving users of the prebuilt image a weak(ened) variant of the mitigation while making it easy to supply a custom seed is a more than fair tradeoff, especially given that the full benefit of this type of mitigation can only be realized with a self-built package anyway.
3832
3833 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-03-27 19:45](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27#issuecomment-605284899):
3834
3835 Hello @Mic92!
3836 I installed Nix on a Debian machine to test your scripts.
3837 Unfortunately I have to revert the commit that adds `contrib/get-nix-kconfig.py`.
3838 This script is corrupted (has unexpected symbols).
3839 It also has numerous troubles with Python 3.5.3.
3840
3841 #### <img src="https://avatars.githubusercontent.com/u/96200?u=9ed15c85825694d00e996d605d728179b830c4fa&v=4" width="50">[Mic92](https://github.com/Mic92) commented at [2020-03-27 19:52](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27#issuecomment-605287211):
3842
3843 @a13xp0p0v just add:
3844
3845 ```
3846 #! /usr/bin/env nix-shell
3847 #! nix-shell -i python3
3848 ```
3849
3850 as a shebang. Nixpkgs has python3.6 and the script depends nix anyway.
3851 It is not corrupted but depends on python3.6 or newer.
3852
3853 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-03-27 20:27](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27#issuecomment-605300321):
3854
3855 Thanks for prompt reply!
3856 1. I perform:
3857 ```
3858 $ nix-shell
3859 ```
3860 2. Then I change the shebang as you described and run the script:
3861 ```
3862 [nix-shell:~/kconfig-hardened-check/contrib]$ ./get-nix-kconfig.py 
3863 error: getting status of '/home/x/kconfig-hardened-check/contrib/default.nix': No such file or directory
3864 ```
3865 3. Finally this makes it work:
3866 ```
3867 [nix-shell:~/kconfig-hardened-check/contrib]$ python3 get-nix-kconfig.py 
3868 ```
3869 I got kernel configs and added hardened one to the collection: 4768e21b33fa9663114eb30c2b2c2cf9e6cf4721
3870
3871 Thanks!
3872
3873 #### <img src="https://avatars.githubusercontent.com/u/96200?u=9ed15c85825694d00e996d605d728179b830c4fa&v=4" width="50">[Mic92](https://github.com/Mic92) commented at [2020-03-28 03:18](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/27#issuecomment-605387095):
3874
3875 My mistake it should have been:
3876
3877 ```
3878 #! /usr/bin/env nix-shell
3879 #! nix-shell -i python3 -p python3
3880 ```
3881
3882
3883 -------------------------------------------------------------------------------
3884
3885 # [\#26 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/26) `closed`: enable distribution via pip/setuptools
3886
3887 #### <img src="https://avatars.githubusercontent.com/u/96200?u=9ed15c85825694d00e996d605d728179b830c4fa&v=4" width="50">[Mic92](https://github.com/Mic92) opened issue at [2020-01-02 09:01](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/26):
3888
3889
3890
3891 #### <img src="https://avatars.githubusercontent.com/u/96200?u=9ed15c85825694d00e996d605d728179b830c4fa&v=4" width="50">[Mic92](https://github.com/Mic92) commented at [2020-02-25 09:34](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/26#issuecomment-590771724):
3892
3893 > Hi Jörg,
3894 > Thanks a lot for your work.
3895 > I'm not familiar with setuptools, but it looks to me that integrating that is a good idea.
3896 > There are a few aspects that I would like to fix before merging.
3897
3898 >     1. Can we avoid creating the `kconfig_hardened_check` directory? I would rather have `bin` and `config_files`.
3899
3900
3901 No one needs a distinct module to put the python code in to avoid conflicts with other installed python packages.
3902
3903 >     2. What is the purpose of splitting the code onto `bin/kconfig_hardened_check` and `kconfig_hardened_check/__init__.py`? Is it some special python feng-shui? (I'm asking because I'm just a kernel developer)
3904
3905
3906 `bin/kconfig_hardened_check` is for people just checking out the repository and running the script without installing it. If you install it with `setuptools`,
3907 it will generate its own wrapper that will eventually load `kconfig_hardened_check/__init__.py`.
3908
3909 >     3. I would like to split setuptools integration and the code refactoring onto separate commits. Moreover, I don't understand the `List[Any]` changes.
3910
3911 `List[Any]` is a type annotation. When you use a typechecker like mypy you can typecheck your code that way.
3912
3913
3914 >     4. Are you sure that the classifiers in `setup.cfg` are correct? It looks like some of them don't fit this project.
3915
3916
3917
3918 >     5. The `package_data` in `setup.cfg` misses some files in the repository. Is it ok?
3919
3920 It should only contain files that are supposed to be installed. I am not even sure having those config files provides any benefit for a user of the tool.
3921 Let me know and I would not include them at all.
3922
3923
3924
3925 > Thanks!
3926
3927 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-03-26 13:20](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/26#issuecomment-604427052):
3928
3929 Hello @Mic92,
3930 I carefully reimplemented your proof-of-concept in a set of separate commits.
3931 Fixed mistakes in setup.cfg, added MANIFEST.in, fixed issues with global variables.
3932 Thank you very much, I learned a lot!
3933
3934
3935 -------------------------------------------------------------------------------
3936
3937 # [\#25 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/25) `closed`: Hardened Kernel Config File for Virtual Machines (VMs) ("cloud kernel")
3938
3939 #### <img src="https://avatars.githubusercontent.com/u/1985040?u=b84e7065f9f8d62fbff9ac468a0cf0757718ed77&v=4" width="50">[adrelanos](https://github.com/adrelanos) opened issue at [2019-12-28 20:35](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/25):
3940
3941 A kernel config specialized for better security inside virtual machines is in development.
3942
3943 The development preview version can be found here:
3944 https://github.com/Whonix/hardened-kernel/blob/master/usr/share/hardened-kernel/hardened-vm-kernel
3945
3946 This work is being done by @madaidan who also contributed pull requests to [linux-hardened](https://github.com/anthraxx/linux-hardened).
3947
3948 https://github.com/anthraxx/linux-hardened/pulls?utf8=%E2%9C%93&q=author%3Amadaidan
3949
3950 Discussions about the kernel config happen mostly in Whonix forums.
3951
3952 https://forums.whonix.org/t/kernel-recompilation-for-better-hardening/7598/214
3953
3954 The hardened kernel config was contributed by @madaidan to the @Whonix project but as the maintainer of Whonix I think that it is not the most suitable project to maintain a kernel config. It would be more impactful and would get more eyes on it if it was hosted here.
3955
3956 Therefore I am wondering if there is any chance you would accept a pull request for a hardened (VM) config file? Which folder would be suitable for such a config file?
3957
3958 @madaidan is also working on a hardened bare metal (i.e. non-VM) kernel config:
3959 https://github.com/Whonix/hardened-kernel/blob/master/usr/share/hardened-kernel/hardened-host-kernel
3960
3961 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-01-02 23:27](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/25#issuecomment-570397241):
3962
3963 Hello @adrelanos,
3964 I guess Whonix has a default and hardened config, am I right?
3965 Is the difference between them documented anywhere?
3966 We can take Whonix official configs to the `config_files/distros/`.
3967 That's useful for a brief comparison of kernel hardening adoption by various Linux distributions.
3968 There is also the `config_files/links.txt` file that describes how to get official configs from various distros.
3969 Thanks!
3970
3971 #### <img src="https://avatars.githubusercontent.com/u/50278627?v=4" width="50">[madaidan](https://github.com/madaidan) commented at [2020-01-05 17:22](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/25#issuecomment-570930694):
3972
3973 The current Whonix default is the Debian default. It will be changed to the config mentioned in the post once it's finished.
3974
3975 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2020-01-10 15:20](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/25#issuecomment-573077384):
3976
3977 Ok.
3978 So when it is finished, you are welcome to send me the pull request that
3979  - adds the official Whonix hardened config to `config_files/distros/`;
3980  - adds the corresponding info to `config_files/links.txt`.
3981
3982 #### <img src="https://avatars.githubusercontent.com/u/42802201?v=4" width="50">[tsautereau-anssi](https://github.com/tsautereau-anssi) commented at [2020-01-13 15:59](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/25#issuecomment-573735007):
3983
3984 @madaidan After reading your [post](https://github.com/anthraxx/linux-hardened/issues/21) on the linux-hardened repository, it seems you might be interested in contributing some of your changes to the [CLIP OS kernel](https://github.com/clipos/src_external_linux/) (see our current configuration [here](https://github.com/clipos/src_platform_config-linux-hardware/tree/master/kernel_config)). If so, don't hesitate to [open an issue](https://github.com/clipos/bugs), it would be much appreciated!
3985
3986 Thanks @msalaun-anssi for the heads-up ;)
3987
3988 #### <img src="https://avatars.githubusercontent.com/u/1985040?u=b84e7065f9f8d62fbff9ac468a0cf0757718ed77&v=4" width="50">[adrelanos](https://github.com/adrelanos) commented at [2020-01-13 16:25](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/25#issuecomment-573747860):
3989
3990 Created https://github.com/clipos/bugs/issues/38 for it.
3991
3992 #### <img src="https://avatars.githubusercontent.com/u/50278627?v=4" width="50">[madaidan](https://github.com/madaidan) commented at [2020-01-13 18:15](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/25#issuecomment-573797636):
3993
3994 > @madaidan After reading your post on the linux-hardened repository, it seems you might be interested in contributing some of your changes to the CLIP OS kernel (see our current configuration here). If so, don't hesitate to open an issue, it would be much appreciated!
3995
3996 Sounds great. I'll see what I can do.
3997
3998
3999 -------------------------------------------------------------------------------
4000
4001 # [\#24 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/24) `closed`: Create debian-buster.config
4002
4003 #### <img src="https://avatars.githubusercontent.com/u/89727?v=4" width="50">[alexandernst](https://github.com/alexandernst) opened issue at [2019-08-27 23:19](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/24):
4004
4005 ```
4006 [+] Trying to detect architecture in "../linux-source-4.19/.config"...
4007 [+] Detected architecture: X86_64
4008 [+] Checking "../linux-source-4.19/.config" against hardening preferences...
4009               option name               | desired val | decision |       reason       ||        check result
4010 ====================================================================================================================
4011 CONFIG_BUG                              |      y      |defconfig |  self_protection   ||             OK
4012 CONFIG_STRICT_KERNEL_RWX                |      y      |defconfig |  self_protection   ||             OK
4013 CONFIG_STACKPROTECTOR_STRONG            |      y      |defconfig |  self_protection   ||             OK
4014 CONFIG_SLUB_DEBUG                       |      y      |defconfig |  self_protection   ||             OK
4015 CONFIG_STRICT_MODULE_RWX                |      y      |defconfig |  self_protection   ||             OK
4016 CONFIG_PAGE_TABLE_ISOLATION             |      y      |defconfig |  self_protection   ||             OK
4017 CONFIG_RANDOMIZE_MEMORY                 |      y      |defconfig |  self_protection   ||             OK
4018 CONFIG_RANDOMIZE_BASE                   |      y      |defconfig |  self_protection   ||             OK
4019 CONFIG_RETPOLINE                        |      y      |defconfig |  self_protection   ||             OK
4020 CONFIG_X86_SMAP                         |      y      |defconfig |  self_protection   ||             OK
4021 CONFIG_X86_INTEL_UMIP                   |      y      |defconfig |  self_protection   ||             OK
4022 CONFIG_SYN_COOKIES                      |      y      |defconfig |  self_protection   ||             OK
4023 CONFIG_VMAP_STACK                       |      y      |defconfig |  self_protection   ||             OK
4024 CONFIG_THREAD_INFO_IN_TASK              |      y      |defconfig |  self_protection   ||             OK
4025 CONFIG_BUG_ON_DATA_CORRUPTION           |      y      |   kspp   |  self_protection   ||             OK
4026 CONFIG_DEBUG_WX                         |      y      |   kspp   |  self_protection   ||             OK
4027 CONFIG_SCHED_STACK_END_CHECK            |      y      |   kspp   |  self_protection   ||             OK
4028 CONFIG_SLAB_FREELIST_HARDENED           |      y      |   kspp   |  self_protection   ||             OK
4029 CONFIG_SLAB_FREELIST_RANDOM             |      y      |   kspp   |  self_protection   ||             OK
4030 CONFIG_SHUFFLE_PAGE_ALLOCATOR           |      y      |   kspp   |  self_protection   ||      FAIL: not found
4031 CONFIG_FORTIFY_SOURCE                   |      y      |   kspp   |  self_protection   ||             OK
4032 CONFIG_GCC_PLUGINS                      |      y      |   kspp   |  self_protection   ||      FAIL: not found
4033 CONFIG_GCC_PLUGIN_RANDSTRUCT            |      y      |   kspp   |  self_protection   ||      FAIL: not found
4034 CONFIG_GCC_PLUGIN_LATENT_ENTROPY        |      y      |   kspp   |  self_protection   ||      FAIL: not found
4035 CONFIG_DEBUG_LIST                       |      y      |   kspp   |  self_protection   ||             OK
4036 CONFIG_DEBUG_SG                         |      y      |   kspp   |  self_protection   ||     FAIL: "is not set"
4037 CONFIG_DEBUG_CREDENTIALS                |      y      |   kspp   |  self_protection   ||     FAIL: "is not set"
4038 CONFIG_DEBUG_NOTIFIERS                  |      y      |   kspp   |  self_protection   ||     FAIL: "is not set"
4039 CONFIG_PAGE_POISONING                   |      y      |   kspp   |  self_protection   ||             OK
4040 CONFIG_HARDENED_USERCOPY                |      y      |   kspp   |  self_protection   ||             OK
4041 CONFIG_HARDENED_USERCOPY_FALLBACK       | is not set  |   kspp   |  self_protection   ||             OK
4042 CONFIG_MODULE_SIG                       |      y      |   kspp   |  self_protection   ||     FAIL: "is not set"
4043 CONFIG_MODULE_SIG_ALL                   |      y      |   kspp   |  self_protection   ||      FAIL: not found
4044 CONFIG_MODULE_SIG_SHA512                |      y      |   kspp   |  self_protection   ||      FAIL: not found
4045 CONFIG_MODULE_SIG_FORCE                 |      y      |   kspp   |  self_protection   ||      FAIL: not found
4046 CONFIG_DEFAULT_MMAP_MIN_ADDR            |    65536    |   kspp   |  self_protection   ||             OK
4047 CONFIG_REFCOUNT_FULL                    |      y      |   kspp   |  self_protection   ||             OK
4048 CONFIG_LOCK_DOWN_KERNEL                 |      y      |  clipos  |  self_protection   ||             OK
4049 CONFIG_SECURITY_DMESG_RESTRICT          |      y      |  clipos  |  self_protection   ||             OK
4050 CONFIG_DEBUG_VIRTUAL                    |      y      |  clipos  |  self_protection   ||     FAIL: "is not set"
4051 CONFIG_STATIC_USERMODEHELPER            |      y      |  clipos  |  self_protection   ||     FAIL: "is not set"
4052 CONFIG_SLAB_MERGE_DEFAULT               | is not set  |  clipos  |  self_protection   ||         FAIL: "y"
4053 CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE| is not set  |  clipos  |  self_protection   ||FAIL: CONFIG_GCC_PLUGIN_RANDSTRUCT is needed
4054 CONFIG_GCC_PLUGIN_STACKLEAK             |      y      |  clipos  |  self_protection   ||      FAIL: not found
4055 CONFIG_STACKLEAK_METRICS                | is not set  |  clipos  |  self_protection   ||FAIL: CONFIG_GCC_PLUGIN_STACKLEAK is needed
4056 CONFIG_STACKLEAK_RUNTIME_DISABLE        | is not set  |  clipos  |  self_protection   ||FAIL: CONFIG_GCC_PLUGIN_STACKLEAK is needed
4057 CONFIG_RANDOM_TRUST_CPU                 | is not set  |  clipos  |  self_protection   ||         FAIL: "y"
4058 CONFIG_MICROCODE                        |      y      |  clipos  |  self_protection   ||             OK
4059 CONFIG_IOMMU_SUPPORT                    |      y      |  clipos  |  self_protection   ||             OK
4060 CONFIG_INTEL_IOMMU                      |      y      |  clipos  |  self_protection   ||             OK
4061 CONFIG_INTEL_IOMMU_SVM                  |      y      |  clipos  |  self_protection   ||             OK
4062 CONFIG_INTEL_IOMMU_DEFAULT_ON           |      y      |  clipos  |  self_protection   ||     FAIL: "is not set"
4063 CONFIG_INIT_STACK_ALL                   |      y      |    my    |  self_protection   ||      FAIL: not found
4064 CONFIG_SLUB_DEBUG_ON                    |      y      |    my    |  self_protection   ||     FAIL: "is not set"
4065 CONFIG_SECURITY_LOADPIN                 |      y      |    my    |  self_protection   ||     FAIL: "is not set"
4066 CONFIG_RESET_ATTACK_MITIGATION          |      y      |    my    |  self_protection   ||     FAIL: "is not set"
4067 CONFIG_PAGE_POISONING_NO_SANITY         | is not set  |    my    |  self_protection   ||         FAIL: "y"
4068 CONFIG_PAGE_POISONING_ZERO              | is not set  |    my    |  self_protection   ||             OK
4069 CONFIG_AMD_IOMMU                        |      y      |    my    |  self_protection   ||             OK
4070 CONFIG_AMD_IOMMU_V2                     |      y      |    my    |  self_protection   ||             OK
4071 CONFIG_SECURITY                         |      y      |defconfig |  security_policy   ||             OK
4072 CONFIG_SECURITY_YAMA                    |      y      |   kspp   |  security_policy   ||             OK
4073 CONFIG_SECCOMP                          |      y      |defconfig | cut_attack_surface ||             OK
4074 CONFIG_SECCOMP_FILTER                   |      y      |defconfig | cut_attack_surface ||             OK
4075 CONFIG_STRICT_DEVMEM                    |      y      |defconfig | cut_attack_surface ||             OK
4076 CONFIG_MODULES                          | is not set  |   kspp   | cut_attack_surface ||         FAIL: "y"
4077 CONFIG_DEVMEM                           | is not set  |   kspp   | cut_attack_surface ||         FAIL: "y"
4078 CONFIG_IO_STRICT_DEVMEM                 |      y      |   kspp   | cut_attack_surface ||             OK
4079 CONFIG_ACPI_CUSTOM_METHOD               | is not set  |   kspp   | cut_attack_surface ||             OK
4080 CONFIG_COMPAT_BRK                       | is not set  |   kspp   | cut_attack_surface ||             OK
4081 CONFIG_DEVKMEM                          | is not set  |   kspp   | cut_attack_surface ||             OK
4082 CONFIG_COMPAT_VDSO                      | is not set  |   kspp   | cut_attack_surface ||             OK
4083 CONFIG_BINFMT_MISC                      | is not set  |   kspp   | cut_attack_surface ||             OK
4084 CONFIG_INET_DIAG                        | is not set  |   kspp   | cut_attack_surface ||             OK
4085 CONFIG_KEXEC                            | is not set  |   kspp   | cut_attack_surface ||         FAIL: "y"
4086 CONFIG_PROC_KCORE                       | is not set  |   kspp   | cut_attack_surface ||         FAIL: "y"
4087 CONFIG_LEGACY_PTYS                      | is not set  |   kspp   | cut_attack_surface ||             OK
4088 CONFIG_HIBERNATION                      | is not set  |   kspp   | cut_attack_surface ||         FAIL: "y"
4089 CONFIG_LEGACY_VSYSCALL_NONE             |      y      |   kspp   | cut_attack_surface ||             OK
4090 CONFIG_IA32_EMULATION                   | is not set  |   kspp   | cut_attack_surface ||         FAIL: "y"
4091 CONFIG_X86_X32                          | is not set  |   kspp   | cut_attack_surface ||         FAIL: "y"
4092 CONFIG_MODIFY_LDT_SYSCALL               | is not set  |   kspp   | cut_attack_surface ||         FAIL: "y"
4093 CONFIG_X86_PTDUMP                       | is not set  |grsecurity| cut_attack_surface ||             OK
4094 CONFIG_ZSMALLOC_STAT                    | is not set  |grsecurity| cut_attack_surface ||       OK: not found
4095 CONFIG_PAGE_OWNER                       | is not set  |grsecurity| cut_attack_surface ||             OK
4096 CONFIG_DEBUG_KMEMLEAK                   | is not set  |grsecurity| cut_attack_surface ||             OK
4097 CONFIG_BINFMT_AOUT                      | is not set  |grsecurity| cut_attack_surface ||       OK: not found
4098 CONFIG_KPROBES                          | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"
4099 CONFIG_UPROBES                          | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"
4100 CONFIG_GENERIC_TRACER                   | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"
4101 CONFIG_PROC_VMCORE                      | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"
4102 CONFIG_PROC_PAGE_MONITOR                | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"
4103 CONFIG_USELIB                           | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"
4104 CONFIG_CHECKPOINT_RESTORE               | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"
4105 CONFIG_USERFAULTFD                      | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"
4106 CONFIG_HWPOISON_INJECT                  | is not set  |grsecurity| cut_attack_surface ||             OK
4107 CONFIG_MEM_SOFT_DIRTY                   | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"
4108 CONFIG_DEVPORT                          | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"
4109 CONFIG_DEBUG_FS                         | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"
4110 CONFIG_NOTIFIER_ERROR_INJECTION         | is not set  |grsecurity| cut_attack_surface ||             OK
4111 CONFIG_ACPI_TABLE_UPGRADE               | is not set  | lockdown | cut_attack_surface ||         FAIL: "y"
4112 CONFIG_ACPI_APEI_EINJ                   | is not set  | lockdown | cut_attack_surface ||             OK
4113 CONFIG_PROFILING                        | is not set  | lockdown | cut_attack_surface ||         FAIL: "y"
4114 CONFIG_BPF_SYSCALL                      | is not set  | lockdown | cut_attack_surface ||         FAIL: "y"
4115 CONFIG_MMIOTRACE_TEST                   | is not set  | lockdown | cut_attack_surface ||             OK
4116 CONFIG_KSM                              | is not set  |  clipos  | cut_attack_surface ||         FAIL: "y"
4117 CONFIG_IKCONFIG                         | is not set  |  clipos  | cut_attack_surface ||         FAIL: "m"
4118 CONFIG_KALLSYMS                         | is not set  |  clipos  | cut_attack_surface ||         FAIL: "y"
4119 CONFIG_X86_VSYSCALL_EMULATION           | is not set  |  clipos  | cut_attack_surface ||         FAIL: "y"
4120 CONFIG_MAGIC_SYSRQ                      | is not set  |  clipos  | cut_attack_surface ||         FAIL: "y"
4121 CONFIG_KEXEC_FILE                       | is not set  |  clipos  | cut_attack_surface ||         FAIL: "y"
4122 CONFIG_USER_NS                          | is not set  |  clipos  | cut_attack_surface ||         FAIL: "y"
4123 CONFIG_LDISC_AUTOLOAD                   | is not set  |  clipos  | cut_attack_surface ||         FAIL: "y"
4124 CONFIG_MMIOTRACE                        | is not set  |    my    | cut_attack_surface ||         FAIL: "y"
4125 CONFIG_LIVEPATCH                        | is not set  |    my    | cut_attack_surface ||         FAIL: "y"
4126 CONFIG_IP_DCCP                          | is not set  |    my    | cut_attack_surface ||             OK
4127 CONFIG_IP_SCTP                          | is not set  |    my    | cut_attack_surface ||             OK
4128 CONFIG_FTRACE                           | is not set  |    my    | cut_attack_surface ||         FAIL: "y"
4129 CONFIG_BPF_JIT                          | is not set  |    my    | cut_attack_surface ||         FAIL: "y"
4130 CONFIG_ARCH_MMAP_RND_BITS               |     32      |  clipos  |userspace_protection||         FAIL: "28"
4131
4132 [+] config check is finished: 'OK' - 60 / 'FAIL' - 60
4133 ```
4134
4135 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-08-30 12:40](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/24#issuecomment-526586258):
4136
4137 Hello @alexandernst,
4138
4139 Thanks for your PR.
4140
4141 I decided to compare the your config with one available here:
4142 https://packages.debian.org/buster/linux-image-4.19.0-5-amd64
4143
4144 They differ a lot.
4145 Where did you get your config?
4146
4147 Best regards,
4148 Alexander
4149
4150 #### <img src="https://avatars.githubusercontent.com/u/89727?v=4" width="50">[alexandernst](https://github.com/alexandernst) commented at [2019-08-30 12:56](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/24#issuecomment-526591340):
4151
4152 The config file was generated using the instructions in https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-building
4153
4154 ```
4155 apt install -y linux-source fakeroot libelf-dev libssl-dev
4156 tar xaf /usr/src/linux-source-4.19.tar.xz
4157 cd linux-source-4.19/
4158 yes "" | make localmodconfig
4159 scripts/config --disable MODULE_SIG
4160 ```
4161
4162 #### <img src="https://avatars.githubusercontent.com/u/89727?v=4" width="50">[alexandernst](https://github.com/alexandernst) commented at [2019-08-30 12:58](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/24#issuecomment-526591989):
4163
4164 Oh, this was built using an AWS EC2 instance, so that might be causing the differences between a vainilla debian config and my config.
4165
4166 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-08-30 13:07](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/24#issuecomment-526595179):
4167
4168 Right, let me quote the kernel documentation:
4169 ```
4170 "make localmodconfig" Create a config based on current config and loaded modules (lsmod).
4171 ```
4172 https://www.kernel.org/doc/html/latest/admin-guide/README.html?highlight=localmodconfig
4173
4174 Would you like to fix your PR?
4175 If so I would also ask to add info to `config_files/links.txt`.
4176
4177 Thanks!
4178
4179 #### <img src="https://avatars.githubusercontent.com/u/89727?v=4" width="50">[alexandernst](https://github.com/alexandernst) commented at [2019-08-30 13:38](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/24#issuecomment-526605210):
4180
4181 I'm not really sure if by "fix" you mean rename the file to something like `debian-buster-aws.config` or by replace the config with the one from https://packages.debian.org/buster/linux-image-4.19.0-5-amd64 ?
4182
4183 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-08-30 13:44](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/24#issuecomment-526607017):
4184
4185 I think adding an original Debian config would be more useful for everyone.
4186 Also it would be nice if you find a direct link to this config and add it to `links.txt`.
4187
4188 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-11-28 07:36](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/24#issuecomment-559376496):
4189
4190 Closing the PR (I've finally did it myself: ad80700, 4f9c653).
4191 Thanks.
4192
4193
4194 -------------------------------------------------------------------------------
4195
4196 # [\#23 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/23) `closed`: LOCK_DOWN_KERNEL 
4197
4198 #### <img src="https://avatars.githubusercontent.com/u/11277437?v=4" width="50">[rubeecube](https://github.com/rubeecube) opened issue at [2019-07-22 12:05](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/23):
4199
4200 Hello,
4201
4202 Thank you for this awesome project!
4203
4204 It seems that "LOCK_DOWN_KERNEL" / "LOCK_DOWN MANDATORY" enable other flags.
4205
4206 - No unsigned modules and no modules for which can't validate the signature.
4207 - No use of ioperm(), iopl() and no writing to /dev/port.
4208 - No writing to /dev/mem or /dev/kmem.
4209 - No hibernation.
4210 - Restrict PCI BAR access.
4211 - Restrict MSR access.
4212 - No kexec_load().
4213 - Certain ACPI restrictions.
4214 - Restrict debugfs interface to ASUS WMI.
4215
4216 http://lkml.iu.edu/hypermail/linux/kernel/1704.0/02933.html 
4217
4218 Is it possible to reflect this in the script?
4219
4220 #### <img src="https://avatars.githubusercontent.com/u/67428?u=cc677701e49dca0be4cdc6ea10bc60b52a181e4e&v=4" width="50">[jelly](https://github.com/jelly) commented at [2019-07-22 12:18](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/23#issuecomment-513767366):
4221
4222 The kernel lockdown patch has not been merged yet and I'm not sure if it's possible to enable these hardening functionality without the patch.
4223
4224 Also the linked patch is out of a date, there is a newer revision implemented as LSM https://lore.kernel.org/linux-security-module/20190404003249.14356-1-matthewgarrett@google.com/T/#m50dd383459d65d52d80c90f36af860a7c10f364c
4225
4226 #### <img src="https://avatars.githubusercontent.com/u/11277437?v=4" width="50">[rubeecube](https://github.com/rubeecube) commented at [2019-07-22 12:27](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/23#issuecomment-513770393):
4227
4228 Ok, I'm new to this and didn't know that.
4229 Thanks
4230
4231 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2019-07-23 12:15](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/23#issuecomment-514184160):
4232
4233 Some distros like Fedora or Ubuntu are using lockdown kernel patches for a long time.
4234
4235 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-08-12 08:27](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/23#issuecomment-520338183):
4236
4237 Hello everyone!
4238
4239 @bokobok, some time ago I looked through the lockdown patchset in Ubuntu kernel tree.
4240 I marked the kernel options enforced by lockdown with a special comment in the script:
4241 ```
4242 # refers to LOCK_DOWN_KERNEL
4243 ```
4244 For more details please see https://github.com/a13xp0p0v/kconfig-hardened-check/commit/796a22935ab5cd3ddcf19c4ea85411d9bf04fef6
4245
4246 When the lockdown patchset is finally merged, I will look through the commits once again and update the script.
4247
4248 @jelly @Bernhard40, thanks for your commentary.
4249
4250 #### <img src="https://avatars.githubusercontent.com/u/67428?u=cc677701e49dca0be4cdc6ea10bc60b52a181e4e&v=4" width="50">[jelly](https://github.com/jelly) commented at [2019-08-12 18:27](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/23#issuecomment-520540892):
4251
4252 It's getting close to mainline http://kernsec.org/pipermail/linux-security-module-archive/2019-August/015795.html
4253
4254
4255 -------------------------------------------------------------------------------
4256
4257 # [\#22 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/22) `merged`: #20 fix: use right quotes in json output
4258
4259 #### <img src="https://avatars.githubusercontent.com/u/4029800?u=86702d3f2d50ee01ef1c572ef26b1ea1318f28da&v=4" width="50">[adrianopol](https://github.com/adrianopol) opened issue at [2019-07-07 19:27](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/22):
4260
4261 #20: fix quotes for --json
4262
4263
4264
4265
4266 -------------------------------------------------------------------------------
4267
4268 # [\#21 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/21) `merged`: add --json option
4269
4270 #### <img src="https://avatars.githubusercontent.com/u/4029800?u=86702d3f2d50ee01ef1c572ef26b1ea1318f28da&v=4" width="50">[adrianopol](https://github.com/adrianopol) opened issue at [2019-06-21 19:57](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/21):
4271
4272 With `--json` output will be formatted as array of arrays:
4273
4274 `[['CONFIG_BUG', 'y', 'defconfig', 'self_protection', 'OK'], ['CONFIG_STRICT_KERNEL_RWX', 'y', 'defconfig', 'self_protection', 'OK'], ...`
4275
4276 #### <img src="https://avatars.githubusercontent.com/u/4029800?u=86702d3f2d50ee01ef1c572ef26b1ea1318f28da&v=4" width="50">[adrianopol](https://github.com/adrianopol) commented at [2019-06-24 09:24](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/21#issuecomment-504931635):
4277
4278 Fixed.
4279
4280 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-06-24 11:11](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/21#issuecomment-504965369):
4281
4282 Thank you!
4283 Merged.
4284
4285
4286 -------------------------------------------------------------------------------
4287
4288 # [\#20 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/20) `closed`: JSON output
4289
4290 #### <img src="https://avatars.githubusercontent.com/u/964610?u=f244bab6b14967638a88cef92752379e64b15996&v=4" width="50">[Wenzel](https://github.com/Wenzel) opened issue at [2019-06-10 14:11](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/20):
4291
4292 Hi,
4293
4294 I would like to integrate your project into a Python script which would check the security settings automatically and provide a report.
4295
4296 Would it be possible to have an easily parsable JSON output ?
4297 Otherwise processing with your data will be very difficult, if you are not human.
4298
4299 Thanks !
4300
4301 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-06-11 10:03](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/20#issuecomment-500775436):
4302
4303 Hello @Wenzel 
4304
4305 > I would like tot integrate your project into a Python script which would check the security settings automatically and provide a report.
4306
4307 Nice!
4308
4309 > Would it be possible to have an easily parsable JSON output ?
4310 Otherwise processing with your data will be very difficult, if you are not human.
4311
4312 It sounds reasonable. I'll have a look in my free time.
4313 If you already know how to implement it, the pull request is welcome!
4314
4315 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-06-24 11:12](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/20#issuecomment-504965591):
4316
4317 Hello @Wenzel and @nettrino,
4318
4319 @adrianopol has added the JSON output feature (#21), please check the `--json` argument.
4320
4321 #### <img src="https://avatars.githubusercontent.com/u/964610?u=f244bab6b14967638a88cef92752379e64b15996&v=4" width="50">[Wenzel](https://github.com/Wenzel) commented at [2019-07-07 12:51](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/20#issuecomment-508997348):
4322
4323 Hi @a13xp0p0v , @adrianopol ,
4324
4325 I would like to reopen this issue because I just tested the `--json` flag, and the output produced is not valid JSON.
4326
4327 `piping in jq`
4328 ![Screenshot_20190707_144843](https://user-images.githubusercontent.com/964610/60768633-84977d00-a0c6-11e9-978a-ebbb65e9ed11.png)
4329
4330
4331 Output example for `./kconfig-hardened-check.py -c /boot/config-5.1.12-300.fc30.x86_64 --json`
4332 ~~~
4333 [['CONFIG_BUG', 'y', 'defconfig', 'self_protection', 'OK'], ['CONFIG_STRICT_KERNEL_RWX', 'y', 'defconfig', 'self_protection', 'OK'], ['CONFIG_STACKPROTECTOR_STRONG', 'y', 'defconfig', 'self_protection', 'OK'], ['CONFIG_SLUB_DEBUG', 'y', 'defconfig', 'self_protection', 'OK'], ['CONFIG_STRICT_MODULE_RWX', 'y', 'defconfig', 'self_protection', 'OK'], ['CONFIG_PAGE_TABLE_ISOLATION', 'y', 'defconfig', 'self_protection', 'OK'], ['CONFIG_RANDOMIZE_MEMORY', 'y', 'defconfig', 'self_protection', 'OK'], ['CONFIG_RANDOMIZE_BASE', 'y', 'defconfig', 'self_protection', 'OK'], ['CONFIG_RETPOLINE', 'y', 'defconfig', 'self_protection', 'OK'], ['CONFIG_X86_SMAP', 'y', 'defconfig', 'self_protection', 'OK'], ['CONFIG_X86_INTEL_UMIP', 'y', 'defconfig', 'self_protection', 'OK'], ['CONFIG_SYN_COOKIES', 'y', 'defconfig', 'self_protection', 'OK'], ['CONFIG_VMAP_STACK', 'y', 'defconfig', 'self_protection', 'OK'], ['CONFIG_THREAD_INFO_IN_TASK', 'y', 'defconfig', 'self_protection', 'OK'], ['CONFIG_BUG_ON_DATA_CORRUPTION', 'y', 'kspp', 'self_protection', 'OK'], ['CONFIG_DEBUG_WX', 'y', 'kspp', 'self_protection', 'OK'], ['CONFIG_SCHED_STACK_END_CHECK', 'y', 'kspp', 'self_protection', 'FAIL: "is not set"'], ['CONFIG_SLAB_FREELIST_HARDENED', 'y', 'kspp', 'self_protection', 'OK'], ['CONFIG_SLAB_FREELIST_RANDOM', 'y', 'kspp', 'self_protection', 'OK'], ['CONFIG_FORTIFY_SOURCE', 'y', 'kspp', 'self_protection', 'OK'], ['CONFIG_GCC_PLUGINS', 'y', 'kspp', 'self_protection', 'FAIL: not found'], ['CONFIG_GCC_PLUGIN_RANDSTRUCT', 'y', 'kspp', 'self_protection', 'FAIL: not found'], ['CONFIG_GCC_PLUGIN_STRUCTLEAK', 'y', 'kspp', 'self_protection', 'FAIL: not found'], ['CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL', 'y', 'kspp', 'self_protection', 'FAIL: not found'], ['CONFIG_GCC_PLUGIN_LATENT_ENTROPY', 'y', 'kspp', 'self_protection', 'FAIL: not found'], ['CONFIG_DEBUG_LIST', 'y', 'kspp', 'self_protection', 'OK'], ['CONFIG_DEBUG_SG', 'y', 'kspp', 'self_protection', 'FAIL: "is not set"'], ['CONFIG_DEBUG_CREDENTIALS', 'y', 'kspp', 'self_protection', 'FAIL: "is not set"'], ['CONFIG_DEBUG_NOTIFIERS', 'y', 'kspp', 'self_protection', 'FAIL: "is not set"'], ['CONFIG_PAGE_POISONING', 'y', 'kspp', 'self_protection', 'FAIL: "is not set"'], ['CONFIG_HARDENED_USERCOPY', 'y', 'kspp', 'self_protection', 'OK'], ['CONFIG_HARDENED_USERCOPY_FALLBACK', 'is not set', 'kspp', 'self_protection', 'FAIL: "y"'], ['CONFIG_MODULE_SIG', 'y', 'kspp', 'self_protection', 'OK'], ['CONFIG_MODULE_SIG_ALL', 'y', 'kspp', 'self_protection', 'OK'], ['CONFIG_MODULE_SIG_SHA512', 'y', 'kspp', 'self_protection', 'FAIL: "is not set"'], ['CONFIG_MODULE_SIG_FORCE', 'y', 'kspp', 'self_protection', 'FAIL: "is not set"'], ['CONFIG_DEFAULT_MMAP_MIN_ADDR', '65536', 'kspp', 'self_protection', 'OK'], ['CONFIG_REFCOUNT_FULL', 'y', 'kspp', 'self_protection', 'FAIL: "is not set"'], ['CONFIG_LOCK_DOWN_KERNEL', 'y', 'clipos', 'self_protection', 'OK'], ['CONFIG_SECURITY_DMESG_RESTRICT', 'y', 'clipos', 'self_protection', 'FAIL: "is not set"'], ['CONFIG_DEBUG_VIRTUAL', 'y', 'clipos', 'self_protection', 'FAIL: "is not set"'], ['CONFIG_STATIC_USERMODEHELPER', 'y', 'clipos', 'self_protection', 'FAIL: "is not set"'], ['CONFIG_SLAB_MERGE_DEFAULT', 'is not set', 'clipos', 'self_protection', 'FAIL: "y"'], ['CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE', 'is not set', 'clipos', 'self_protection', 'FAIL: CONFIG_GCC_PLUGIN_RANDSTRUCT is needed'], ['CONFIG_GCC_PLUGIN_STACKLEAK', 'y', 'clipos', 'self_protection', 'FAIL: not found'], ['CONFIG_STACKLEAK_METRICS', 'is not set', 'clipos', 'self_protection', 'FAIL: CONFIG_GCC_PLUGIN_STACKLEAK is needed'], ['CONFIG_STACKLEAK_RUNTIME_DISABLE', 'is not set', 'clipos', 'self_protection', 'FAIL: CONFIG_GCC_PLUGIN_STACKLEAK is needed'], ['CONFIG_RANDOM_TRUST_CPU', 'is not set', 'clipos', 'self_protection', 'FAIL: "y"'], ['CONFIG_MICROCODE', 'y', 'clipos', 'self_protection', 'OK'], ['CONFIG_IOMMU_SUPPORT', 'y', 'clipos', 'self_protection', 'OK'], ['CONFIG_INTEL_IOMMU', 'y', 'clipos', 'self_protection', 'OK'], ['CONFIG_INTEL_IOMMU_SVM', 'y', 'clipos', 'self_protection', 'OK'], ['CONFIG_INTEL_IOMMU_DEFAULT_ON', '
4334 y', 'clipos', 'self_protection', 'FAIL: "is not set"'], ['CONFIG_AMD_IOMMU', 'y', 'my', 'self_protection', 'OK'], ['CONFIG_AMD_IOMMU_V2', 'y', 'my', 'self_protection', 'FAIL: "m"'], ['CONFIG_SLUB_DEBUG_ON', 'y', 'my', 'self_protection', 'FAIL: "is not set"'], ['CONFIG_SECURITY_LOADPIN', 'y', 'my', 'self_protection', 'FAIL: "is not set"'], ['CONFIG_RESET_ATTACK_MITIGATION', 'y', 'my', 'self_protection', 'FAIL: "is not set"'], ['CONFIG_PAGE_POISONING_NO_SANITY', 'is not set', 'my', 'self_protection', 'FAIL: CONFIG_PAGE_POISONING is needed'], ['CONFIG_PAGE_POISONING_ZERO', 'is not set', 'my', 'self_protection', 'FAIL: CONFIG_PAGE_POISONING is needed'], ['CONFIG_SECURITY', 'y', 'defconfig', 'security_policy', 'OK'], ['CONFIG_SECURITY_YAMA', 'y', 'kspp', 'security_policy', 'OK'], ['CONFIG_SECCOMP', 'y', 'defconfig', 'cut_attack_surface', 'OK'], ['CONFIG_SECCOMP_FILTER', 'y', 'defconfig', 'cut_attack_surface', 'OK'], ['CONFIG_STRICT_DEVMEM', 'y', 'defconfig', 'cut_attack_surface', 'OK'], ['CONFIG_MODULES', 'is not set', 'kspp', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_DEVMEM', 'is not set', 'kspp', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_IO_STRICT_DEVMEM', 'y', 'kspp', 'cut_attack_surface', 'OK'], ['CONFIG_ACPI_CUSTOM_METHOD', 'is not set', 'kspp', 'cut_attack_surface', 'FAIL: "m"'], ['CONFIG_COMPAT_BRK', 'is not set', 'kspp', 'cut_attack_surface', 'OK'], ['CONFIG_DEVKMEM', 'is not set', 'kspp', 'cut_attack_surface', 'OK'], ['CONFIG_COMPAT_VDSO', 'is not set', 'kspp', 'cut_attack_surface', 'OK'], ['CONFIG_BINFMT_MISC', 'is not set', 'kspp', 'cut_attack_surface', 'FAIL: "m"'], ['CONFIG_INET_DIAG', 'is not set', 'kspp', 'cut_attack_surface', 'FAIL: "m"'], ['CONFIG_KEXEC', 'is not set', 'kspp', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_PROC_KCORE', 'is not set', 'kspp', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_LEGACY_PTYS', 'is not set', 'kspp', 'cut_attack_surface', 'OK'], ['CONFIG_HIBERNATION', 'is not set', 'kspp', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_LEGACY_VSYSCALL_NONE', 'y', 'kspp', 'cut_attack_surface', 'FAIL: "is not set"'], ['CONFIG_IA32_EMULATION', 'is not set', 'kspp', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_X86_X32', 'is not set', 'kspp', 'cut_attack_surface', 'OK'], ['CONFIG_MODIFY_LDT_SYSCALL', 'is not set', 'kspp', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_X86_PTDUMP', 'is not set', 'grsecurity', 'cut_attack_surface', 'OK'], ['CONFIG_ZSMALLOC_STAT', 'is not set', 'grsecurity', 'cut_attack_surface', 'OK'], ['CONFIG_PAGE_OWNER', 'is not set', 'grsecurity', 'cut_attack_surface', 'OK'], ['CONFIG_DEBUG_KMEMLEAK', 'is not set', 'grsecurity', 'cut_attack_surface', 'OK'], ['CONFIG_BINFMT_AOUT', 'is not set', 'grsecurity', 'cut_attack_surface', 'OK: not found'], ['CONFIG_KPROBES', 'is not set', 'grsecurity', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_UPROBES', 'is not set', 'grsecurity', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_GENERIC_TRACER', 'is not set', 'grsecurity', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_PROC_VMCORE', 'is not set', 'grsecurity', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_PROC_PAGE_MONITOR', 'is not set', 'grsecurity', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_USELIB', 'is not set', 'grsecurity', 'cut_attack_surface', 'OK'], ['CONFIG_CHECKPOINT_RESTORE', 'is not set', 'grsecurity', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_USERFAULTFD', 'is not set', 'grsecurity', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_HWPOISON_INJECT', 'is not set', 'grsecurity', 'cut_attack_surface', 'FAIL: "m"'], ['CONFIG_MEM_SOFT_DIRTY', 'is not set', 'grsecurity', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_DEVPORT', 'is not set', 'grsecurity', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_DEBUG_FS', 'is not set', 'grsecurity', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_NOTIFIER_ERROR_INJECTION', 'is not set', 'grsecurity', 'cut_attack_surface', 'OK'], ['CONFIG_ACPI_TABLE_UPGRADE', 'is not set', 'lockdown', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_ACPI_APEI_EINJ', 'is not set', 'lockdown', 'cut_attack_surface', 'FAIL: "m"'], ['CONFIG_PROFILING', 'is not set', '
4335 lockdown', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_BPF_SYSCALL', 'is not set', 'lockdown', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_MMIOTRACE_TEST', 'is not set', 'lockdown', 'cut_attack_surface', 'OK'], ['CONFIG_KSM', 'is not set', 'clipos', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_IKCONFIG', 'is not set', 'clipos', 'cut_attack_surface', 'OK'], ['CONFIG_KALLSYMS', 'is not set', 'clipos', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_X86_VSYSCALL_EMULATION', 'is not set', 'clipos', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_MAGIC_SYSRQ', 'is not set', 'clipos', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_KEXEC_FILE', 'is not set', 'clipos', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_USER_NS', 'is not set', 'clipos', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_LDISC_AUTOLOAD', 'is not set', 'clipos', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_MMIOTRACE', 'is not set', 'my', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_LIVEPATCH', 'is not set', 'my', 'cut_attack_surface', 'OK'], ['CONFIG_IP_DCCP', 'is not set', 'my', 'cut_attack_surface', 'OK'], ['CONFIG_IP_SCTP', 'is not set', 'my', 'cut_attack_surface', 'FAIL: "m"'], ['CONFIG_FTRACE', 'is not set', 'my', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_BPF_JIT', 'is not set', 'my', 'cut_attack_surface', 'FAIL: "y"'], ['CONFIG_ARCH_MMAP_RND_BITS', '32', 'clipos', 'userspace_protection', 'FAIL: "28"']]
4336 ~~~
4337
4338 Could you rework the PR and check the JSON output ?
4339 I think it might be a trivial fix, like double quotes instead of simple quotes:
4340 ![Screenshot_20190707_145217](https://user-images.githubusercontent.com/964610/60768672-e0620600-a0c6-11e9-80f8-4454265c50fc.png)
4341
4342
4343 Thanks !
4344
4345 #### <img src="https://avatars.githubusercontent.com/u/964610?u=f244bab6b14967638a88cef92752379e64b15996&v=4" width="50">[Wenzel](https://github.com/Wenzel) commented at [2019-07-07 12:55](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/20#issuecomment-508997636):
4346
4347 It should be more robust to use `json.dump(obj)` or `json.dumps(string)` instead of printing your own JSON.
4348 https://github.com/a13xp0p0v/kconfig-hardened-check/blob/master/kconfig-hardened-check.py#L377
4349
4350 #### <img src="https://avatars.githubusercontent.com/u/4029800?u=86702d3f2d50ee01ef1c572ef26b1ea1318f28da&v=4" width="50">[adrianopol](https://github.com/adrianopol) commented at [2019-07-07 19:28](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/20#issuecomment-509024571):
4351
4352 Fixed. Thanks.
4353
4354 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-07-08 14:12](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/20#issuecomment-509241942):
4355
4356 @Wenzel, thanks for the report.
4357 @adrianopol, thanks for the fix, merged.
4358 Double-checked it in json validator, now it should be fine.
4359
4360
4361 -------------------------------------------------------------------------------
4362
4363 # [\#19 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/19) `closed`: Compare with clipos recommendations
4364
4365 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) opened issue at [2019-06-01 12:08](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/19):
4366
4367 Hi Alexander,
4368
4369 I monitoring an interesting project ([CLIP OS ](https://github.com/clipos)) in my country and some options should be compared with your project.
4370
4371 Here are some options that are missing or different from kconfig-hardened-check :
4372
4373 ```
4374 CONFIG_AUDIT=y
4375 CONFIG_IKCONFIG=n
4376 CONFIG_KALLSYMS=n
4377 CONFIG_SLAB_HARDENED=y
4378 CONFIG_SLAB_CANARY=y
4379 CONFIG_SLAB_SANITIZE=y
4380 CONFIG_SLAB_SANITIZE_VERIFY=y
4381 CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE=n
4382 CONFIG_LOCAL_INIT=n
4383 CONFIG_X86_VSYSCALL_EMULATION=n
4384 CONFIG_MICROCODE=y
4385 CONFIG_X86_MSR=y
4386 CONFIG_KSM=n
4387 CONFIG_MTRR=y
4388 CONFIG_X86_PAT=y
4389 CONFIG_ARCH_RANDOM=y
4390 CONFIG_X86_INTEL_MPX=n
4391 CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS=n
4392 CONFIG_CRASH_DUMP=n
4393 CONFIG_COREDUMP=n
4394 CONFIG_TCG_TPM=n
4395 CONFIG_RANDOM_TRUST_CPU=n
4396 CONFIG_IOMMU_SUPPORT=y
4397 CONFIG_INTEL_IOMMU=y
4398 CONFIG_INTEL_IOMMU_SVM=y
4399 CONFIG_INTEL_IOMMU_DEFAULT_ON=y
4400 CONFIG_MAGIC_SYSRQ=n
4401 CONFIG_DEBUG_KERNEL=y
4402 CONFIG_DEBUG_VIRTUAL=y
4403 CONFIG_SLUB_DEBUG_ON=n
4404 CONFIG_PANIC_ON_OOPS=y
4405 CONFIG_PANIC_TIMEOUT=-1
4406 CONFIG_INTEL_TXT=n
4407 CONFIG_FORTIFY_SOURCE_STRICT_STRING=n
4408 CONFIG_STATIC_USERMODEHELPER_PATH=""
4409 CONFIG_SECURITY_SELINUX_BOOTPARAM=n
4410 CONFIG_INTEGRITY=n
4411 CONFIG_SECURITY_PERF_EVENTS_RESTRICT=y
4412 CONFIG_PAGE_SANITIZE_VERIFY=y
4413 CONFIG_SECURITY_TIOCSTI_RESTRICT=y
4414 CONFIG_LOCK_DOWN_MANDATORY=y
4415 CONFIG_STACKLEAK_TRACK_MIN_SIZE=100
4416 CONFIG_STACKLEAK_METRICS=n
4417 CONFIG_STACKLEAK_RUNTIME_DISABLE=n
4418 ```
4419
4420 Details of the options are available here:
4421 https://docs.clip-os.org/clipos/kernel.html#configuration
4422
4423 Best regards,
4424
4425 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2019-06-01 12:12](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/19#issuecomment-497939852):
4426
4427 Even if I'm not a fan of black magic (see [this](https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/issues/3)), the CONFIG_MICROCODE=y option is now essential.
4428
4429 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2019-06-02 11:33](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/19#issuecomment-498022889):
4430
4431 Some of those options are available only in linux-hardened patchset thus not applicable here. Others like CONFIG_INTEGRITY=n or CONFIG_INTEL_TXT=n are specific to clipos and general recommendations would be the opposite.
4432
4433 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2019-06-02 15:13](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/19#issuecomment-498039692):
4434
4435 Yes, you're right, I did a quick extraction. 
4436 Are there any options you think are interesting?
4437
4438 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-06-03 10:23](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/19#issuecomment-498201117):
4439
4440 Cool! @HacKurx, learning the CLIP OS config is a nice idea.
4441
4442 Thanks for the link, I'll check the options from their documentation and choose relevant for the script.
4443
4444 Do you have their full kernel config for adding to `config_files`?
4445
4446 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-06-03 18:16](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/19#issuecomment-498368130):
4447
4448 Hi @HacKurx and @Bernhard40,
4449 I've added new checks based on the CLIP OS recommendations.
4450
4451 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2019-06-03 19:02](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/19#issuecomment-498384402):
4452
4453 Hi @a13xp0p0v,
4454
4455 Thanks you :)
4456
4457 > Do you have their full kernel config for adding to config_files?
4458
4459 The configuration is automatically generated by a script in their own kernel source:
4460 https://github.com/clipos/src_platform_config-linux-hardware/tree/master/
4461 https://github.com/clipos/src_external_linux
4462
4463 I can ask @tsautereau-anssi for confirm it.
4464
4465 Best regards,
4466
4467 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2019-06-04 10:20](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/19#issuecomment-498612884):
4468
4469 @a13xp0p0v `CONFIG_X86_MSR` could also be set to `m` which I think should be ok.
4470
4471 At least Ubuntu, Debian, Archlinux and opensSUSE have it set this way.
4472
4473 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-06-04 22:12](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/19#issuecomment-498862822):
4474
4475 >@a13xp0p0v CONFIG_X86_MSR could also be set to m which I think should be ok.
4476 At least Ubuntu, Debian, Archlinux and opensSUSE have it set this way.
4477
4478 @Bernhard40, thanks for pointing this out.
4479 I double-checked and dropped this recommendation - IMO it's wrong.
4480 CONFIG_X86_MSR provides access from the userspace to the x86 MSRs via char devices.
4481 Kernel doesn't need it for mitigating CPU bugs.
4482
4483 I've created an issue with a question for the CLIP OS project:
4484 https://github.com/clipos/src_platform_config-linux-hardware/issues/1
4485
4486
4487 -------------------------------------------------------------------------------
4488
4489 # [\#18 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/18) `merged`: Update pentoo config link
4490
4491 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) opened issue at [2019-06-01 12:02](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/18):
4492
4493
4494
4495
4496
4497
4498 -------------------------------------------------------------------------------
4499
4500 # [\#17 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/17) `merged`: Update and add config
4501
4502 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) opened issue at [2019-05-12 15:09](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/17):
4503
4504 Hi Alexander,
4505
4506 Here are some updates and the addition of two distributions.
4507
4508 I let you choose ;)
4509
4510 Best regards,
4511
4512 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-05-17 15:13](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/17#issuecomment-493490338):
4513
4514 Hello @HacKurx,
4515 Thanks for the update!
4516 I'm merging it.
4517
4518 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-05-17 15:20](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/17#issuecomment-493492947):
4519
4520 @HacKurx, may I ask you to add/update information in the `links.txt` as well?
4521 Thanks!
4522
4523 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2019-05-25 16:59](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/17#issuecomment-495933123):
4524
4525 Hello @a13xp0p0v,
4526
4527 Thank's for the merge. Some configuration files do not have a url (debian, ubuntu, rhel), I had to extract the configuration from the kernel package.
4528 I am willing to maintain all config occasionally.
4529
4530 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-05-27 14:39](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/17#issuecomment-496234113):
4531
4532 Nice, thanks!
4533
4534 I mean some of your new configs now have out-of-date links in `links.txt`.
4535 For example, Alpine, Arch and Pentoo. Could you please update the links?
4536
4537
4538 -------------------------------------------------------------------------------
4539
4540 # [\#16 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/16) `closed`: After kspp settings server if freezed
4541
4542 #### <img src="https://avatars.githubusercontent.com/u/3471772?v=4" width="50">[bryn1u](https://github.com/bryn1u) opened issue at [2019-04-11 12:37](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/16):
4543
4544 Hey guys,
4545
4546 When i setup server Centos 7 with kspp settings (config below) and i install www hosting panels like Cpanel, CWP panel or ISPmanager and then reboot server, many services are freezed. My network is disabled i cant run with command systemct start network, i cant  reboot server and etc... when i push these commend nothing happen, just waiting and waiting.
4547
4548 My KSPP config:
4549
4550 [+] config check is finished: 'OK' - 62 / 'FAIL' - 41
4551 [root@proton kconfig-hardened-check]# ls
4552 config_files  kconfig-hardened-check.py  LICENSE  README.md
4553 [root@proton kconfig-hardened-check]# ./kconfig-hardened-check.py -c /boot/config-5.0.4 > kspp_setting
4554 [root@proton kconfig-hardened-check]# cat kspp_setting 
4555 [+] Trying to detect architecture in "/boot/config-5.0.4"...
4556 [+] Detected architecture: X86_64
4557 [+] Checking "/boot/config-5.0.4" against hardening preferences...
4558   option name                            | desired val | decision |       reason       ||        check result        
4559   ===================================================================================================================
4560   CONFIG_BUG                             |      y      |defconfig |  self_protection   ||             OK             
4561   CONFIG_STRICT_KERNEL_RWX               |      y      |defconfig |  self_protection   ||             OK             
4562   CONFIG_STACKPROTECTOR_STRONG           |      y      |defconfig |  self_protection   ||             OK             
4563   CONFIG_SLUB_DEBUG                      |      y      |defconfig |  self_protection   ||             OK             
4564   CONFIG_STRICT_MODULE_RWX               |      y      |defconfig |  self_protection   ||             OK             
4565   CONFIG_PAGE_TABLE_ISOLATION            |      y      |defconfig |  self_protection   ||             OK             
4566   CONFIG_RANDOMIZE_MEMORY                |      y      |defconfig |  self_protection   ||             OK             
4567   CONFIG_RANDOMIZE_BASE                  |      y      |defconfig |  self_protection   ||             OK             
4568   CONFIG_RETPOLINE                       |      y      |defconfig |  self_protection   ||             OK             
4569   CONFIG_X86_SMAP                        |      y      |defconfig |  self_protection   ||             OK             
4570   CONFIG_X86_INTEL_UMIP                  |      y      |defconfig |  self_protection   ||             OK             
4571   CONFIG_SYN_COOKIES                     |      y      |defconfig |  self_protection   ||             OK             
4572   CONFIG_VMAP_STACK                      |      y      |defconfig |  self_protection   ||             OK             
4573   CONFIG_THREAD_INFO_IN_TASK             |      y      |defconfig |  self_protection   ||             OK             
4574   CONFIG_BUG_ON_DATA_CORRUPTION          |      y      |   kspp   |  self_protection   ||             OK             
4575   CONFIG_DEBUG_WX                        |      y      |   kspp   |  self_protection   ||             OK             
4576   CONFIG_SCHED_STACK_END_CHECK           |      y      |   kspp   |  self_protection   ||             OK             
4577   CONFIG_SLAB_FREELIST_HARDENED          |      y      |   kspp   |  self_protection   ||             OK             
4578   CONFIG_SLAB_FREELIST_RANDOM            |      y      |   kspp   |  self_protection   ||             OK             
4579   CONFIG_FORTIFY_SOURCE                  |      y      |   kspp   |  self_protection   ||             OK             
4580   CONFIG_GCC_PLUGINS                     |      y      |   kspp   |  self_protection   ||             OK             
4581   CONFIG_GCC_PLUGIN_RANDSTRUCT           |      y      |   kspp   |  self_protection   ||             OK             
4582   CONFIG_GCC_PLUGIN_STRUCTLEAK           |      y      |   kspp   |  self_protection   ||             OK             
4583   CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL |      y      |   kspp   |  self_protection   ||             OK             
4584   CONFIG_GCC_PLUGIN_LATENT_ENTROPY       |      y      |   kspp   |  self_protection   ||             OK             
4585   CONFIG_DEBUG_LIST                      |      y      |   kspp   |  self_protection   ||             OK             
4586   CONFIG_DEBUG_SG                        |      y      |   kspp   |  self_protection   ||             OK             
4587   CONFIG_DEBUG_CREDENTIALS               |      y      |   kspp   |  self_protection   ||             OK             
4588   CONFIG_DEBUG_NOTIFIERS                 |      y      |   kspp   |  self_protection   ||             OK             
4589   CONFIG_PAGE_POISONING                  |      y      |   kspp   |  self_protection   ||             OK             
4590   CONFIG_HARDENED_USERCOPY               |      y      |   kspp   |  self_protection   ||             OK             
4591   CONFIG_HARDENED_USERCOPY_FALLBACK      | is not set  |   kspp   |  self_protection   ||             OK             
4592   CONFIG_MODULE_SIG                      |      y      |   kspp   |  self_protection   ||             OK             
4593   CONFIG_MODULE_SIG_ALL                  |      y      |   kspp   |  self_protection   ||             OK             
4594   CONFIG_MODULE_SIG_SHA512               |      y      |   kspp   |  self_protection   ||     FAIL: "is not set"     
4595   CONFIG_MODULE_SIG_FORCE                |      y      |   kspp   |  self_protection   ||     FAIL: "is not set"     
4596   CONFIG_DEFAULT_MMAP_MIN_ADDR           |    65536    |   kspp   |  self_protection   ||             OK             
4597   CONFIG_REFCOUNT_FULL                   |      y      |   kspp   |  self_protection   ||             OK             
4598   CONFIG_GCC_PLUGIN_STACKLEAK            |      y      |    my    |  self_protection   ||             OK             
4599   CONFIG_LOCK_DOWN_KERNEL                |      y      |    my    |  self_protection   ||      FAIL: not found       
4600   CONFIG_SLUB_DEBUG_ON                   |      y      |    my    |  self_protection   ||             OK             
4601   CONFIG_SECURITY_DMESG_RESTRICT         |      y      |    my    |  self_protection   ||             OK             
4602   CONFIG_STATIC_USERMODEHELPER           |      y      |    my    |  self_protection   ||     FAIL: "is not set"     
4603   CONFIG_SECURITY_LOADPIN                |      y      |    my    |  self_protection   ||     FAIL: "is not set"     
4604   CONFIG_RESET_ATTACK_MITIGATION         |      y      |    my    |  self_protection   ||             OK             
4605   CONFIG_SLAB_MERGE_DEFAULT              | is not set  |    my    |  self_protection   ||         FAIL: "y"          
4606   CONFIG_PAGE_POISONING_NO_SANITY        | is not set  |    my    |  self_protection   ||             OK             
4607   CONFIG_PAGE_POISONING_ZERO             | is not set  |    my    |  self_protection   ||             OK             
4608   CONFIG_SECURITY                        |      y      |defconfig |  security_policy   ||             OK             
4609   CONFIG_SECURITY_YAMA                   |      y      |   kspp   |  security_policy   ||             OK             
4610   CONFIG_SECURITY_SELINUX_DISABLE        | is not set  |   kspp   |  security_policy   ||             OK             
4611   CONFIG_SECCOMP                         |      y      |defconfig | cut_attack_surface ||             OK             
4612   CONFIG_SECCOMP_FILTER                  |      y      |defconfig | cut_attack_surface ||             OK             
4613   CONFIG_STRICT_DEVMEM                   |      y      |defconfig | cut_attack_surface ||             OK             
4614   CONFIG_MODULES                         | is not set  |   kspp   | cut_attack_surface ||         FAIL: "y"          
4615   CONFIG_DEVMEM                          | is not set  |   kspp   | cut_attack_surface ||         FAIL: "y"          
4616   CONFIG_IO_STRICT_DEVMEM                |      y      |   kspp   | cut_attack_surface ||     FAIL: "is not set"     
4617   CONFIG_ACPI_CUSTOM_METHOD              | is not set  |   kspp   | cut_attack_surface ||         FAIL: "m"          
4618   CONFIG_COMPAT_BRK                      | is not set  |   kspp   | cut_attack_surface ||             OK             
4619   CONFIG_DEVKMEM                         | is not set  |   kspp   | cut_attack_surface ||             OK             
4620   CONFIG_COMPAT_VDSO                     | is not set  |   kspp   | cut_attack_surface ||             OK             
4621   CONFIG_BINFMT_MISC                     | is not set  |   kspp   | cut_attack_surface ||         FAIL: "m"          
4622   CONFIG_INET_DIAG                       | is not set  |   kspp   | cut_attack_surface ||         FAIL: "m"          
4623   CONFIG_KEXEC                           | is not set  |   kspp   | cut_attack_surface ||         FAIL: "y"          
4624   CONFIG_PROC_KCORE                      | is not set  |   kspp   | cut_attack_surface ||         FAIL: "y"          
4625   CONFIG_LEGACY_PTYS                     | is not set  |   kspp   | cut_attack_surface ||             OK             
4626   CONFIG_HIBERNATION                     | is not set  |   kspp   | cut_attack_surface ||             OK             
4627   CONFIG_LEGACY_VSYSCALL_NONE            |      y      |   kspp   | cut_attack_surface ||     FAIL: "is not set"     
4628   CONFIG_IA32_EMULATION                  | is not set  |   kspp   | cut_attack_surface ||         FAIL: "y"          
4629   CONFIG_X86_X32                         | is not set  |   kspp   | cut_attack_surface ||             OK             
4630   CONFIG_MODIFY_LDT_SYSCALL              | is not set  |   kspp   | cut_attack_surface ||         FAIL: "y"          
4631   CONFIG_X86_PTDUMP                      | is not set  |grsecurity| cut_attack_surface ||             OK             
4632   CONFIG_ZSMALLOC_STAT                   | is not set  |grsecurity| cut_attack_surface ||             OK             
4633   CONFIG_PAGE_OWNER                      | is not set  |grsecurity| cut_attack_surface ||             OK             
4634   CONFIG_DEBUG_KMEMLEAK                  | is not set  |grsecurity| cut_attack_surface ||             OK             
4635   CONFIG_BINFMT_AOUT                     | is not set  |grsecurity| cut_attack_surface ||       OK: not found        
4636   CONFIG_KPROBES                         | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"          
4637   CONFIG_UPROBES                         | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"          
4638   CONFIG_GENERIC_TRACER                  | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"          
4639   CONFIG_PROC_VMCORE                     | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"          
4640   CONFIG_PROC_PAGE_MONITOR               | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"          
4641   CONFIG_USELIB                          | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"          
4642   CONFIG_CHECKPOINT_RESTORE              | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"          
4643   CONFIG_USERFAULTFD                     | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"          
4644   CONFIG_HWPOISON_INJECT                 | is not set  |grsecurity| cut_attack_surface ||         FAIL: "m"          
4645   CONFIG_MEM_SOFT_DIRTY                  | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"          
4646   CONFIG_DEVPORT                         | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"          
4647   CONFIG_DEBUG_FS                        | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"          
4648   CONFIG_NOTIFIER_ERROR_INJECTION        | is not set  |grsecurity| cut_attack_surface ||             OK             
4649   CONFIG_ACPI_TABLE_UPGRADE              | is not set  | lockdown | cut_attack_surface ||         FAIL: "y"          
4650   CONFIG_ACPI_APEI_EINJ                  | is not set  | lockdown | cut_attack_surface ||         FAIL: "m"          
4651   CONFIG_PROFILING                       | is not set  | lockdown | cut_attack_surface ||         FAIL: "y"          
4652   CONFIG_BPF_SYSCALL                     | is not set  | lockdown | cut_attack_surface ||         FAIL: "y"          
4653   CONFIG_MMIOTRACE_TEST                  | is not set  | lockdown | cut_attack_surface ||       OK: not found        
4654   CONFIG_MMIOTRACE                       | is not set  |    my    | cut_attack_surface ||             OK             
4655   CONFIG_KEXEC_FILE                      | is not set  |    my    | cut_attack_surface ||         FAIL: "y"          
4656   CONFIG_LIVEPATCH                       | is not set  |    my    | cut_attack_surface ||         FAIL: "y"          
4657   CONFIG_USER_NS                         | is not set  |    my    | cut_attack_surface ||         FAIL: "y"          
4658   CONFIG_IP_DCCP                         | is not set  |    my    | cut_attack_surface ||         FAIL: "m"          
4659   CONFIG_IP_SCTP                         | is not set  |    my    | cut_attack_surface ||         FAIL: "m"          
4660   CONFIG_FTRACE                          | is not set  |    my    | cut_attack_surface ||         FAIL: "y"          
4661   CONFIG_BPF_JIT                         | is not set  |    my    | cut_attack_surface ||         FAIL: "y"          
4662   CONFIG_ARCH_MMAP_RND_BITS              |     32      |    my    |userspace_protection||         FAIL: "28"         
4663
4664 [+] config check is finished: 'OK' - 62 / 'FAIL' - 41
4665
4666
4667 Someone can help me with this, i would be graceful ?
4668 Could be impact because of this ?
4669 CONFIG_GCC_PLUGINS | y | kspp | self_protection || OK
4670 CONFIG_GCC_PLUGIN_RANDSTRUCT | y | kspp | self_protection || OK
4671 CONFIG_GCC_PLUGIN_STRUCTLEAK | y | kspp | self_protection || OK
4672 CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL | y | kspp | self_protection || OK
4673 CONFIG_GCC_PLUGIN_LATENT_ENTROPY | y | kspp | self_protection || OK
4674
4675 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2019-04-11 19:26](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/16#issuecomment-482272466):
4676
4677 Could you post `dmesg` output?
4678
4679 #### <img src="https://avatars.githubusercontent.com/u/3471772?v=4" width="50">[bryn1u](https://github.com/bryn1u) commented at [2019-04-14 13:50](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/16#issuecomment-482980574):
4680
4681 Hey,
4682
4683 Sure.
4684 I put my KSPP config again but as a screen: https://ufile.io/epovx3h9
4685 Second part of KSPP config:  https://ufile.io/n4087vqn
4686
4687 Output from dmesg:
4688 dmesg 1 - https://ufile.io/2reh95ag
4689 dmesg 2 - https://ufile.io/mkt1sv73
4690
4691 Thanks,
4692
4693 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-04-14 20:45](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/16#issuecomment-483056865):
4694
4695 Hello @bryn1u,
4696
4697 As I can understand, you are trying to run Centos 7 with the mainline kernel (5.0.7).
4698 I would recommend you to move by smaller steps.
4699
4700 First -- update your kernel, but use `make oldconfig` with the original kernel config from Centos 7.
4701 Maybe something will break even after this step.
4702
4703 And then try to enable hardening options one by one performing your functional test after each change.
4704 You can speed up this procedure using bisection method (between the initial and final configs).
4705
4706 @Bernhard40, any other advices?
4707
4708
4709 -------------------------------------------------------------------------------
4710
4711 # [\#15 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/15) `closed`: After used KSPP settings, modules ext4, xfs, iptables are disabled.
4712
4713 #### <img src="https://avatars.githubusercontent.com/u/3471772?v=4" width="50">[bryn1u](https://github.com/bryn1u) opened issue at [2019-03-22 13:09](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/15):
4714
4715 Hello a13xp0p0v :))
4716
4717 Im using centos 7 and i have a weird problem after kernel compilation. Below is my config kernel with KSPP options enabled.
4718 ![kernel1](https://user-images.githubusercontent.com/3471772/54824577-a271db00-4cab-11e9-92fc-4974a17b41d1.png)
4719 ![kernel2](https://user-images.githubusercontent.com/3471772/54824582-a69df880-4cab-11e9-9c34-604be7280fd1.png)
4720 ![kernel3](https://user-images.githubusercontent.com/3471772/54824586-ab62ac80-4cab-11e9-98af-5b5c98baa232.png)
4721
4722 I have no idea why after kernel compiling, modules like for example ext4, xfs and iptables are disabled. I can't login to the system because ext4 module is disable. The only way is to compiling permanently not as a module. But iptables still dosen't work. Which options are responsible for these "issues" ?
4723 Thanks for help :)
4724
4725
4726 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2019-03-23 17:18](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/15#issuecomment-475888038):
4727
4728 It could be caused by `CONFIG_STATIC_USERMODEHELPER`. This option needs userspace support which is pretty much non-existent in distros, don't use it.
4729
4730 #### <img src="https://avatars.githubusercontent.com/u/3471772?v=4" width="50">[bryn1u](https://github.com/bryn1u) commented at [2019-03-23 20:07](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/15#issuecomment-475900478):
4731
4732 Thanks Bernhard40. I disabled usermodhelper and it works.
4733
4734 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-03-24 11:35](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/15#issuecomment-475950377):
4735
4736 Hello!
4737
4738 @Bernhard40, thanks for your help!
4739
4740 @bryn1u, I remember we have discussed with you that STATIC_USERMODEHELPER and SECURITY_LOADPIN influence module loading -- in #8.
4741
4742 That's why the script has the following comments:
4743 ```
4744 checklist.append(OptCheck('STATIC_USERMODEHELPER', 'y', 'my', 'self_protection')) # needs userspace support (systemd)
4745 checklist.append(OptCheck('SECURITY_LOADPIN', 'y', 'my', 'self_protection')) # needs userspace support
4746 ```
4747
4748
4749 -------------------------------------------------------------------------------
4750
4751 # [\#14 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/14) `closed`: User namespace useful especially when running containers
4752
4753 #### <img src="https://avatars.githubusercontent.com/u/1397088?v=4" width="50">[jcberthon](https://github.com/jcberthon) opened issue at [2019-03-19 14:59](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/14):
4754
4755 Maybe I'm wrong, but at least with Kernel 5.0 USER_NS is activated by default, so "is not set" or "y" should be equivalent. At the moment, it fails because it is "y" on my configuration.
4756
4757 I know that activating USER_NS can cut the attack surface if it is not needed on a system. But on my system which are running containers, I want to have USER_NS activated. True this is not pure hardening of the Kernel, but if we take into account the whole kernel including the possibilities to use it to make containers, then USER_NS should be part of the whole hardening.
4758
4759 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2019-03-19 18:02](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/14#issuecomment-474500985):
4760
4761 > Maybe I'm wrong, but at least with Kernel 5.0 USER_NS is activated by default, so "is not set" or "y" should be equivalent. At the moment, it fails because it is "y" on my configuration.
4762
4763 "is not set" (disabled) is the opposite of "y" (enabled). The fail for "y" is desired outcome.
4764
4765 > I know that activating USER_NS can cut the attack surface if it is not needed on a system. But on my system which are running containers, I want to have USER_NS activated. True this is not pure hardening of the Kernel, but if we take into account the whole kernel including the possibilities to use it to make containers, then USER_NS should be part of the whole hardening.
4766
4767 You have it backwards. **Disabling** USER_NS [cuts the attack surface](https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project/Recommended_Settings#sysctls) and is part of kernel hardening. USER_NS (unprivileged) are considered inherently insecure and unfixable.
4768
4769 #### <img src="https://avatars.githubusercontent.com/u/1397088?v=4" width="50">[jcberthon](https://github.com/jcberthon) commented at [2019-03-19 21:20](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/14#issuecomment-474589104):
4770
4771 Thanks for clarifying the first point.
4772
4773 Concerning the second point, I know that username space could increase the attack surface (heck I recall there was like 1,5-2 years ago a privilege escalation flaw with user ns - albeit mitigated when using SELinux), that's especially true if the functionality is not used.
4774
4775 Anyway as the site you mention implicitly state, you can still compile it in and use the sysctl knob to disable it depending on your threat model and your usage of the kernel. So your application could test the sysctl knob rather than the kernel config. e.g. for people using Ubuntu but following the guideline (and because they do not need it), they can disable it in sysctl. When running your script, they should see that it is correctly disabled. What do you think?
4776
4777 _Note that when someone requires to run containers, user ns can be a good evil. It increases some risk but diminished others. It is a trade off which depends on one's threat model. I mean that I clearly prefer to run my containers as non-root user with as little capabilities as possible, so I would not need user namespaces. But I'm also maintaining a CI/CD environment based on Docker, and there it is pretty hard to deny users the use of root inside spawned containers. I can control capabilities, seccomp and SELinux, but not the root user. There I really need user namespace, I have no other choice._
4778
4779 Do you have a source for user ns being considered unfixable?
4780
4781 Anyway, I understand your reasoning for marking user ns as insecure, so I would not be offended if you would decide to close this issue. Of course I would appreciate you take my suggestion into account :-)
4782
4783 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2019-03-19 21:32](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/14#issuecomment-474592962):
4784
4785 its not just one like 2 years ago, userns is an endless stream of privilege escalation flaws exposed by root designed functionality accessible to any unprivileged user inside a user namespace over and over again.
4786
4787 In my personal opinion this should remain as is, being an error, and if your personal threat model doesn't care about user_ns you can just ignore the result of kconfig-hardened-check :cat:
4788
4789 #### <img src="https://avatars.githubusercontent.com/u/1397088?v=4" width="50">[jcberthon](https://github.com/jcberthon) commented at [2019-03-19 22:44](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/14#issuecomment-474613483):
4790
4791 Alright, and thanks for the feedback.
4792
4793 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-03-20 06:49](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/14#issuecomment-474708180):
4794
4795 Hello everyone,
4796
4797 I'm a bit late for the discussion.
4798
4799 @jcberthon, thanks for your message.
4800 Yes, the `CONFIG_USER_NS` option provides some isolation between the userspace programs, but the script recommends disabling it to cut the attack surface __of the kernel__.
4801 Let me give the links describing the rationale:
4802   
4803   1. A nice LWN article about the corresponding LKML discussion: https://lwn.net/Articles/673597/
4804   2. A twitter thread about USER_NS and security: https://twitter.com/robertswiecki/status/1095447678949953541
4805
4806 @jcberthon, you are right, USER_NS can be disabled using the sysctl - it is even mentioned in the script source code:
4807 ```
4808 checklist.append(OptCheck('USER_NS', 'is not set', 'my', 'cut_attack_surface')) # user.max_user_namespaces=0
4809 ```
4810
4811 (by the way, adding the ability to check kernel boot parameters and sysctl would be really nice)
4812
4813 Thanks for your discussion, I think I should add some clarification of `cut_attack_surface` to the README.
4814
4815 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2019-03-20 12:25](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/14#issuecomment-474807051):
4816
4817 > (by the way, adding the ability to check kernel boot parameters and sysctl would be really nice)
4818
4819 I'm not sure if it's good idea for this project to start scanning the running system for security features. I would vote for keeping it simple and just check chosen config file.
4820
4821 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-03-20 13:23](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/14#issuecomment-474826371):
4822
4823 > > (by the way, adding the ability to check kernel boot parameters and sysctl would be really nice)
4824
4825 > I'm not sure if it's good idea for this project to start scanning the running system for security features. I would vote for keeping it simple and just check chosen config file.
4826
4827 I agree, I don't like the privileged scanning of a system from the script too.
4828 I mean the script could analyze additional files with the needed information together with the kernel config.
4829 For example, right now we can say nothing about side-channel attack mitigations.
4830
4831 #### <img src="https://avatars.githubusercontent.com/u/1397088?v=4" width="50">[jcberthon](https://github.com/jcberthon) commented at [2019-03-20 23:09](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/14#issuecomment-475063272):
4832
4833 Thank you for the interesting read and for the updated README.
4834
4835
4836 -------------------------------------------------------------------------------
4837
4838 # [\#13 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/13) `closed`: False positive and false negatives
4839
4840 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) opened issue at [2019-03-09 19:13](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/13):
4841
4842 `PAGE_POISONING_NO_SANITY` and `PAGE_POISONING_ZERO` depend on `PAGE_POISONING`. Checking distro config which doesn't enable `PAGE_POISONING` (like Fedora) will show `OK: not found` for the first two even as it's far from ok in this case.
4843
4844 Currently script checks only for `MODULE_SIG_SHA512`. Some distros (like Fedora) may use `SHA256` which I think should be fine as well even if KSPP chose different example.
4845
4846 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-03-11 16:27](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/13#issuecomment-471614645):
4847
4848 Hello @Bernhard40,
4849 Thanks for your report, let's discuss it.
4850
4851 > PAGE_POISONING_NO_SANITY and PAGE_POISONING_ZERO depend on PAGE_POISONING. Checking distro config which doesn't enable PAGE_POISONING (like Fedora) will show OK: not found for the first two even as it's far from ok in this case.
4852
4853 Yes, they are dependent on PAGE_POISONING.
4854 These options make this feature weaker, so the script is checking that they are __disabled__.
4855 When the PAGE_POISONING is disabled, the error count is incremented anyway.
4856 I don't think that checking PAGE_POISONING_NO_SANITY and PAGE_POISONING_ZERO should behave differently in that case.
4857
4858 > Currently script checks only for MODULE_SIG_SHA512. Some distros (like Fedora) may use SHA256 which I think should be fine as well even if KSPP chose different example.
4859
4860 The MODULE_SIG_SHA512 option is the KSPP recommendation, it is explicitly indicated by the script.
4861 Distros may have various reasons to do it differently.
4862 One day the script will support the error annotations (the idea is described here: https://github.com/a13xp0p0v/kconfig-hardened-check/pull/9#issuecomment-453810119)
4863
4864 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2019-03-12 00:07](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/13#issuecomment-471790830):
4865
4866 > Yes, they are dependent on PAGE_POISONING.
4867 > These options make this feature weaker, so the script is checking that they are disabled.
4868 > When the PAGE_POISONING is disabled, the error count is incremented anyway.
4869 > I don't think that checking PAGE_POISONING_NO_SANITY and PAGE_POISONING_ZERO should behave differently in that case.
4870
4871 Consider distro which have PAGE_POISONING=n. In check it gets:
4872 ```
4873 CONFIG_PAGE_POISONING                  |      y      |   kspp   |  self_protection   ||     FAIL: "is not set" 
4874 CONFIG_PAGE_POISONING_NO_SANITY        | is not set  |    my    |  self_protection   ||       OK: not found
4875 CONFIG_PAGE_POISONING_ZERO             | is not set  |    my    |  self_protection   ||       OK: not found
4876 ```
4877 The sum is: 1xFAIL + 2xOK
4878
4879 Now, consider distro which has PAGE_POISONING=y, PAGE_POISONING_NO_SANITY=y, PAGE_POISONING_ZERO=y. In check it gets:
4880 ```
4881 CONFIG_PAGE_POISONING                  |      y      |   kspp   |  self_protection   ||             OK
4882 CONFIG_PAGE_POISONING_NO_SANITY        | is not set  |    my    |  self_protection   ||         FAIL: "y"
4883 CONFIG_PAGE_POISONING_ZERO             | is not set  |    my    |  self_protection   ||         FAIL: "y"
4884 ```
4885 The sum is: 2xFAIL + 1xOK
4886
4887 The check shows that distro which disables PAGE_POISONING completely is better than one which enables its weaker version! Specifically for fedora it's 52 errors with the former (actual config) vs 53 errors with the latter.
4888
4889 > The MODULE_SIG_SHA512 option is the KSPP recommendation, it is explicitly indicated by the script.
4890
4891 I read this recommendation as _sign your modules_ rather than _sign your modules using SHA512_. The KSPP page says [But if CONFIG_MODULE=y is needed, at least they must be signed with a per-build key](https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project/Recommended_Settings#CONFIGs). Below they show an example with SHA512. I highly doubt they meant SHA512 explicitly and nothing else. IMO they just used one example because iterating it for SHA256/SHA384 would be rather redundant. You may ask Kees about what he had in mind when he wrote this.
4892
4893 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-03-12 15:31](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/13#issuecomment-472049899):
4894
4895 > The check shows that distro which disables PAGE_POISONING completely is better than one which enables its weaker version! Specifically for fedora it's 52 errors with the former (actual config) vs 53 errors with the latter.
4896
4897 Right. Please have a look how I've solved this issue.
4898  - I've implemented the AND check: 555b588e7b8a620ee57d53ef771e3b128590de45.
4899  - It's now used for PAGE_POISONING_NO_SANITY and PAGE_POISONING_ZERO - they are not checked if PAGE_POISONING is off: a314e4f1df3893864e398ea8565fefdfc036169b.
4900  - The same approach for HARDENED_USERCOPY_FALLBACK: c83dc6c7c804987999296afba385b2349bdda9ac.
4901  - And I improved the output of final results: 43920b20672cd603f7d5e02544a951eec914636b. Now OKs are counted too.
4902
4903 > You may ask Kees about what he had in mind when he wrote this.
4904
4905 Ok, I will remember that. There are several things which can be added to KSPP wiki. I'll work on that later.
4906
4907 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2019-03-12 17:53](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/13#issuecomment-472112024):
4908
4909 > It's now used for PAGE_POISONING_NO_SANITY and PAGE_POISONING_ZERO - they are not checked if PAGE_POISONING is off:
4910
4911 You could also always mark them as failed in that case like `FAIL: "dependency missing"`. That would prevent FAIL count from increasing when enabling only PAGE_POISONING.
4912
4913 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-03-12 21:54](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/13#issuecomment-472196588):
4914
4915 > You could also always mark them as failed in that case like FAIL: "dependency missing"
4916
4917 @Bernhard40, nice idea, thank you.
4918 Implemented in d9aca2d28e9f95266bca2da09625d7d2c885a6b2.
4919
4920
4921 -------------------------------------------------------------------------------
4922
4923 # [\#12 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/12) `closed`: CONFIG_MODULE_SIG_FORCE shouldn't be checked if CONFIG_MODULES is not set
4924
4925 #### <img src="https://avatars.githubusercontent.com/u/990588?v=4" width="50">[hannob](https://github.com/hannob) opened issue at [2019-03-03 12:35](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/12):
4926
4927 I have a minimal kernel without modules for a server. I get a warning about CONFIG_MODULE_SIG_FORCE, which should not apply for a kernel without module support.
4928
4929 For several other module-related options the script behaves correctly (saying 'CONFIG_MODULES: OK ("is not set")' indicating this does not apply), but for CONFIG_MODULE_SIG_FORCE it does not do so.
4930
4931 Output is:
4932 ```
4933   CONFIG_MODULE_SIG_FORCE                |      y      |   kspp   |  self_protection   ||      FAIL: not found       
4934 ```
4935
4936 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-03-04 13:42](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/12#issuecomment-469256961):
4937
4938 Fixed.
4939 Thank you @hannob.
4940
4941
4942 -------------------------------------------------------------------------------
4943
4944 # [\#11 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/11) `closed`: Feature request: Check CONFIG_RESET_ATTACK_MITIGATION
4945
4946 #### <img src="https://avatars.githubusercontent.com/u/990588?v=4" width="50">[hannob](https://github.com/hannob) opened issue at [2019-03-02 08:17](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/11):
4947
4948 Thanks for this tool.
4949
4950 I'd propose to add a check for CONFIG_RESET_ATTACK_MITIGATION.
4951 This is a feature that on modern systems will set a flag on boot that signals the BIOS to wipe the memory if an unclean shutdown happened. This can protect against some forms of cold boot attacks where you reboot into another system and try to read out the memory from the previous run.
4952
4953 Here's the Kernel submission with some explanation:
4954 https://lwn.net/Articles/730006/
4955
4956 It's also explained in this talk:
4957 https://www.youtube.com/watch?v=RqvPZnLkP70 (around minute 35)
4958
4959 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2019-03-02 12:47](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/11#issuecomment-468917523):
4960
4961 This option needs userspace support, otherwise it's not recommended for use:
4962 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a5c03c31af2291f13689d11760c0b59fb70c9a5a
4963
4964 https://bugzilla.redhat.com/show_bug.cgi?id=1532058
4965
4966 #### <img src="https://avatars.githubusercontent.com/u/990588?v=4" width="50">[hannob](https://github.com/hannob) commented at [2019-03-03 12:33](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/11#issuecomment-469018559):
4967
4968 Interesting, is there any userspace tool to do this? Or is this basically unsupported in current systems?
4969
4970 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2019-03-03 12:49](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/11#issuecomment-469019815):
4971
4972 @hannob I wanted to look into this for systemd, but forgot for quite a while. thanks for reminding me, back then there was no userspace support, theoretically you could add a systemd service but doing it _properly_ is bit more tricky. I'm putting this back onto my todo list and take a dive into how to properly implement this into systemd itself at a place that could guarantee that all other services etc. are already properly shut down.
4973
4974 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-03-04 14:52](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/11#issuecomment-469280355):
4975
4976 Hello @hannob @Bernhard40 @anthraxx,
4977
4978 `RESET_ATTACK_MITIGATION` is a nice option, I will add this check to the script with a comment about userspace support.
4979
4980 That case will be similar to the `STATIC_USERMODEHELPER` option, which needs the userspace support as well (but, as I know, enabling it currently breaks systemd workflow on Ubuntu).
4981
4982 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-03-04 18:29](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/11#issuecomment-469362767):
4983
4984 Hm... By the way Ubuntu 18 has `RESET_ATTACK_MITIGATION` enabled.
4985
4986
4987 -------------------------------------------------------------------------------
4988
4989 # [\#10 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/10) `closed`: Add support for x86_32, arm, and arm64 architectures
4990
4991 #### <img src="https://avatars.githubusercontent.com/u/1051156?u=82b8caad104296ef90ffe2f5807dc34d82c31c2b&v=4" width="50">[tyhicks](https://github.com/tyhicks) opened issue at [2019-01-14 19:37](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/10):
4992
4993 (This is a continuation of #9)
4994
4995 Some hardening recommendations are dependent on the processor architecture. For example, the KSPP recommendations differ between [x86_32](https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project/Recommended_Settings#x86_32) and [x86_64](https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project/Recommended_Settings#x86_64).
4996
4997 This pull request adds the ability to reason about the architecture when constructing the checklist. It also teaches the script about `x86_32`, `arm`, and `arm64` specific config recommendations.
4998
4999 I verified that all the example configs in `config_files/` show the same number of config check failures before and after these changes are applied. Of course, the ordering of the options are changed since the ordering used to construct the checklist has been changed.
5000
5001 Some changes since #9 include:
5002 - Drop kernel version detection from the pull request
5003 - Rename `detect_arch_and_version()` to `detect_arch_from_config()`
5004 - Look for `CONFIG_X86_32` and `CONFIG_X86_64` when detecting `x86` sub architecture
5005 - Restrict the accepted `-a <ARCHITECTURE>` values to those found in `SUPPORTED_ARCHS`
5006
5007 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-01-14 20:58](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/10#issuecomment-454158772):
5008
5009 Hello @tyhicks , thanks a lot for the follow-up! Let me propose some improvements.
5010
5011 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-01-14 21:45](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/10#issuecomment-454173475):
5012
5013 @tyhicks , thanks for your work again!
5014 Let me propose one more idea. What do you think about splitting [KSPP recommended settings](http://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project/Recommended_Settings) onto 4 arch-specific configs in `./config_files/`?
5015
5016 #### <img src="https://avatars.githubusercontent.com/u/1051156?u=82b8caad104296ef90ffe2f5807dc34d82c31c2b&v=4" width="50">[tyhicks](https://github.com/tyhicks) commented at [2019-01-17 18:04](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/10#issuecomment-455270114):
5017
5018 Yes, I can add 4 arch-specific configs in `./config_files/`.
5019
5020 #### <img src="https://avatars.githubusercontent.com/u/1051156?u=82b8caad104296ef90ffe2f5807dc34d82c31c2b&v=4" width="50">[tyhicks](https://github.com/tyhicks) commented at [2019-01-17 23:44](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/10#issuecomment-455373860):
5021
5022 I've rebased on top of your current tree, fixed up a few things, added what I think you were asking for in the arch-specific KSPP files, and force pushed to this branch.
5023
5024 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-01-18 12:12](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/10#issuecomment-455526516):
5025
5026 Ouch. 
5027 @tyhicks , excuse me please!
5028 I've made a code review 3 days ago, but didn't hit "submit" button, so it is "pending" :(
5029 I've just realized that you haven't seen my review when I looked at your rebased branch.
5030 My fault.
5031
5032 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-01-18 13:01](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/10#issuecomment-455538355):
5033
5034 If you don't have time/desire, I can pick up your branch and polish it myself.
5035 Thank you again!
5036
5037 #### <img src="https://avatars.githubusercontent.com/u/1051156?u=82b8caad104296ef90ffe2f5807dc34d82c31c2b&v=4" width="50">[tyhicks](https://github.com/tyhicks) commented at [2019-01-18 23:16](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/10#issuecomment-455718260):
5038
5039 > If you don't have time/desire, I can pick up your branch and polish it myself.
5040
5041 I won't mind if you do the polishing yourself.
5042
5043 > Thank you again!
5044
5045 No problem. Thanks for all the review comments.
5046
5047 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-01-24 08:02](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/10#issuecomment-457102717):
5048
5049 Hello @tyhicks ,
5050
5051 I've finished with arch support based on your work.
5052 Do you like it?
5053 Do you have any comments or requests?
5054 Thanks!
5055
5056 #### <img src="https://avatars.githubusercontent.com/u/1051156?u=82b8caad104296ef90ffe2f5807dc34d82c31c2b&v=4" width="50">[tyhicks](https://github.com/tyhicks) commented at [2019-01-24 15:34](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/10#issuecomment-457240527):
5057
5058 Thanks for finishing out the work. It looks very good to me. I'll make use of the changes over the next week or so and submit new pull requests if I spot anything wrong/missing. Thanks again!
5059
5060
5061 -------------------------------------------------------------------------------
5062
5063 # [\#9 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/9) `closed`: Teach the script about target architecture and kernel version
5064
5065 #### <img src="https://avatars.githubusercontent.com/u/1051156?u=82b8caad104296ef90ffe2f5807dc34d82c31c2b&v=4" width="50">[tyhicks](https://github.com/tyhicks) opened issue at [2019-01-12 00:16](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/9):
5066
5067 Some recommendations are dependent on the processor architecture and/or the kernel version. For example, the KSPP recommendations differ between [x86_32](https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project/Recommended_Settings#x86_32) and [x86_64](https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project/Recommended_Settings#x86_64). Additionally, option names change over time such as when `CONFIG_CC_STACKPROTECTOR_STRONG` was [renamed](https://kernsec.org/wiki/index.php?title=Kernel_Self_Protection_Project%2FRecommended_Settings&diff=3983&oldid=3976).
5068
5069 This pull request adds the ability to reason about the architecture and version when constructing the checklist. It also teaches the script about `x86_32`, `arm`, and `arm64` specific config recommendations.
5070
5071 #### <img src="https://avatars.githubusercontent.com/u/1051156?u=82b8caad104296ef90ffe2f5807dc34d82c31c2b&v=4" width="50">[tyhicks](https://github.com/tyhicks) commented at [2019-01-12 00:18](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/9#issuecomment-453698919):
5072
5073 I verified that all the example configs in `config_files/` show the same number of config check failures before and after these changes are applied. Of course, the ordering of the options are changed since the ordering used to construct the checklist has been changed.
5074
5075 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-01-12 17:49](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/9#issuecomment-453767322):
5076
5077 Hello @tyhicks ,
5078
5079 Thank you very much for this pull request! Great!
5080
5081 I briefly looked through the patches and I would like to discuss the approach with you before we proceed.
5082
5083 1. Generally I like the way you introduce SUPPORTED_ARCHS. I also like that the script will have this '-a' argument, it's a good idea. I will look closer to this code.
5084
5085 2. It looks to me that introducing kernel versions will bring more troubles than profit.
5086 In fact all these options have a special version when they appeared in the mainline. Some of them were renamed as well. So if we make the script aware of kernel versions, we will have to add full knowledge about them, but I don't think that it's useful.
5087 IMO it's better to check the config against the recent mainline options and support renamed ones using the OR operator. If the user checks some old config with the script, we will print the errors for hardening options which appeared later, and it is nice. Maybe that will even encourage the user to update the kernel for getting these new hardening features.
5088 What do you think?
5089
5090 May I ask you to extract arch support into a separate pull request? We will work further to merge it.
5091
5092 Thanks again for your time!
5093
5094 #### <img src="https://avatars.githubusercontent.com/u/1051156?u=82b8caad104296ef90ffe2f5807dc34d82c31c2b&v=4" width="50">[tyhicks](https://github.com/tyhicks) commented at [2019-01-12 19:48](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/9#issuecomment-453775979):
5095
5096 > Thank you very much for this pull request! Great!
5097
5098 Glad that you find it useful. I plan to use the script and these changes to audit all of the Ubuntu kernel configs and enable reasonable hardening options that aren't yet enabled.
5099
5100 > It looks to me that introducing kernel versions will bring more troubles than profit.
5101 In fact all these options have a special version when they appeared in the mainline. Some of them were renamed as well. So if we make the script aware of kernel versions, we will have to add full knowledge about them, but I don't think that it's useful.
5102 IMO it's better to check the config against the recent mainline options and support renamed ones using the OR operator. If the user checks some old config with the script, we will print the errors for hardening options which appeared later, and it is nice. Maybe that will even encourage the user to update the kernel for getting these new hardening features.
5103 What do you think?
5104
5105 To be honest, I expected that you'd dislike the kernel version checking. I am on the fence about its usefulness, as well. It currently doesn't add much functionality on top of what `OR()` already provides. My long term thought was to extend minimum version checks to all the options (it really isn't too difficult to do that) so that I could then run the script on old Ubuntu kernel configs, such as the `3.13` kernel in Ubuntu 14.04 LTS, and get clean output that doesn't have a bunch of false negatives for that old kernel.
5106
5107 Maybe I'll just drop the version checking now and, in the future, propose some type of external overrides file that lets me ignore the false negatives when running against a given version of an old kernel. Additionally, this would let me specify overrides for certain options that we simply can't enable in a general purpose distro kernel.
5108
5109 > May I ask you to extract arch support into a separate pull request? We will work further to merge it.
5110
5111 Certainly. It might not happen today but I'll get a new PR up very soon.
5112
5113 #### <img src="https://avatars.githubusercontent.com/u/1051156?u=82b8caad104296ef90ffe2f5807dc34d82c31c2b&v=4" width="50">[tyhicks](https://github.com/tyhicks) commented at [2019-01-12 19:51](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/9#issuecomment-453776169):
5114
5115 @a13xp0p0v I have a slightly unrelated question about the script that I'll ask here since I mentioned using this script with our Ubuntu kernel configs. What does `ubuntu18` mean in the `decision` column of the script output? I assume that you're talking about Ubuntu 18.04 LTS but it feels like `kspp` should be used for nearly all of those rows instead of `ubuntu18` as I consider the KSPP project as the "upstream" that makes these recommendations.
5116
5117 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-01-13 08:03](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/9#issuecomment-453810119):
5118
5119 > Glad that you find it useful. I plan to use the script and these changes to audit all of the Ubuntu kernel configs and enable reasonable hardening options that aren't yet enabled.
5120
5121 Nice. I want this script to serve all your needs out of the box.
5122
5123 > To be honest, I expected that you'd dislike the kernel version checking. I am on the fence about its usefulness, as well. It currently doesn't add much functionality on top of what `OR()` already provides. My long term thought was to extend minimum version checks to all the options (it really isn't too difficult to do that) so that I could then run the script on old Ubuntu kernel configs, such as the `3.13` kernel in Ubuntu 14.04 LTS, and get clean output that doesn't have a bunch of false negatives for that old kernel.
5124
5125 Ok, I see. In other words we need some functionality for categorizing and muting script errors, right?
5126
5127 I face a similar task as well and currently I solve it manually:
5128 1. check some kernel config using the script;
5129 2. copy errors from the report to a separate file and annotate each error. Examples:
5130     - this option doesn't exist in that old kernel version,
5131     - enabling/disabling this option breaks the user requirement (e.g. some users need HIBERNATION),
5132     - enabling/disabling this option breaks some code (e.g. enabling STATIC_USERMODEHELPER breaks systemd workflow on Ubuntu 18),
5133     - this option is not enabled since the feature is controlled via kernel command line param (e.g. CONFIG_LEGACY_VSYSCALL_NONE is not set, but the kernel command line has vsyscall=none),
5134     - and finally some errors are marked with TODO.
5135
5136 > Maybe I'll just drop the version checking now and, in the future, propose some type of external overrides file that lets me ignore the false negatives when running against a given version of an old kernel. Additionally, this would let me specify overrides for certain options that we simply can't enable in a general purpose distro kernel.
5137
5138 Yes, let's create that!
5139
5140 I see two approaches:
5141   - Support the formatted comments in the kernel config. The script will parse them and mute/annotate the errors in its report.
5142   - Support formatted annotations in a separate file. We will run `./kconfig-hardened-check.py -c config -a annotations` and have a pretty report.
5143
5144 What do you think?
5145
5146 > > May I ask you to extract arch support into a separate pull request? We will work further to merge it.
5147
5148 > Certainly. It might not happen today but I'll get a new PR up very soon.
5149
5150 Thank you! Take your time, we are not in a hurry.
5151
5152 > I have a slightly unrelated question about the script that I'll ask here since I mentioned using this script with our Ubuntu kernel configs. What does ubuntu18 mean in the decision column of the script output? I assume that you're talking about Ubuntu 18.04 LTS but it feels like kspp should be used for nearly all of those rows instead of ubuntu18 as I consider the KSPP project as the "upstream" that makes these recommendations.
5153
5154 The `decision` column helps me to maintain the list of recommendations.
5155
5156 The values in `decision` column have this "rank" for me:
5157   1. ubuntu18
5158   2. kspp
5159   3. grsecurity and lockdown
5160   4. my
5161
5162 So I use:
5163   - `ubuntu18` for hardening recommendations already adopted by Ubuntu 18.04 LTS,
5164   - `kspp` for hardening recommendations that are listed in KSPP recommended settings but __not__ adopted by Ubuntu 18.04 LTS,
5165   - `grsecurity` for `cut_attack_surface` recommendations from their patch which are __not__ in KSPP recommended settings list,
5166   - `lockdown` for `cut_attack_surface` functionality from the lockdown patch series which is __not__ mentioned in KSPP recommended settings list,
5167   - `my` for hardening recommendations which I consider reasonable, but others don't mention.
5168
5169 Thanks for your question, I think I should document that in the README.
5170
5171 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2019-01-13 12:31](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/9#issuecomment-453825869):
5172
5173 @a13xp0p0v isn't better to make `kspp` as base for recommendations instead of `ubuntu18`? As @tyhicks mentioned the current order takes it backwards . The alternative would be to use `defconfig` here. I understand that `ubuntu18` is your personal choice but it's highly opinioniated.
5174
5175 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2019-01-14 13:35](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/9#issuecomment-454006535):
5176
5177 @Bernhard40 , thanks for a reasonable comment. I will use `defconfig` as the basis.
5178
5179 #### <img src="https://avatars.githubusercontent.com/u/1051156?u=82b8caad104296ef90ffe2f5807dc34d82c31c2b&v=4" width="50">[tyhicks](https://github.com/tyhicks) commented at [2019-01-14 19:38](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/9#issuecomment-454133942):
5180
5181 Closing this pull request in favor of #10
5182
5183
5184 -------------------------------------------------------------------------------
5185
5186 # [\#8 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/8) `closed`: couldn't mount to /sysroot after compile kernel with KSPP options.
5187
5188 #### <img src="https://avatars.githubusercontent.com/u/3471772?v=4" width="50">[bryn1u](https://github.com/bryn1u) opened issue at [2018-12-17 15:33](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/8):
5189
5190 Hello Alexander,
5191
5192 After kernel compilation im getting issue "unknow filesystem type ext4", "Failed to mount /sysroot"
5193 I was wondering which KSSP feature could be responsible for it ? I was trying many times and always getting the same issue as i mentioned. Sceenshot 
5194 https://www.centos.org/forums/download/file.php?id=2571
5195 It looks like my initramfs doesn't have the kernel module for ext4 but why.
5196
5197 Im using Centos 7 with gcc 7.2
5198
5199 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-12-18 11:55](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/8#issuecomment-448195919):
5200
5201 Hello @bryn1u ,
5202
5203 I don't know the reason of such behavior on Centos.
5204 Distros can have various issues because of the kernel hardening options, for example systemd on Ubuntu-18 has troubles with kernel modules unloading because of CONFIG_STATIC_USERMODEHELPER.
5205
5206 It would be great if you find the reason and share the result.
5207 I would recommend you to use binary search to do it faster.
5208
5209 #### <img src="https://avatars.githubusercontent.com/u/3471772?v=4" width="50">[bryn1u](https://github.com/bryn1u) commented at [2018-12-18 22:12](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/8#issuecomment-448390343):
5210
5211 Hey,
5212
5213 I checked many options and recompiled kernel many times to find some answers, but it looks like everything works like a charm. I was doing everything based on Centos 7 with devtoolset-7 enabled to get never version of gcc like 7.2.  With CONFIG_SECURITY_LOADPIN  enabled im not able to load any module and getting "operation not permitted". Im guessing it's supposed to be like that. 
5214 @a13xp0p0v 
5215 Don't you know if ubuntu developers will enable KSPP options to the ubuntu kernel ? Or only manual compilation is available to get more security features ?
5216 Thanks !
5217
5218 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-12-19 11:57](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/8#issuecomment-448569306):
5219
5220 > With CONFIG_SECURITY_LOADPIN enabled im not able to load any module and getting "operation not permitted". Im guessing it's supposed to be like that.
5221
5222 Thanks for information!
5223
5224 That's the description of CONFIG_SECURITY_LOADPIN:
5225 `Any files read through the kernel file reading interface (kernel modules, firmware, kexec images, security policy) can be pinned to the first filesystem used for loading. When enabled, any files that come from other filesystems will be rejected.`
5226
5227 I guess in your case the first modules are loaded from the ramdisk, and later loading from root filesystem fails.
5228
5229 >Don't you know if ubuntu developers will enable KSPP options to the ubuntu kernel ? Or only manual compilation is available to get more security features ?
5230
5231 It's slow but steady process. More and more kernel hardening options are enabled by distros.
5232
5233 #### <img src="https://avatars.githubusercontent.com/u/3471772?v=4" width="50">[bryn1u](https://github.com/bryn1u) commented at [2018-12-22 12:38](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/8#issuecomment-449567219):
5234
5235 Hello
5236 I have a weir problem. After successfully compiled kernel i can't use iptables:
5237
5238
5239 > [root@localhost ~]# iptables -L
5240 > iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
5241 > Perhaps iptables or your kernel needs to be upgraded.
5242
5243 What am i doing wrong ?
5244
5245 Kernel KSSP options:
5246
5247 ```
5248 option name                            | desired val | decision |       reason       ||        check result        
5249   ===================================================================================================================
5250   CONFIG_BUG                             |      y      | ubuntu18 |  self_protection   ||             OK             
5251   CONFIG_PAGE_TABLE_ISOLATION            |      y      | ubuntu18 |  self_protection   ||             OK             
5252   CONFIG_RETPOLINE                       |      y      | ubuntu18 |  self_protection   ||             OK             
5253   CONFIG_X86_64                          |      y      | ubuntu18 |  self_protection   ||             OK             
5254   CONFIG_X86_SMAP                        |      y      | ubuntu18 |  self_protection   ||             OK             
5255   CONFIG_X86_INTEL_UMIP                  |      y      | ubuntu18 |  self_protection   ||             OK             
5256   CONFIG_STRICT_KERNEL_RWX               |      y      | ubuntu18 |  self_protection   ||             OK             
5257   CONFIG_DEBUG_WX                        |      y      | ubuntu18 |  self_protection   ||             OK             
5258   CONFIG_RANDOMIZE_BASE                  |      y      | ubuntu18 |  self_protection   ||             OK             
5259   CONFIG_RANDOMIZE_MEMORY                |      y      | ubuntu18 |  self_protection   ||             OK             
5260   CONFIG_STACKPROTECTOR_STRONG           |      y      | ubuntu18 |  self_protection   ||             OK             
5261   CONFIG_VMAP_STACK                      |      y      | ubuntu18 |  self_protection   ||             OK             
5262   CONFIG_THREAD_INFO_IN_TASK             |      y      | ubuntu18 |  self_protection   ||             OK             
5263   CONFIG_SCHED_STACK_END_CHECK           |      y      | ubuntu18 |  self_protection   ||             OK             
5264   CONFIG_SLUB_DEBUG                      |      y      | ubuntu18 |  self_protection   ||             OK             
5265   CONFIG_SLAB_FREELIST_HARDENED          |      y      | ubuntu18 |  self_protection   ||             OK             
5266   CONFIG_SLAB_FREELIST_RANDOM            |      y      | ubuntu18 |  self_protection   ||             OK             
5267   CONFIG_HARDENED_USERCOPY               |      y      | ubuntu18 |  self_protection   ||             OK             
5268   CONFIG_FORTIFY_SOURCE                  |      y      | ubuntu18 |  self_protection   ||             OK             
5269   CONFIG_LOCK_DOWN_KERNEL                |      y      | ubuntu18 |  self_protection   ||      FAIL: not found       
5270   CONFIG_STRICT_MODULE_RWX               |      y      | ubuntu18 |  self_protection   ||             OK             
5271   CONFIG_MODULE_SIG                      |      y      | ubuntu18 |  self_protection   ||             OK             
5272   CONFIG_MODULE_SIG_ALL                  |      y      | ubuntu18 |  self_protection   ||             OK             
5273   CONFIG_MODULE_SIG_SHA512               |      y      | ubuntu18 |  self_protection   ||     FAIL: "is not set"     
5274   CONFIG_SYN_COOKIES                     |      y      | ubuntu18 |  self_protection   ||             OK             
5275   CONFIG_DEFAULT_MMAP_MIN_ADDR           |    65536    | ubuntu18 |  self_protection   ||             OK             
5276   CONFIG_BUG_ON_DATA_CORRUPTION          |      y      |   kspp   |  self_protection   ||             OK             
5277   CONFIG_PAGE_POISONING                  |      y      |   kspp   |  self_protection   ||             OK             
5278   CONFIG_GCC_PLUGINS                     |      y      |   kspp   |  self_protection   ||             OK             
5279   CONFIG_GCC_PLUGIN_RANDSTRUCT           |      y      |   kspp   |  self_protection   ||             OK             
5280   CONFIG_GCC_PLUGIN_STRUCTLEAK           |      y      |   kspp   |  self_protection   ||             OK             
5281   CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL |      y      |   kspp   |  self_protection   ||             OK             
5282   CONFIG_GCC_PLUGIN_LATENT_ENTROPY       |      y      |   kspp   |  self_protection   ||             OK             
5283   CONFIG_REFCOUNT_FULL                   |      y      |   kspp   |  self_protection   ||             OK             
5284   CONFIG_DEBUG_LIST                      |      y      |   kspp   |  self_protection   ||             OK             
5285   CONFIG_DEBUG_SG                        |      y      |   kspp   |  self_protection   ||             OK             
5286   CONFIG_DEBUG_CREDENTIALS               |      y      |   kspp   |  self_protection   ||             OK             
5287   CONFIG_DEBUG_NOTIFIERS                 |      y      |   kspp   |  self_protection   ||             OK             
5288   CONFIG_MODULE_SIG_FORCE                |      y      |   kspp   |  self_protection   ||     FAIL: "is not set"     
5289   CONFIG_HARDENED_USERCOPY_FALLBACK      | is not set  |   kspp   |  self_protection   ||         FAIL: "y"          
5290   CONFIG_GCC_PLUGIN_STACKLEAK            |      y      |    my    |  self_protection   ||      FAIL: not found       
5291   CONFIG_SLUB_DEBUG_ON                   |      y      |    my    |  self_protection   ||             OK             
5292   CONFIG_SECURITY_DMESG_RESTRICT         |      y      |    my    |  self_protection   ||             OK             
5293   CONFIG_STATIC_USERMODEHELPER           |      y      |    my    |  self_protection   ||             OK             
5294   CONFIG_SECURITY_LOADPIN                |      y      |    my    |  self_protection   ||     FAIL: "is not set"     
5295   CONFIG_PAGE_POISONING_NO_SANITY        | is not set  |    my    |  self_protection   ||             OK             
5296   CONFIG_PAGE_POISONING_ZERO             | is not set  |    my    |  self_protection   ||             OK             
5297   CONFIG_SLAB_MERGE_DEFAULT              | is not set  |    my    |  self_protection   ||             OK             
5298   CONFIG_SECURITY                        |      y      | ubuntu18 |  security_policy   ||             OK             
5299   CONFIG_SECURITY_YAMA                   |      y      | ubuntu18 |  security_policy   ||             OK             
5300   CONFIG_SECURITY_SELINUX_DISABLE        | is not set  | ubuntu18 |  security_policy   ||             OK             
5301   CONFIG_SECCOMP                         |      y      | ubuntu18 | cut_attack_surface ||             OK             
5302   CONFIG_SECCOMP_FILTER                  |      y      | ubuntu18 | cut_attack_surface ||             OK             
5303   CONFIG_STRICT_DEVMEM                   |      y      | ubuntu18 | cut_attack_surface ||             OK             
5304   CONFIG_ACPI_CUSTOM_METHOD              | is not set  | ubuntu18 | cut_attack_surface ||         FAIL: "m"          
5305   CONFIG_COMPAT_BRK                      | is not set  | ubuntu18 | cut_attack_surface ||             OK             
5306   CONFIG_DEVKMEM                         | is not set  | ubuntu18 | cut_attack_surface ||             OK             
5307   CONFIG_COMPAT_VDSO                     | is not set  | ubuntu18 | cut_attack_surface ||       OK: not found        
5308   CONFIG_X86_PTDUMP                      | is not set  | ubuntu18 | cut_attack_surface ||             OK             
5309   CONFIG_ZSMALLOC_STAT                   | is not set  | ubuntu18 | cut_attack_surface ||             OK             
5310   CONFIG_PAGE_OWNER                      | is not set  | ubuntu18 | cut_attack_surface ||             OK             
5311   CONFIG_DEBUG_KMEMLEAK                  | is not set  | ubuntu18 | cut_attack_surface ||             OK             
5312   CONFIG_BINFMT_AOUT                     | is not set  | ubuntu18 | cut_attack_surface ||       OK: not found        
5313   CONFIG_MMIOTRACE_TEST                  | is not set  | ubuntu18 | cut_attack_surface ||       OK: not found        
5314   CONFIG_IO_STRICT_DEVMEM                |      y      |   kspp   | cut_attack_surface ||             OK             
5315   CONFIG_LEGACY_VSYSCALL_NONE            |      y      |   kspp   | cut_attack_surface ||             OK             
5316   CONFIG_BINFMT_MISC                     | is not set  |   kspp   | cut_attack_surface ||         FAIL: "m"          
5317   CONFIG_INET_DIAG                       | is not set  |   kspp   | cut_attack_surface ||         FAIL: "m"          
5318   CONFIG_KEXEC                           | is not set  |   kspp   | cut_attack_surface ||             OK             
5319   CONFIG_PROC_KCORE                      | is not set  |   kspp   | cut_attack_surface ||             OK             
5320   CONFIG_LEGACY_PTYS                     | is not set  |   kspp   | cut_attack_surface ||             OK             
5321   CONFIG_IA32_EMULATION                  | is not set  |   kspp   | cut_attack_surface ||             OK             
5322   CONFIG_X86_X32                         | is not set  |   kspp   | cut_attack_surface ||             OK             
5323   CONFIG_MODIFY_LDT_SYSCALL              | is not set  |   kspp   | cut_attack_surface ||         FAIL: "y"          
5324   CONFIG_HIBERNATION                     | is not set  |   kspp   | cut_attack_surface ||             OK             
5325   CONFIG_KPROBES                         | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"          
5326   CONFIG_UPROBES                         | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"          
5327   CONFIG_GENERIC_TRACER                  | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"          
5328   CONFIG_PROC_VMCORE                     | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"          
5329   CONFIG_PROC_PAGE_MONITOR               | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"          
5330   CONFIG_USELIB                          | is not set  |grsecurity| cut_attack_surface ||             OK             
5331   CONFIG_CHECKPOINT_RESTORE              | is not set  |grsecurity| cut_attack_surface ||             OK             
5332   CONFIG_USERFAULTFD                     | is not set  |grsecurity| cut_attack_surface ||             OK             
5333   CONFIG_HWPOISON_INJECT                 | is not set  |grsecurity| cut_attack_surface ||             OK             
5334   CONFIG_MEM_SOFT_DIRTY                  | is not set  |grsecurity| cut_attack_surface ||       OK: not found        
5335   CONFIG_DEVPORT                         | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"          
5336   CONFIG_DEBUG_FS                        | is not set  |grsecurity| cut_attack_surface ||         FAIL: "y"          
5337   CONFIG_NOTIFIER_ERROR_INJECTION        | is not set  |grsecurity| cut_attack_surface ||             OK             
5338   CONFIG_ACPI_TABLE_UPGRADE              | is not set  | lockdown | cut_attack_surface ||         FAIL: "y"          
5339   CONFIG_ACPI_APEI_EINJ                  | is not set  | lockdown | cut_attack_surface ||         FAIL: "m"          
5340   CONFIG_PROFILING                       | is not set  | lockdown | cut_attack_surface ||         FAIL: "y"          
5341   CONFIG_BPF_SYSCALL                     | is not set  | lockdown | cut_attack_surface ||         FAIL: "y"          
5342   CONFIG_MMIOTRACE                       | is not set  |    my    | cut_attack_surface ||             OK             
5343   CONFIG_KEXEC_FILE                      | is not set  |    my    | cut_attack_surface ||         FAIL: "y"          
5344   CONFIG_LIVEPATCH                       | is not set  |    my    | cut_attack_surface ||         FAIL: "y"          
5345   CONFIG_USER_NS                         | is not set  |    my    | cut_attack_surface ||         FAIL: "y"          
5346   CONFIG_IP_DCCP                         | is not set  |    my    | cut_attack_surface ||         FAIL: "m"          
5347   CONFIG_IP_SCTP                         | is not set  |    my    | cut_attack_surface ||         FAIL: "m"          
5348   CONFIG_FTRACE                          | is not set  |    my    | cut_attack_surface ||         FAIL: "y"          
5349   CONFIG_BPF_JIT                         | is not set  |    my    | cut_attack_surface ||         FAIL: "y"          
5350   CONFIG_ARCH_MMAP_RND_BITS              |     32      |    my    |userspace_protection||         FAIL: "28"         
5351
5352 [-] config check is NOT PASSED: 29 errors
5353
5354 ```
5355
5356 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-12-25 12:27](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/8#issuecomment-449846419):
5357
5358 Hello @bryn1u ,
5359 The error message which you posted makes me think that your issue is about kernel modules loading.
5360 I would recommend you to look at the kernel log for more information and bisect again to find the reason.
5361
5362
5363 -------------------------------------------------------------------------------
5364
5365 # [\#7 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/7) `closed`: Removing security features during kernel compilation.
5366
5367 #### <img src="https://avatars.githubusercontent.com/u/3471772?v=4" width="50">[bryn1u](https://github.com/bryn1u) opened issue at [2018-12-05 13:21](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/7):
5368
5369 Hey,
5370
5371 Im trying do my best with security options based on your script. I have a litte problems with few options. 
5372
5373 When im adding these options:
5374 ```
5375 # Enable GCC Plugins
5376 CONFIG_GCC_PLUGINS=y
5377
5378 # Gather additional entropy at boot time for systems that may not have appropriate entropy sources.
5379 CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y
5380
5381 # Force all structures to be initialized before they are passed to other functions.
5382 CONFIG_GCC_PLUGIN_STRUCTLEAK=y
5383 CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL=y
5384
5385 # Randomize the layout of system structures. This may have dramatic performance impact, so
5386 # use with caution or also use CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE=y
5387 CONFIG_GCC_PLUGIN_RANDSTRUCT=y
5388 ```
5389 And make a "make -j 8 deb-pkg" on ubuntu or "make -j8 bzImage ...." on centos, these options are removing immediately from ".config" in kernel-4.19.6 . I have no idea what's going on. Could you tell me what am i doing wrong ?
5390
5391 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-12-05 21:08](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/7#issuecomment-444648549):
5392
5393 Hello @bryn1u ,
5394
5395 Kconfig disables these options automatically because your gcc doesn't support plugins.
5396 If you have gcc-7 on Ubuntu, try to install gcc-7-plugin-dev package. It should help.
5397
5398 And thanks for your question. I'll add this information to README.
5399
5400 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-12-05 21:31](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/7#issuecomment-444656696):
5401
5402 Added 478e5f266df05b5f75badef59914c8b0e71e3e0e
5403
5404 #### <img src="https://avatars.githubusercontent.com/u/3471772?v=4" width="50">[bryn1u](https://github.com/bryn1u) commented at [2018-12-06 21:08](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/7#issuecomment-445030219):
5405
5406 Hello,
5407
5408 Now it works :) thanks ! I have one question about CONFIG_GCC_PLUGIN_STACKLEAK . This is the one option which is removing during compilation. Is it any way to enable it or isn't it available in kernel-4.19.7 yet ?
5409 Thanks again :)
5410
5411 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-12-07 06:59](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/7#issuecomment-445141837):
5412
5413 Yes, CONFIG_GCC_PLUGIN_STACKLEAK will be available in Linux 4.20.
5414
5415
5416 -------------------------------------------------------------------------------
5417
5418 # [\#6 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/6) `closed`: Removed long lines on output + minor fix
5419
5420 #### <img src="https://avatars.githubusercontent.com/u/7037785?u=6ac77234884c153e7fd38e3732be16d9760509ea&v=4" width="50">[c0rv4x](https://github.com/c0rv4x) opened issue at [2018-07-30 14:38](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/6):
5421
5422 I removed long lines from `print` and `format` functions.
5423 Also i edited function `get_option_state` now uses `dict.get` method to extract a key from dict with default value 
5424
5425 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-07-30 20:09](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/6#issuecomment-408993713):
5426
5427 Applied!
5428 Thank you @iad42 !
5429
5430
5431 -------------------------------------------------------------------------------
5432
5433 # [\#5 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/5) `closed`: Oop refactoring
5434
5435 #### <img src="https://avatars.githubusercontent.com/u/7037785?u=6ac77234884c153e7fd38e3732be16d9760509ea&v=4" width="50">[c0rv4x](https://github.com/c0rv4x) opened issue at [2018-07-28 21:49](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/5):
5436
5437 Made the program a liitle bit more OOP.
5438
5439 I created a UserConfig class to store the state of the user's config.
5440 Outputter class is responsible for outputting major results (however, not all the prints are there)
5441 OR and OptConifg were moved to a separate file
5442 Checklist got its own class with a method `check(config)` that performs all the checks from the checklist against user's config
5443
5444 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-07-30 09:43](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/5#issuecomment-408807705):
5445
5446 The last commit adds a ```__pycache__``` directory with bython bytecode cache files, that commit should be amended
5447
5448 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-07-30 09:50](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/5#issuecomment-408809392):
5449
5450 Cool that you invest time with this, but personally speaking I'm bit mixed here what the justification/gain is to introduce the complexity and split other then "but oop and modules". Right now it's quite handy to just have the whole thing in a single file that could be copied to /usr/bin dir f.e. and I don't think its expected that lots lots lots of additional modules and python functions are needed beyond this.
5451
5452 Otherwise, if the project goes the path to make it more modular, then it should at least also have setup.py dist file (you may want to add one) so it can actually be distributed and used properly as a module and by distros for packaging python.
5453
5454 My 2 cents is that a single file isn't too bad after considering the current scope and content
5455
5456 #### <img src="https://avatars.githubusercontent.com/u/7037785?u=6ac77234884c153e7fd38e3732be16d9760509ea&v=4" width="50">[c0rv4x](https://github.com/c0rv4x) commented at [2018-07-30 10:36](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/5#issuecomment-408821023):
5457
5458 You are right about `__pycache__`, that is my fault.
5459
5460 As for sticking to a single file, i clearly see your point and agree with you. However, OOP style is obviously easier to extend and easier to read. As long as the author (a13xp0p0v) is expecting the tool to grow, i consider that we should stick to an easier form of code in terms of adding code rather that terms of easy-to-run. 
5461
5462 Also, thanks for the note on setup.py file, i will surely fix that problem!
5463
5464 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-07-30 10:42](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/5#issuecomment-408822137):
5465
5466 Hello @iad42 and @anthraxx ,
5467
5468 Yes, Anatoly, thanks for your time! Your PR made me review the script and gave some new ideas.
5469 I see now what we can improve:
5470  1. currently parsing config file, filling 'OptCheck.state' values in 'checklist' and performing actual checks all mixed in check_config_file(). It would be nice to split them. What approaches do you see?
5471  2. there are two global vars now: 'checklist' and 'debug_mode'. I see that some of design drawbacks are connected with that fact. It would be cool to get rid of them during the refactoring.
5472  3. the script is quite small now, I like that all the functionality stays in a single file.
5473  4. @iad42 , I like how you cut the long lines in printing the output. I want to merge it. Can you put the final ')' on the second line, like that:
5474 ```
5475 print('  CONFIG_{:<32}|{:^13}|{:^10}|{:^20}||{:^28}'.format(
5476             opt.name, opt.expected, opt.decision, opt.reason, opt.result))
5477 ```
5478
5479 Thanks!
5480
5481 #### <img src="https://avatars.githubusercontent.com/u/7037785?u=6ac77234884c153e7fd38e3732be16d9760509ea&v=4" width="50">[c0rv4x](https://github.com/c0rv4x) commented at [2018-07-30 14:39](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/5#issuecomment-408886952):
5482
5483 @a13xp0p0v 
5484
5485 I created a separate pull request https://github.com/a13xp0p0v/kconfig-hardened-check/pull/6 for the 4th bullet point on your list. Also i added a tiny fix for working with dict
5486
5487
5488 -------------------------------------------------------------------------------
5489
5490 # [\#4 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4) `closed`: Add more config files
5491
5492 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) opened issue at [2018-07-20 20:31](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4):
5493
5494 Hello @a13xp0p0v,
5495
5496 Just like I promised.
5497
5498 Best regards.
5499
5500 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2018-07-23 19:03](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4#issuecomment-407166514):
5501
5502 Don't we overdo with the number of configs here? This project allows everyone for checking any config they want themselves so what is the point of storing them here? One or two as example is enough. Most of them will be outdated sooner or later anyway.
5503
5504 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-07-23 19:18](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4#issuecomment-407170808):
5505
5506 Yeah I agree, also they are outdated quite fast and who maintains the configs?
5507 To compare and test stuff, it would make sense to have a small amount of general purpose configs like ubuntu, debian and have some hardened examples like kspp, archlinux-hardened and others. I don't think it is or should be the scope of the project to collect them all
5508
5509 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2018-07-24 12:11](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4#issuecomment-407384626):
5510
5511 Hello,
5512
5513 Allow me first of all to take stock of the results:
5514
5515 **pentoo-hardened-2018.0rc7.config** = **30 errors** (config of iso image)
5516 **Archlinux-hardened.config** = 33 errors (config available via **gitweb**)
5517 Qubes-latest.config = 38 errors (config of linux package)
5518 **Alpinelinux-edge.config** = 44 errors (config available via **gitweb**)
5519 Fedora-Rawhide.config = 48 errors (config of linux package)
5520 **Archlinux-Testing.config** = 49 errors (config available via **gitweb**)
5521 debian-sid-amd64.config = 49 errors (config of linux package)
5522 Kali-linux.config = 49 errors (config of linux package)
5523 Owl-3.1config = 50 errors (config of linux package)
5524 Parrot-security-4.1.config = 52 errors (config of linux package)
5525 ubuntu-bionic-generic.config = 52 errors (config of linux package)
5526 **oracle-uek5.config** = 54 errors (config available via **gitweb**)
5527 Mageia-cauldron.config = 57 errors (config of linux package)
5528 **SLE15.config** = 58 errors (config available via **gitweb**)
5529 **Opensuse-git.config** = 62 errors (config available via **gitweb**)
5530 Trisquel-Flidas.config = 63 errors (config of linux package)
5531
5532 All config available via **gitweb** are easy to maintain with a bash script.
5533 Then for some I didn't use the stable branch but the development branch to have an up-to-date config.
5534
5535 So I lets @a13xp0p0v choose what he prefers.
5536
5537 But I wish in any case to maintain pentoo-hardened in view of its result :smiley:
5538
5539 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-07-24 23:06](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4#issuecomment-407580227):
5540
5541 Hello @HacKurx @anthraxx @Bernhard40 ,
5542
5543 Yes, we don't have a goal to collect all the configs and update them.
5544 At the same time I appreciate @HacKurx efforts.
5545
5546 So what do you think about this solution:
5547 1. drop the configs of minor distributions (Owl-3.1config, Kali-linux.config, Parrot-security-4.1.config, Mageia-cauldron.config, Trisquel-Flidas.config);
5548 2. add the concrete release/version to the config file names ("sid" and "rawhide" are bad version names since they just mean "unstable", right?);
5549 3. add a links.txt with the available links to the configs.
5550
5551 Does it sound reasonable to you?
5552
5553 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2018-07-25 11:41](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4#issuecomment-407725269):
5554
5555 Yeah, keeping well know distros and non-rolling release kernels make sense.
5556
5557 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2018-07-25 19:28](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4#issuecomment-407868315):
5558
5559 Hello @a13xp0p0v ,
5560
5561 > Does it sound reasonable to you?
5562
5563 Yeah, okay, I'll take care of it.
5564
5565 @Bernhard40 
5566
5567 > Yeah, keeping well know distros and non-rolling release kernels make sense.
5568
5569 I know, but for old kernels we need use more OR class. Example: CONFIG_DEBUG_SET_MODULE_RONX, CONFIG_DEBUG_KERNEL, CONFIG_DEBUG_RODATA.
5570
5571 In addition certain points must be corrected, as for example the recommendation "CONFIG_LKDTM" is impossible to respect without breaking the recommendation of Grsecurity on DEBUG_FS.
5572
5573 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-07-27 21:29](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4#issuecomment-408543338):
5574
5575 Hello @HacKurx , thanks for your work.
5576
5577 1. I've commented out the LKDTM rule. You are right about it.
5578
5579 2. I'll check what we can do about CONFIG_DEBUG_SET_MODULE_RONX, CONFIG_DEBUG_KERNEL, CONFIG_DEBUG_RODATA. 
5580
5581 3. I've merged some of your commits, so now 'config' directory has: 
5582  -  Alpinelinux-edge.config (I want to keep it)
5583  -  Archlinux-hardened.config (ditto)
5584  -  debian-stretch.config
5585  -  oracle-uek5.config
5586  -  SLE15.config
5587  -  ubuntu-bionic-generic.config
5588
5589 May I ask you to do a bit more work to make it excellent?
5590  - could you check the links for Alpine Linux in your links.txt? They both give similar result.
5591  - could you find links for debian-stretch and ubuntu-bionic configs?
5592  - could you add configs for some stable versions of Pentoo Hardened and openSUSE?
5593 If so, in the result we will have some consistence between links.txt and config files.
5594
5595 Thank you a lot!
5596
5597 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2018-07-28 06:57](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4#issuecomment-408587814):
5598
5599 Hello @a13xp0p0v ,
5600
5601 > could you check the links for Alpine Linux in your links.txt? They both give similar result.
5602
5603 Because the edge version currently uses the same kernel as the stable 3.8 version.
5604
5605 > could you find links for debian-stretch and ubuntu-bionic configs?
5606
5607 Not sure, but I'll look.
5608
5609 > could you add configs for some stable versions of Pentoo Hardened and openSUSE?
5610
5611 Yes of course the links are in the file.
5612
5613 I'll take care of it soon.
5614 Thank you too. Best regards.
5615
5616 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2018-08-01 21:45](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4#issuecomment-409734659):
5617
5618 Hello @a13xp0p0v ,
5619
5620 > I'll check what we can do about CONFIG_DEBUG_SET_MODULE_RONX, CONFIG_DEBUG_KERNEL, CONFIG_DEBUG_RODATA.
5621
5622 Thank you, I just saw your changes regarding that. If you want to be thorough then you should also do the same for :
5623 ```
5624 PAGE_TABLE_ISOLATION             = PAX_PER_CPU_PGD, MEMORY_UDEREF_MELTDOWN
5625 RANDOMIZE_BASE, RANDOMIZE_MEMORY = PAX_ASLR
5626 HARDENED_USERCOPY                = PAX_USERCOPY
5627 GCC_PLUGIN_RANDSTRUCT            = GRKERNSEC_RANDSTRUCT
5628 GCC_PLUGIN_STRUCTLEAK            = PAX_MEMORY_STRUCTLEAK
5629 GCC_PLUGIN_STRUCTLEAK_BYREF_ALL  = PAX_MEMORY_STRUCTLEAK ?
5630 GCC_PLUGIN_LATENT_ENTROPY        = PAX_LATENT_ENTROPY
5631 REFCOUNT_FULL                    = PAX_REFCOUNT
5632 GCC_PLUGIN_STACKLEAK             = PAX_MEMORY_STACKLEAK
5633 SECURITY_YAMA                    = GRKERNSEC
5634 ```
5635
5636 It's be a good friendly gesture.
5637
5638 I'm still looking for some points and I'm quite busy but I always take care of them.
5639
5640 Regards.
5641
5642 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-08-03 20:52](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4#issuecomment-410373163):
5643
5644 Hi @HacKurx ,
5645
5646 > PAGE_TABLE_ISOLATION             = PAX_PER_CPU_PGD, MEMORY_UDEREF_MELTDOWN
5647
5648 Umm... Where can I learn more about these options?
5649
5650 > RANDOMIZE_BASE, RANDOMIZE_MEMORY = PAX_ASLR
5651
5652 No, I'm absolutely sure that KASLR != PAX_ASLR.
5653
5654 > HARDENED_USERCOPY                = PAX_USERCOPY
5655 > GCC_PLUGIN_RANDSTRUCT            = GRKERNSEC_RANDSTRUCT
5656 > GCC_PLUGIN_STRUCTLEAK            = PAX_MEMORY_STRUCTLEAK
5657 > GCC_PLUGIN_STRUCTLEAK_BYREF_ALL  = PAX_MEMORY_STRUCTLEAK ?
5658 > GCC_PLUGIN_LATENT_ENTROPY        = PAX_LATENT_ENTROPY
5659 > REFCOUNT_FULL                    = PAX_REFCOUNT
5660 > GCC_PLUGIN_STACKLEAK             = PAX_MEMORY_STACKLEAK
5661
5662 Have you seen my Linux Kernel Defence Map?
5663 https://github.com/a13xp0p0v/linux-kernel-defence-map
5664 Please have a look, I've displayed the origins of these features (and praised grsecurity) in that map.
5665
5666 > SECURITY_YAMA                    = GRKERNSEC
5667
5668 Excuse me, I don't see the connection between these options. Can you share more details?
5669
5670 Thank you!
5671
5672 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2018-08-04 14:56](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4#issuecomment-410455183):
5673
5674 Hi @a13xp0p0v ,
5675
5676 > Umm... Where can I learn more about these options?
5677
5678 ```
5679  config PAGE_TABLE_ISOLATION
5680         bool "Remove the kernel mapping in user mode"
5681         default y
5682 -       depends on X86_64 && SMP
5683 +       depends on X86_64 && SMP && !PAX_PER_CPU_PGD && BROKEN
5684         help
5685           This enforces a strict kernel and user space isolation, in order
5686           to close hardware side channels on kernel address information.
5687 ```
5688
5689 and 
5690
5691 ```
5692 +config PAX_MEMORY_UDEREF_MELTDOWN
5693 +       bool "Prevent i386 Meltdown attacks (READ HELP!)"
5694 +       default n
5695 +       depends on X86_32 && PAX_MEMORY_UDEREF
5696 +       help
5697 +         By saying Y here, UDEREF will be enhanced to fully close off
5698 +         Meltdown attacks against the kernel.  This will prevent the
5699 +         creation of expand-down segments and will limit all TLS segments
5700 +         to the end of the userland address space.
5701 ...
5702 ```
5703 If you want to know more, you just have to convince a large company (google? microsoft ^^) to finance their research in a public way :innocent:
5704
5705 > No, I'm absolutely sure that KASLR != PAX_ASLR.
5706
5707 Oops I confused PAX_RANDUSTACK(depends on PAX_ASLR) and PAX_RANDKSTACK.
5708
5709 > Excuse me, I don't see the connection between these options. Can you share more details?
5710
5711 ```
5712  config SECURITY_YAMA
5713         bool "Yama support"
5714 -       depends on SECURITY
5715 +       depends on SECURITY && !GRKERNSEC
5716         default n
5717 ```
5718
5719 Because not compatible.
5720
5721 > Have you seen my Linux Kernel Defence Map?
5722
5723 Great ! I'll look into it.
5724
5725 For the rest I couldn't find a link for the complete debian and ubuntu configurations. The reason is that the files are generated automatically:
5726 https://salsa.debian.org/kernel-team/linux/tree/master/debian/config
5727 https://salsa.debian.org/kernel-team/linux/raw/master/debian/config/amd64/config
5728
5729 What about CRYPTO_SPECK, what do you think?
5730
5731 Thanks you to again.
5732
5733 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2018-08-04 16:14](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4#issuecomment-410460070):
5734
5735 > If you want to know more, you just have to convince a large company (google? microsoft ^^) to finance their research in a public way 😇
5736
5737 So, until that happens there is no point for adding support for options which almost no one can use.
5738
5739 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2018-08-04 17:30](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4#issuecomment-410465146):
5740
5741 >  So, until that happens there is no point for adding support for options which almost no one can use.
5742
5743 So you want to create a false error to the persons who uses it?
5744 KSPP's advances come from grsecurity don't forget it.
5745 Besides the old versions are still a source of inspiration, right?
5746
5747 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2018-08-04 17:53](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4#issuecomment-410466573):
5748
5749 If someone uses grsecurity private code then they should seek support from grsecurity which they pay for, not from volunteers working for free.
5750
5751 Old versions are dead, nothing we can do about it.
5752
5753 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-08-04 20:51](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4#issuecomment-410476855):
5754
5755 Hello @HacKurx and @Bernhard40 ,
5756
5757 Please don't start another holy war about grsecurity.
5758 - Yes, Brad and PaX Team are genius.
5759 - Yes, a lot of KSPP work is inspired by (and sometimes copied from) grsecurity. The map shows that fact explicitly.
5760 - Yes, almost all the mainline kernel self protection features are not compatible with grsecurity (and even marked as BROKEN).
5761
5762 @HacKurx , it's great that you have access to the recent grsecurity patches, lucky you. 
5763 I don't have it, and I guess they will never give it to me.
5764 So I would like to focus on the mainline kconfig options. Moreover, grsecurity users really don't need this funny script at all.
5765
5766 Thanks for understanding.
5767
5768 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-08-08 12:36](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4#issuecomment-411389774):
5769
5770 Hello @HacKurx ,
5771
5772 I've merged the rest of your PR with some fixes I previously mentioned.
5773 Thank you very much.
5774
5775 Closing it now.
5776
5777 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2018-08-08 21:57](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/4#issuecomment-411565682):
5778
5779 Hello @a13xp0p0v ,
5780
5781 > it's great that you have access to the recent grsecurity patches
5782
5783 Well, not really. It's complicated... Let's just say that I have elements that you don't have and that out of respect I didn't publish them. Spender and Pipacs have always answered my questions which is not the case with Linus for example (at the terrorist attack in my country I asked him to rename the version name to "Pray for Paris") but he didn't even take the time to answer...
5784
5785 > So I would like to focus on the mainline kconfig options.
5786
5787 Ok no problem. Rest assured I am not here for divide. I do not forget that if we discuss together it is above all because we appreciate at security in linux ;)
5788
5789 > I've merged the rest of your PR with some fixes I previously mentioned.
5790
5791 Great, thank you. I haven't found much interesting since.
5792
5793 Best regards.
5794
5795
5796 -------------------------------------------------------------------------------
5797
5798 # [\#3 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/3) `closed`: Add Grsecurity recommendation on BINFMT_AOUT
5799
5800 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) opened issue at [2018-07-18 18:52](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/3):
5801
5802 Hi,
5803
5804 Recommendation starting from grsecurity-2.2.0-2.6.32.22-201009241805.patch.
5805 Sorry, Linux historical interest is not secure ;)
5806
5807 Sorry for the tabulations in my code :D
5808
5809 Regards,
5810
5811 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2018-07-18 19:14](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/3#issuecomment-406043222):
5812
5813 I'm curious, does anyone seen kernel with that option enabled in last 10 years?
5814
5815 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2018-07-18 19:49](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/3#issuecomment-406052730):
5816
5817 Today his is not the case but it is necessary to warn users better about the old code that is dangerous and that Linus will never want to delete.
5818
5819 Because otherwise I'm sure he's got geeks who'll activate him for fun...
5820
5821 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2018-07-18 20:13](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/3#issuecomment-406059551):
5822
5823 @Bernhard40 to be precise (extraction from linux-4.18-rc5) shows that it's still using a little. The equipment on ARM being more recent.
5824
5825 m68k/configs/mvme147_defconfig:CONFIG_BINFMT_AOUT=m
5826 m68k/configs/apollo_defconfig:CONFIG_BINFMT_AOUT=m
5827 m68k/configs/multi_defconfig:CONFIG_BINFMT_AOUT=m
5828 m68k/configs/amiga_defconfig:CONFIG_BINFMT_AOUT=m
5829 m68k/configs/bvme6000_defconfig:CONFIG_BINFMT_AOUT=m
5830 m68k/configs/hp300_defconfig:CONFIG_BINFMT_AOUT=m
5831 m68k/configs/atari_defconfig:CONFIG_BINFMT_AOUT=m
5832 m68k/configs/q40_defconfig:CONFIG_BINFMT_AOUT=m
5833 m68k/configs/mac_defconfig:CONFIG_BINFMT_AOUT=m
5834 m68k/configs/sun3_defconfig:CONFIG_BINFMT_AOUT=m
5835 m68k/configs/sun3x_defconfig:CONFIG_BINFMT_AOUT=m
5836 m68k/configs/mvme16x_defconfig:CONFIG_BINFMT_AOUT=m
5837
5838 arm/configs/iop32x_defconfig:CONFIG_BINFMT_AOUT=y
5839 arm/configs/badge4_defconfig:CONFIG_BINFMT_AOUT=m
5840 arm/configs/corgi_defconfig:CONFIG_BINFMT_AOUT=m
5841 arm/configs/neponset_defconfig:CONFIG_BINFMT_AOUT=y
5842 arm/configs/imote2_defconfig:CONFIG_BINFMT_AOUT=m
5843 arm/configs/lart_defconfig:CONFIG_BINFMT_AOUT=y
5844 arm/configs/ebsa110_defconfig:CONFIG_BINFMT_AOUT=y
5845 arm/configs/hackkit_defconfig:CONFIG_BINFMT_AOUT=y
5846 arm/configs/ezx_defconfig:CONFIG_BINFMT_AOUT=m
5847 arm/configs/jornada720_defconfig:CONFIG_BINFMT_AOUT=y
5848 arm/configs/rpc_defconfig:CONFIG_BINFMT_AOUT=y
5849 arm/configs/nuc960_defconfig:CONFIG_BINFMT_AOUT=y
5850 arm/configs/nuc950_defconfig:CONFIG_BINFMT_AOUT=y
5851 arm/configs/spitz_defconfig:CONFIG_BINFMT_AOUT=m
5852 arm/configs/footbridge_defconfig:CONFIG_BINFMT_AOUT=y
5853 arm/configs/netwinder_defconfig:CONFIG_BINFMT_AOUT=y
5854 arm/configs/iop13xx_defconfig:CONFIG_BINFMT_AOUT=y
5855 arm/configs/iop33x_defconfig:CONFIG_BINFMT_AOUT=y
5856
5857 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2018-07-19 19:02](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/3#issuecomment-406381446):
5858
5859 No thanks to you @a13xp0p0v 
5860
5861 I have corrected as requested, I hope it will suit you.
5862 I've done everything since the github editor which explains the many commit.
5863
5864 Too bad kconfig is so limited with conditions because it would be nice to have a menu to choose its security level (basic, custom, paranoid) when configuring the linux kernel.
5865
5866 So I took my inspiration from grsec to make something simpler:
5867 https://github.com/HacKurx/public-sharing/blob/master/disables_unsecured_options.patch
5868
5869 Thanks, best regards.
5870
5871 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-07-19 20:43](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/3#issuecomment-406408269):
5872
5873 @HacKurx btw, i have seen you added Arch Linux config: there is a hardened arch kernel as well with more protective options.
5874
5875 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-07-19 21:08](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/3#issuecomment-406414918):
5876
5877 Hello @HacKurx,
5878
5879 Cool thanks, I'll merge it soon!
5880
5881 I only will not take dropping "not found" from OK status, since it is important information:
5882 explicit "is not set" is different from the option absence in the config file, I want it to be displayed in the script output.
5883
5884 Thanks again!
5885 Till soon.
5886
5887 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2018-07-20 11:56](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/3#issuecomment-406579032):
5888
5889 @anthraxx 
5890 > there is a hardened arch kernel as well with more protective options.
5891
5892 Yes indeed. It's fixed.
5893
5894 @a13xp0p0v 
5895
5896 I will have fun adding main distributions config but it would be necessary to create a folder not to pollute it.
5897 This will allow an easy comparison to be made.
5898
5899 What do you think of that?
5900
5901 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-07-20 12:26](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/3#issuecomment-406585795):
5902
5903 Yes, moving configs into a separate directory is a good idea.
5904
5905 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2018-07-20 14:59](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/3#issuecomment-406627110):
5906
5907 It's done.
5908
5909 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-07-20 18:10](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/3#issuecomment-406683275):
5910
5911 Hello @HacKurx,
5912 Thanks for your work, it's merged (except "not found" dropping).
5913 Nice!
5914
5915 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2018-07-20 18:54](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/3#issuecomment-406695869):
5916
5917 Thank you to you too.
5918 I will complete the config_files folder because the results are very interesting :)
5919
5920 See you soon. Best regards,
5921
5922
5923 -------------------------------------------------------------------------------
5924
5925 # [\#2 PR](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2) `closed`: Feature/improvements
5926
5927 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) opened issue at [2018-06-20 22:14](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2):
5928
5929 Improve the source to make it easier to iterate over options by making the checks and all kernel config options a dictionary. Additionally implement logical operator to support or conditional checks.
5930
5931 Refactor option parsing to use pythons argparse
5932
5933 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-06-20 22:16](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-398915150):
5934
5935 At the end lots of lines changed, please ask anything you want to suggest any changes you would like to see. Even through the changes look massive, I believe they will pay out and make some stuff easier to maintain and access for potential future features.
5936
5937 I'm happy to take any feedback :cat:
5938
5939 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-06-21 20:50](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-399239396):
5940
5941 Thank you very much for your time spent on that!
5942 I like the ideas behind your changes and I want to merge them in the end.
5943
5944 Currently I have 2 concerns about the changes:
5945 1. the commits are really big, I would like to split them. From the top of my head, we can split infrastructure changes from new checks, etc.
5946 2. we should consider the case: MODULES or (MODULE_SIG and MODULE_SIG_ALL and MODULE_SIG_SHA512).
5947
5948 How much time would you like to spend on this? I don't have a right to ask you for more.
5949 At least I see your ideas and I can split (and learn) the commits myself.
5950
5951 Thank you, again.
5952
5953 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-06-21 23:13](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-399271969):
5954
5955 All of this sounds reasonable to me! I already spent some time on this and I'm sure I may contribute in the future as well so I would be super happy to change the commits as long as it satisfies you!
5956 I will split out the DEVMEM and STACKPROTECTOR changes and see if I can split at even more. Should be easy with rebase edit.
5957
5958 Latter case you described should easily be possible with an AND class that is like the OR class, everything else should work out of the box.
5959
5960 Cheers
5961 Levente
5962
5963 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) commented at [2018-06-22 20:50](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-399578012):
5964
5965 Just FYI, in Linux 4.18 `CC_STACKPROTECTOR_STRONG` [was renamed](https://github.com/torvalds/linux/blob/v4.18-rc1/arch/Kconfig#L585) to `STACKPROTECTOR_STRONG` and `CC_STACKPROTECTOR_AUTO` is gone.
5966
5967 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-06-25 16:27](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-400013145):
5968
5969 Thanks for the info, @Bernhard40. I'll update the STACKPROTECTOR config option when 4.18 is released.
5970
5971 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-06-25 22:47](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-400119687):
5972
5973 @a13xp0p0v I have splitted up the commits as much as made sense, can you please take a look? Really don't fear nitpicking, I'm used to do open-source :yum: 
5974
5975 PS: this also handles STACKPROTECTOR_STRONG by using the OR operator.
5976
5977 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-06-26 21:26](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-400467818):
5978
5979 Thanks a lot for your work, @anthraxx !
5980 I'll review this version in a couple of days.
5981 Till soon.
5982
5983 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-07-09 18:23](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-403574284):
5984
5985 @a13xp0p0v round 2, fight! :cat:
5986
5987 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-07-14 09:00](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-405010041):
5988
5989 Well I personally don't think it's a good idea to parse and check one line separately and don't really see why It can't be a dict. Curious how you want to check AND and OR logic on other opts if the config it not fully parsed yet. Personally, parsing it yet again for such logic sounds like non optimal algorithm/approach to me.
5990
5991 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-07-14 09:02](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-405010151):
5992
5993 Why not just check for existence before assigning parsed_options[config] and call it a day?
5994
5995 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-07-14 20:05](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-405046688):
5996
5997 Ah, yes, I see.
5998 You are right. AND & OR logic can't be implemented if we check the config file line by line.
5999 Moreover, separating parsing the file and checks should be a good design solution.
6000
6001 So the first commit in the series is fine.
6002 I would only ask to add the assertion to get_option_state() and call this function outside the Opt class method (just use the Opt.name from outside).
6003 I would also ask to reorder the series:
6004   1. all arch changes and renaming;
6005   2. AND & OR;
6006   3. new rules.
6007
6008 If you have no time/motivation for that work, I will do it myself.
6009
6010 Thanks again, @anthraxx. I'm glad to have your attention to this project.
6011
6012 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-07-14 20:57](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-405049389):
6013
6014 Yay! No worries, I like to discuss solutions and opinions as collaborative work and exchange is much more effective!
6015 I would be happy to make the changes as you requested, will push an update and rebased version very soon.
6016 Cheers 🍻
6017
6018 #### <img src="https://avatars.githubusercontent.com/u/4661917?u=bb7aeb3c77839cea055b49b80168666b36315f3d&v=4" width="50">[theLOICofFRANCE](https://github.com/theLOICofFRANCE) commented at [2018-07-19 19:14](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-406384461):
6019
6020 I don't know if you're doing it, but CONFIG_ARCH_MMAP_RND_BITS should be replaced by: 
6021 ```
6022 CONFIG_ARCH_MMAP_RND_BITS_MIN=28
6023 CONFIG_ARCH_MMAP_RND_BITS_MAX=32
6024 ```
6025
6026 found in Linux kernels: 4.5–4.17, 4.18-rc+HEAD
6027
6028 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-07-19 20:44](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-406408491):
6029
6030 @HacKurx no, i really want to get this PR through finally. After that me, you or whoever can make that CONFIG_ARCH_MMAP_RND_BITS change.
6031
6032 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-07-19 20:48](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-406409433):
6033
6034 @a13xp0p0v I have made the adjustments you wanted to see:
6035 - get_option_state is moved out of the class and assigned before checking
6036 - reordered all commits (wow, this was quite some work >.>)
6037
6038 I really hope we can get this in soon, I'm still there to make any changes if you request some but quite a lot of time already went in to make you happy :cat: :cat:
6039
6040 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-07-19 20:56](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-406411723):
6041
6042 Hello @anthraxx 
6043
6044 Cool, thanks for your work, I'm going to do the review soon.
6045 Yes, we've already spent plenty of time on that, because it's not so easy: this PR changes almost everything :)
6046
6047 Anyway, I like your ideas, they will be merged in the end.
6048
6049 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-07-19 20:58](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-406412140):
6050
6051 @a13xp0p0v Yay thanks, don't get me wrong I really like to work with you on this and i really enjoy it very much. Also I'm 100% on your side to get commits that make it into the tree proper, I just wanted to get that the rework conflicted a lot off my chest :smile:
6052
6053 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-07-19 21:15](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-406416764):
6054
6055 @a13xp0p0v just in case you already pulled my branch, please re-pull as there was a typo in the STACKPROTECTOR option, sorry. tested and reviewd every single commit independent from each other again
6056
6057 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-07-20 18:09](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-406683207):
6058
6059 Hello @anthraxx,
6060
6061 I've cherry-picked all your architecture improvements and added some minor fixes (please have a look).
6062 You've done a great job, I appreciate it!
6063
6064 Now we are ready to merge your OR and AND support.
6065 I have some questions, could you answer please?
6066
6067 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-07-21 08:12](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-406779757):
6068
6069 These are used to print the table and use the very first option of a logical class to represent the group by showing the first entries name and expected value
6070
6071 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-07-24 22:00](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-407566128):
6072
6073 Hello @anthraxx ,
6074 Thanks for your explanation.
6075 It took me some time to realize that self.opts[0] is the option which that OR-check is about.
6076 I.e. OR class use case is: OR(<X_is_hardened>, <X_is_disabled>)
6077
6078 I've merged your OR class with my minor fixes.
6079
6080 I don't think that we need AND right now. Rationale: our config checks are already implicitly connected with AND; if any of them fails, the error count increments anyway. Do you agree?
6081
6082 I also have a question about your STACKPROTECTOR commit.
6083 As I see in the kernel git history, the "CC_" prefix is dropped from both STACKPROTECTOR and STACKPROTECTOR_STRONG. So how about having:
6084 ```
6085 -    checklist.append(OptCheck('CC_STACKPROTECTOR',       'y', 'ubuntu18', 'self_protection'))
6086 -    checklist.append(OptCheck('CC_STACKPROTECTOR_STRONG','y', 'ubuntu18', 'self_protection'))
6087 +    checklist.append(OR(OptCheck('CC_STACKPROTECTOR',    'y', 'ubuntu18', 'self_protection'), \
6088 +                        OptCheck('STACKPROTECTOR',       'y', 'ubuntu18', 'self_protection')))
6089 +    checklist.append(OR(OptCheck('CC_STACKPROTECTOR_STRONG','y', 'ubuntu18', 'self_protection'), \
6090 +                        OptCheck('STACKPROTECTOR_STRONG','y', 'ubuntu18', 'self_protection')))
6091 ```
6092
6093 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-07-24 22:41](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-407575301):
6094
6095 @a13xp0p0v Hmm true, it is for >= 4.18 but for all kernels before 4.18 this would generate an error where non should be. Having CC_STACKPROTECTOR_STRONG without CC_STACKPROTECTOR is a totally correct setting pre 4.18 which would yield to an error.
6096 Its shitty, but the more generally compatible way would be to combine the different "correct sets" with the logical class to just have a single checklist.append for STACKPROTECTOR
6097
6098 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-07-24 23:19](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-407582510):
6099
6100 And how about this?
6101 ```
6102 -    checklist.append(OptCheck('CC_STACKPROTECTOR',       'y', 'ubuntu18', 'self_protection'))
6103 -    checklist.append(OptCheck('CC_STACKPROTECTOR_STRONG','y', 'ubuntu18', 'self_protection'))
6104 +    checklist.append(OR(OptCheck('CC_STACKPROTECTOR_STRONG','y', 'ubuntu18', 'self_protection'), \
6105 +                        OptCheck('STACKPROTECTOR_STRONG','y', 'ubuntu18', 'self_protection')))
6106 ```
6107
6108 It fits your logic "be strong or fail".
6109 At the same time it fits the case of old configs, where there is no CC_STACKPROTECTOR, right?
6110
6111 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-07-25 07:05](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-407655722):
6112
6113 yeah, i think that should work :smiley_cat:
6114
6115 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-07-25 11:45](https://github.com/a13xp0p0v/kernel-hardening-checker/pull/2#issuecomment-407726202):
6116
6117 Done with STACKPROTECTOR and MODULES.
6118 @anthraxx we have finished with this pull request.
6119 Thanks for your excellent work :thumbsup:
6120
6121
6122 -------------------------------------------------------------------------------
6123
6124 # [\#1 Issue](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/1) `closed`: Couple ideas
6125
6126 #### <img src="https://avatars.githubusercontent.com/u/32568352?v=4" width="50">[Bernhard40](https://github.com/Bernhard40) opened issue at [2018-06-20 13:19](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/1):
6127
6128 Shouldn't [NAMESPACES](https://github.com/a13xp0p0v/kconfig-hardened-check/blob/master/kconfig-hardened-check.py#L94) be replaced by `USER_NS`? AFAIK only user namespaces have security concerns, others are fine. Disabling them all will negatively affect many applications which use various namespaces for sandboxing.
6129
6130 Since linux 4.16 there is `CC_STACKPROTECTOR_AUTO` kconfig which effectively replaces [CC_STACKPROTECTOR_STRONG](https://github.com/a13xp0p0v/kconfig-hardened-check/blob/master/kconfig-hardened-check.py#L54) and make it false negative in script.
6131
6132 Script doesn't check for [DEVMEM](https://github.com/a13xp0p0v/kconfig-hardened-check/blob/master/kspp-recommendations.config#L18) which when set to `n` make [STRICT_DEVMEM](https://github.com/a13xp0p0v/kconfig-hardened-check/blob/master/kconfig-hardened-check.py#L38) and [IO_STRICT_DEVMEM](https://github.com/a13xp0p0v/kconfig-hardened-check/blob/master/kconfig-hardened-check.py#L65) false negative.
6133
6134
6135
6136 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-06-20 13:23](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/1#issuecomment-398746587):
6137
6138 I already nearly finished a PR for the DEVMEM and CC_STACKPROTECTOR_* case by adding context aware logic to the option checks.
6139 Pull request incoming later today, it extends the options with logical operators like OR()
6140
6141 #### <img src="https://avatars.githubusercontent.com/u/203012?u=939d6d3b5ff0b9e46e911d8792a40c20408574e2&v=4" width="50">[anthraxx](https://github.com/anthraxx) commented at [2018-06-20 19:14](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/1#issuecomment-398864576):
6142
6143 @a13xp0p0v please no force push, that creates weird merge diffs when working on something :smile_cat:
6144
6145 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-06-20 20:43](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/1#issuecomment-398890140):
6146
6147 @Bernhard40 , thanks a lot for the ideas. I agree. Just fixed the namespaces mistake.
6148 @anthraxx , thanks, cool! Waiting for your PR.
6149 And, yes, no more force push from me.
6150
6151 #### <img src="https://avatars.githubusercontent.com/u/1419667?u=de82e29061c3ef5f1c19f95528f8a82b08051fd2&v=4" width="50">[a13xp0p0v](https://github.com/a13xp0p0v) commented at [2018-07-04 15:38](https://github.com/a13xp0p0v/kernel-hardening-checker/issues/1#issuecomment-402512111):
6152
6153 Closing, since @anthraxx PR will resolve it.
6154
6155
6156 -------------------------------------------------------------------------------
6157