Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kernel-hardening-checker
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-depend
kernel-hardening-checker
Commits
f510cdfe
Commit
f510cdfe
authored
Jan 23, 2019
by
Alexander Popov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ARM64 support
parent
8510fc06
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
kconfig-hardened-check.py
kconfig-hardened-check.py
+19
-8
No files found.
kconfig-hardened-check.py
View file @
f510cdfe
...
...
@@ -36,7 +36,7 @@ import re
debug_mode
=
False
# set it to True to print the unknown options from the config
supported_archs
=
[
'X86_64'
,
'X86_32'
]
supported_archs
=
[
'X86_64'
,
'X86_32'
,
'ARM64'
]
checklist
=
[]
...
...
@@ -136,12 +136,8 @@ def construct_checklist(arch):
devmem_not_set
=
OptCheck
(
'DEVMEM'
,
'is not set'
,
'kspp'
,
'cut_attack_surface'
)
# refers to LOCK_DOWN_KERNEL
checklist
.
append
(
OptCheck
(
'BUG'
,
'y'
,
'defconfig'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'RETPOLINE'
,
'y'
,
'defconfig'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'X86_SMAP'
,
'y'
,
'defconfig'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'X86_INTEL_UMIP'
,
'y'
,
'defconfig'
,
'self_protection'
))
checklist
.
append
(
OR
(
OptCheck
(
'STRICT_KERNEL_RWX'
,
'y'
,
'defconfig'
,
'self_protection'
),
\
OptCheck
(
'DEBUG_RODATA'
,
'y'
,
'defconfig'
,
'self_protection'
)))
# before v4.11
checklist
.
append
(
OptCheck
(
'RANDOMIZE_BASE'
,
'y'
,
'defconfig'
,
'self_protection'
))
checklist
.
append
(
OR
(
OptCheck
(
'STACKPROTECTOR_STRONG'
,
'y'
,
'defconfig'
,
'self_protection'
),
\
OptCheck
(
'CC_STACKPROTECTOR_STRONG'
,
'y'
,
'defconfig'
,
'self_protection'
)))
checklist
.
append
(
OptCheck
(
'THREAD_INFO_IN_TASK'
,
'y'
,
'defconfig'
,
'self_protection'
))
...
...
@@ -149,10 +145,19 @@ def construct_checklist(arch):
checklist
.
append
(
OR
(
OptCheck
(
'STRICT_MODULE_RWX'
,
'y'
,
'defconfig'
,
'self_protection'
),
\
OptCheck
(
'DEBUG_SET_MODULE_RONX'
,
'y'
,
'defconfig'
,
'self_protection'
),
\
modules_not_set
))
# DEBUG_SET_MODULE_RONX was before v4.11
checklist
.
append
(
OptCheck
(
'SYN_COOKIES'
,
'y'
,
'defconfig'
,
'self_protection'
))
# another reason?
if
arch
==
'X86_64'
:
checklist
.
append
(
OptCheck
(
'PAGE_TABLE_ISOLATION'
,
'y'
,
'defconfig'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'RANDOMIZE_MEMORY'
,
'y'
,
'defconfig'
,
'self_protection'
))
if
arch
==
'X86_64'
or
arch
==
'X86_32'
:
checklist
.
append
(
OptCheck
(
'RANDOMIZE_BASE'
,
'y'
,
'defconfig'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'RETPOLINE'
,
'y'
,
'defconfig'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'X86_SMAP'
,
'y'
,
'defconfig'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'X86_INTEL_UMIP'
,
'y'
,
'defconfig'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'SYN_COOKIES'
,
'y'
,
'defconfig'
,
'self_protection'
))
# another reason?
if
arch
==
'ARM64'
:
checklist
.
append
(
OptCheck
(
'UNMAP_KERNEL_AT_EL0'
,
'y'
,
'defconfig'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'REFCOUNT_FULL'
,
'y'
,
'defconfig'
,
'self_protection'
))
if
debug_mode
or
arch
==
'X86_64'
or
arch
==
'ARM64'
:
checklist
.
append
(
OptCheck
(
'VMAP_STACK'
,
'y'
,
'defconfig'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'BUG_ON_DATA_CORRUPTION'
,
'y'
,
'kspp'
,
'self_protection'
))
...
...
@@ -169,7 +174,6 @@ def construct_checklist(arch):
checklist
.
append
(
OptCheck
(
'GCC_PLUGIN_STRUCTLEAK'
,
'y'
,
'kspp'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'GCC_PLUGIN_STRUCTLEAK_BYREF_ALL'
,
'y'
,
'kspp'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'GCC_PLUGIN_LATENT_ENTROPY'
,
'y'
,
'kspp'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'REFCOUNT_FULL'
,
'y'
,
'kspp'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'DEBUG_LIST'
,
'y'
,
'kspp'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'DEBUG_SG'
,
'y'
,
'kspp'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'DEBUG_CREDENTIALS'
,
'y'
,
'kspp'
,
'self_protection'
))
...
...
@@ -181,10 +185,17 @@ def construct_checklist(arch):
checklist
.
append
(
OR
(
OptCheck
(
'MODULE_SIG_SHA512'
,
'y'
,
'kspp'
,
'self_protection'
),
\
modules_not_set
))
checklist
.
append
(
OptCheck
(
'MODULE_SIG_FORCE'
,
'y'
,
'kspp'
,
'self_protection'
))
# refers to LOCK_DOWN_KERNEL
if
arch
==
'X86_64'
or
arch
==
'X86_32'
:
checklist
.
append
(
OptCheck
(
'DEFAULT_MMAP_MIN_ADDR'
,
'65536'
,
'kspp'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'REFCOUNT_FULL'
,
'y'
,
'kspp'
,
'self_protection'
))
if
arch
==
'X86_32'
:
checklist
.
append
(
OptCheck
(
'HIGHMEM64G'
,
'y'
,
'kspp'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'X86_PAE'
,
'y'
,
'kspp'
,
'self_protection'
))
if
arch
==
'ARM64'
:
checklist
.
append
(
OptCheck
(
'DEFAULT_MMAP_MIN_ADDR'
,
'32768'
,
'kspp'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'ARM64_SW_TTBR0_PAN'
,
'y'
,
'kspp'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'RANDOMIZE_BASE'
,
'y'
,
'kspp'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'SYN_COOKIES'
,
'y'
,
'kspp'
,
'self_protection'
))
# another reason?
checklist
.
append
(
OptCheck
(
'GCC_PLUGIN_STACKLEAK'
,
'y'
,
'my'
,
'self_protection'
))
checklist
.
append
(
OptCheck
(
'LOCK_DOWN_KERNEL'
,
'y'
,
'my'
,
'self_protection'
))
# remember about LOCK_DOWN_MANDATORY
...
...
@@ -261,7 +272,7 @@ def construct_checklist(arch):
if
arch
==
'X86_32'
:
checklist
.
append
(
OptCheck
(
'MODIFY_LDT_SYSCALL'
,
'is not set'
,
'my'
,
'cut_attack_surface'
))
if
arch
==
'X86_64'
:
if
arch
==
'X86_64'
or
arch
==
'ARM64'
:
checklist
.
append
(
OptCheck
(
'ARCH_MMAP_RND_BITS'
,
'32'
,
'my'
,
'userspace_protection'
))
if
arch
==
'X86_32'
:
checklist
.
append
(
OptCheck
(
'ARCH_MMAP_RND_BITS'
,
'16'
,
'my'
,
'userspace_protection'
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment