Alexander Popov [Wed, 28 Aug 2024 18:01:12 +0000 (21:01 +0300)]
Merge branch 'from-willenst-2'
Refers to #145, #155
Willenst [Tue, 27 Aug 2024 11:32:03 +0000 (13:32 +0200)]
remove engine debug output
remove unused libs
Remove engine debug output
Willenst [Thu, 22 Aug 2024 18:56:41 +0000 (20:56 +0200)]
Add test for `colorize_result`
Willenst [Thu, 22 Aug 2024 18:28:07 +0000 (20:28 +0200)]
Add test for `print_unknown_options`
Alexander Popov [Mon, 19 Aug 2024 15:13:27 +0000 (18:13 +0300)]
Merge branch 'from-jvoisin'
Refers to #138
Alexander Popov [Mon, 19 Aug 2024 14:34:02 +0000 (17:34 +0300)]
Add the `TEST_DEBUG_VIRTUAL` kconfig check
Alexander Popov [Mon, 19 Aug 2024 14:32:41 +0000 (17:32 +0300)]
Change the `reason` for the `IP_SCTP` and `KGDB` kconfig checks
Alexander Popov [Mon, 19 Aug 2024 14:30:31 +0000 (17:30 +0300)]
Remove the `PAGE_OWNER` kconfig check
It is not relevant any more.
Alexander Popov [Mon, 19 Aug 2024 14:27:06 +0000 (17:27 +0300)]
Disabling VCAP_KUNIT_TEST and BUILD_SALT doesn't look security relevant
Alexander Popov [Mon, 19 Aug 2024 14:24:07 +0000 (17:24 +0300)]
Fix the check order, no functional changes
Alexander Popov [Mon, 19 Aug 2024 14:22:00 +0000 (17:22 +0300)]
Introduce the ARM_PTDUMP_DEBUGFS check
`X86_PTDUMP` is the old name of `PTDUMP_DEBUGFS`,
see the upstream kernel commit
2ae27137b2db89365f623a7694786cf6d1acb6c7.
`ARM_PTDUMP` is the old name of `ARM_PTDUMP_DEBUGFS`,
see the upstream kernel commit
4fb69cc4566f175839615cc4ef8828ae4d5341d9.
Alexander Popov [Mon, 19 Aug 2024 10:27:46 +0000 (13:27 +0300)]
Merge branch 'master' into from-jvoisin
Alexander Popov [Sun, 18 Aug 2024 14:34:55 +0000 (17:34 +0300)]
Merge remote-tracking branch 'citypw/patch-1'
Thanks, @citypw
Shawn C [Tue, 6 Aug 2024 16:05:45 +0000 (16:05 +0000)]
Add ARM SMMU check options
Threat model:
https://github.com/hardenedlinux/grsecurity-101-tutorials/blob/master/embedded_platform_security.md
Alexander Popov [Sun, 11 Aug 2024 15:05:25 +0000 (18:05 +0300)]
Add missing UBSAN_SIGNED_WRAP mentioned in kernel/configs/hardening.config
Alexander Popov [Sun, 11 Aug 2024 14:36:49 +0000 (17:36 +0300)]
Improve the CONFIG_GCC_PLUGIN_STRUCTLEAK check
Alexander Popov [Sun, 11 Aug 2024 13:56:58 +0000 (16:56 +0300)]
Update the KSPP recommendations (II)
Alexander Popov [Sun, 11 Aug 2024 13:49:57 +0000 (16:49 +0300)]
Update the KSPP recommendations
Alexander Popov [Sun, 11 Aug 2024 11:14:15 +0000 (14:14 +0300)]
Add the comments about `vm.mmap_rnd_bits` and `vm.mmap_rnd_compat_bits` sysctls
Refers to #146
Alexander Popov [Sun, 11 Aug 2024 09:39:51 +0000 (12:39 +0300)]
Mark the sysrq checks as GrapheneOS recommendations
And update the README by the way.
See #104
Alexander Popov [Sun, 11 Aug 2024 09:27:12 +0000 (12:27 +0300)]
Reorder some checks
Alexander Popov [Sat, 10 Aug 2024 14:23:23 +0000 (17:23 +0300)]
Improve the reflections on CONFIG_PANIC_ON_OOPS
Alexander Popov [Sat, 10 Aug 2024 11:05:34 +0000 (14:05 +0300)]
Add the LKDTM check
Thanks to @izh1979 for the idea.
Alexander Popov [Sun, 28 Jul 2024 21:40:48 +0000 (00:40 +0300)]
Add defconfigs for Linux v6.10
And remove the unneeded one for Linux v6.6 by the way.
Alexander Popov [Sun, 28 Jul 2024 17:46:50 +0000 (20:46 +0300)]
Merge branch 'simp_detect_arch'
Looks good to me. Thanks, @jvoisin.
jvoisin [Tue, 16 Jul 2024 23:38:32 +0000 (01:38 +0200)]
Simplify a bit the detect_arch function
- Use a regex to extract the arch instead of doing the extraction "by hand".
- Reduce nested indentation.
- Reduce the amount of code in the loop.
- Remove a forceful `re.compile`: python will cache regex in a compiled form if
necessary.
Alexander Popov [Sun, 7 Jul 2024 15:39:22 +0000 (18:39 +0300)]
Add the FAULT_INJECTION check
Thanks to @izh1979 for the idea.
Alexander Popov [Sun, 7 Jul 2024 13:49:47 +0000 (16:49 +0300)]
Add the CONFIG_N_GSM check
See https://www.openwall.com/lists/oss-security/2024/04/17/1.
Refers to #122.
Alexander Popov [Sun, 7 Jul 2024 12:49:10 +0000 (15:49 +0300)]
Add the CRASH_DUMP check
Refers to #84.
Alexander Popov [Sun, 7 Jul 2024 12:19:03 +0000 (15:19 +0300)]
Update the `kfence.sample_interval` check
Alexander Popov [Sat, 6 Jul 2024 20:55:09 +0000 (23:55 +0300)]
Allow the empty values for Kconfig options
This prevents breaking on handling the strange Broadcom configs.
Refers to #143.
Alexander Popov [Sat, 6 Jul 2024 13:02:08 +0000 (16:02 +0300)]
Add the missing SPDX info
Alexander Popov [Sat, 6 Jul 2024 08:51:36 +0000 (11:51 +0300)]
Improve the README
Alexander Popov [Sat, 6 Jul 2024 08:40:19 +0000 (11:40 +0300)]
Specify the `GPL-3.0-only` license explicitly
Alexander Popov [Wed, 3 Jul 2024 13:41:22 +0000 (16:41 +0300)]
Update the `decision` for the SLAB_MERGE_DEFAULT check
Alexander Popov [Wed, 3 Jul 2024 13:38:13 +0000 (16:38 +0300)]
Update the KFENCE_SAMPLE_INTERVAL check
Julien Voisin [Fri, 28 Jun 2024 13:30:04 +0000 (13:30 +0000)]
Merge branch 'master' into grsecurity
Alexander Popov [Wed, 19 Jun 2024 18:44:08 +0000 (21:44 +0300)]
Comment out the RANDSTRUCT_PERFORMANCE check
Alexander Popov [Wed, 19 Jun 2024 18:12:05 +0000 (21:12 +0300)]
Update the KSPP recommendations (https://github.com/KSPP/linux/issues/362)
Thanks to @kees!
Alexander Popov [Sun, 16 Jun 2024 05:48:52 +0000 (08:48 +0300)]
Update the 'kernel.modules_disabled' check
Alexander Popov [Sun, 16 Jun 2024 05:48:14 +0000 (08:48 +0300)]
Add the 'kernel.oops_limit' and 'kernel.warn_limit' checks
Alexander Popov [Sun, 16 Jun 2024 05:23:40 +0000 (08:23 +0300)]
Add the "cfi" check
Alexander Popov [Sun, 16 Jun 2024 04:24:56 +0000 (07:24 +0300)]
Add the "MAGIC_SYSRQ_SERIAL" check
Thanks to @thestinger.
Refers to #104.
Alexander Popov [Sun, 16 Jun 2024 04:03:29 +0000 (07:03 +0300)]
Add the "kernel.sysrq" check
Thanks to @thestinger.
Refers to #104.
Alexander Popov [Sat, 15 Jun 2024 21:56:25 +0000 (00:56 +0300)]
Add the MAGIC_SYSRQ_DEFAULT_ENABLE check
Thanks to @thestinger.
Refers to #104.
Alexander Popov [Sat, 15 Jun 2024 20:16:35 +0000 (23:16 +0300)]
Sync with KSPP: update the `decision` for some checks
Thanks to @kees for the collaboration.
Alexander Popov [Sat, 15 Jun 2024 19:20:51 +0000 (22:20 +0300)]
Add CONFIG_CC_IS_CLANG and CONFIG_CC_IS_GCC to the KSPP recommendations
It makes the tool show less FAILs.
Alexander Popov [Sat, 15 Jun 2024 10:21:23 +0000 (13:21 +0300)]
ruff: Fix EXE001 "Shebang is present but file is not executable"
Alexander Popov [Mon, 10 Jun 2024 14:10:47 +0000 (17:10 +0300)]
Add the comment about 'if arch' for the 'cut_attack_surface' checks
Refers to #135.
Alexander Popov [Mon, 10 Jun 2024 13:44:21 +0000 (16:44 +0300)]
Update the KSPP recommendations
Thanks to Kees for working together!
Alexander Popov [Mon, 10 Jun 2024 13:13:28 +0000 (16:13 +0300)]
Code refactoring to improve test coverage (II)
Test the `-v` argument.
Alexander Popov [Mon, 10 Jun 2024 13:12:15 +0000 (16:12 +0300)]
Code refactoring to improve test coverage (I)
Alexander Popov [Sun, 9 Jun 2024 10:40:00 +0000 (13:40 +0300)]
Merge branch 'scs-pac'
Refers to #131
Thanks @jvoisin
Alexander Popov [Sun, 9 Jun 2024 09:00:36 +0000 (12:00 +0300)]
Merge branch 'page-table-check'
Refers to #140
Thanks to @jvoisin
Alexander Popov [Sun, 2 Jun 2024 17:37:31 +0000 (20:37 +0300)]
Merge branch 'open_check'
Refers to #134.
Alexander Popov [Sun, 2 Jun 2024 17:24:52 +0000 (20:24 +0300)]
CI: Add the test for the code checking that the cmdline file is not empty
Alexander Popov [Sun, 2 Jun 2024 17:13:10 +0000 (20:13 +0300)]
CI: Add the tests for the code checking that the config files exist
Alexander Popov [Sun, 2 Jun 2024 16:59:36 +0000 (19:59 +0300)]
Check that the cmdline file is not empty
Alexander Popov [Sun, 2 Jun 2024 16:58:59 +0000 (19:58 +0300)]
Also check that the cmdline file and sysctl file exist
Alexander Popov [Sun, 2 Jun 2024 16:38:10 +0000 (19:38 +0300)]
Merge branch 'master' into open-check
Alexander Popov [Sun, 2 Jun 2024 15:19:44 +0000 (18:19 +0300)]
Check MITIGATION_SPECTRE_BHI and spectre_bhi
Alexander Popov [Sun, 2 Jun 2024 14:57:49 +0000 (17:57 +0300)]
Check MITIGATION_RFDS and reg_file_data_sampling
Refers to #116
Alexander Popov [Sun, 2 Jun 2024 12:31:12 +0000 (15:31 +0300)]
Add the new name of SPECULATION_MITIGATIONS
Since Linux v6.9 it's called CONFIG_CPU_MITIGATIONS.
Refers to #127, #117
Alexander Popov [Sun, 2 Jun 2024 12:12:55 +0000 (15:12 +0300)]
Add the new names of RETPOLINE, CPU_SRSO, SLS
Since Linux v6.9 they are renamed:
RETPOLINE -> MITIGATION_RETPOLINE
CPU_SRSO -> MITIGATION_SRSO
SLS -> MITIGATION_SLS
Refers to #127, #117
Alexander Popov [Sun, 2 Jun 2024 11:54:07 +0000 (14:54 +0300)]
Add the new name of PAGE_TABLE_ISOLATION
Since Linux v6.9 it's called CONFIG_MITIGATION_PAGE_TABLE_ISOLATION.
Refers to #127, #117
jvoisin [Wed, 22 May 2024 20:03:43 +0000 (22:03 +0200)]
Add two PAGE_TABLE_CHECK related checks from kspp
Newly added in https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=
87caef42200cd44f8b808ec2f8ac2257f3e0a8c1
Julien Voisin [Sun, 19 May 2024 19:17:19 +0000 (19:17 +0000)]
Merge branch 'master' into scs_pac
jvoisin [Fri, 17 May 2024 00:20:28 +0000 (02:20 +0200)]
Add a couple of grsecurity disabled options
This is based on a grsecurity 6.6 patch
Alexander Popov [Tue, 14 May 2024 14:07:04 +0000 (17:07 +0300)]
Merge remote-tracking branch 'origin/pylint'
Refers to #136
Alexander Popov [Tue, 14 May 2024 13:15:27 +0000 (16:15 +0300)]
Don't use TODO to avoid pylint warnings
Alexander Popov [Tue, 14 May 2024 13:16:29 +0000 (16:16 +0300)]
CI: add pylint
Alexander Popov [Tue, 14 May 2024 13:14:56 +0000 (16:14 +0300)]
Drop 'disable=invalid-name' for pylint
Alexander Popov [Tue, 14 May 2024 13:12:43 +0000 (16:12 +0300)]
Drop __about__.py and use 'version = attr:' in setup.cfg
Alexander Popov [Mon, 13 May 2024 23:56:14 +0000 (02:56 +0300)]
CI: Add the mypy arguments to the WoodPecker CI
Alexander Popov [Mon, 13 May 2024 23:49:45 +0000 (02:49 +0300)]
Merge branch 'typing'
Refers to #121
Alexander Popov [Mon, 13 May 2024 23:26:36 +0000 (02:26 +0300)]
CI: Put mypy into a separate workflow and add some useful arguments
Alexander Popov [Mon, 13 May 2024 23:17:21 +0000 (02:17 +0300)]
Introduce ResultType and improve static typing in test_engine.py
Alexander Popov [Mon, 13 May 2024 23:10:36 +0000 (02:10 +0300)]
Improve the VersionCheck static typing
Alexander Popov [Mon, 13 May 2024 22:12:17 +0000 (01:12 +0300)]
Improve typing and drop the unused **kwargs in the KconfigCheck constructor
Alexander Popov [Mon, 13 May 2024 22:09:48 +0000 (01:09 +0300)]
Improve _open() to avoid mypy and pylint warnings
No untyped *args and **kwargs.
Explicit encoding.
Nice!
Alexander Popov [Mon, 13 May 2024 17:06:16 +0000 (20:06 +0300)]
CI: Check static typing with mypy during the functional test
Alexander Popov [Mon, 13 May 2024 16:40:54 +0000 (19:40 +0300)]
Style fixes for engine import
Alexander Popov [Mon, 13 May 2024 16:03:19 +0000 (19:03 +0300)]
Use dict instead of OrderedDict
Changed in Python version 3.7:
Dictionary order is guaranteed to be insertion order.
This makes the code simpler and faster.
Alexander Popov [Mon, 13 May 2024 15:52:39 +0000 (18:52 +0300)]
Add more typing annotations to test_engine.py
Annotate all functions to enable mypy checking for them.
Alexander Popov [Mon, 13 May 2024 15:16:37 +0000 (18:16 +0300)]
Fix mypy typing warnings for ChecklistObjType
Alexander Popov [Mon, 13 May 2024 15:12:35 +0000 (18:12 +0300)]
Add more precise typing for checklist: List[ChecklistObjType]
Alexander Popov [Mon, 13 May 2024 13:26:42 +0000 (16:26 +0300)]
Fix assertion style
Make assertions look similarly.
Alexander Popov [Sun, 12 May 2024 23:27:07 +0000 (02:27 +0300)]
Fix mypy typing warnings in engine.py
Alexander Popov [Mon, 13 May 2024 12:07:08 +0000 (15:07 +0300)]
Add more typing annotations to engine.py
Annotate all functions to enable mypy checking for them.
Alexander Popov [Mon, 13 May 2024 11:57:26 +0000 (14:57 +0300)]
Move print_unknown_options() to engine.py
That is better for specifying typing.
Alexander Popov [Sun, 12 May 2024 20:13:57 +0000 (23:13 +0300)]
Add more precise typing for OrderedDict
Alexander Popov [Sun, 12 May 2024 16:20:33 +0000 (19:20 +0300)]
Add more typing annotations to checks.py
Annotate all functions to enable mypy checking for them.
Alexander Popov [Sun, 12 May 2024 16:15:23 +0000 (19:15 +0300)]
Make the static typing work for Python v3.8
Kind of hackish :)
Alexander Popov [Sun, 12 May 2024 15:31:23 +0000 (18:31 +0300)]
Fix mypy typing warnings in __init__.py
Alexander Popov [Sun, 12 May 2024 15:29:25 +0000 (18:29 +0300)]
Add more typing annotations to __init__.py
Annotate all functions to enable mypy checking for them.
Alexander Popov [Sun, 12 May 2024 15:21:44 +0000 (18:21 +0300)]
Fix pylint warnings in _open
jvoisin [Sun, 12 May 2024 14:59:42 +0000 (16:59 +0200)]
Add a check to `_open`
This shall transform ugly stacktraces into aesthetically pleasant error
messages.
Alexander Popov [Sun, 12 May 2024 13:44:29 +0000 (16:44 +0300)]
Fix mypy warning in _open()
kernel_hardening_checker/__init__.py:28: error: Incompatible types in assignment (expression has type overloaded function, variable has type overloaded function) [assignment]
Refactor the _open function to fix this and add the type hint by the way.
Alexander Popov [Sun, 12 May 2024 13:28:03 +0000 (16:28 +0300)]
Fix mypy warning in json_dump()
kernel_hardening_checker/engine.py:119: error: "None" has no attribute "startswith" [attr-defined]
The `json_dump()` function printing the results should not be called
for the OptCheck and ComplexOptCheck objects with empty results.
jvoisin [Fri, 3 May 2024 13:43:43 +0000 (15:43 +0200)]
Add a check for CONFIG_UNWIND_PATCH_PAC_INTO_SCS
It allows to fallback to a shadow call stack on aarch64 if PAC isn't supported.