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
3c9d3fcb
Commit
3c9d3fcb
authored
Oct 13, 2022
by
Alexander Popov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the self-protection checks adopted by KSPP (part I)
Thanks to @kees
parent
0ac5fe30
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
__init__.py
kconfig_hardened_check/__init__.py
+11
-12
No files found.
kconfig_hardened_check/__init__.py
View file @
3c9d3fcb
...
@@ -427,6 +427,9 @@ def add_kconfig_checks(l, arch):
...
@@ -427,6 +427,9 @@ def add_kconfig_checks(l, arch):
randstruct_is_set
=
OR
(
KconfigCheck
(
'self_protection'
,
'kspp'
,
'RANDSTRUCT_FULL'
,
'y'
),
randstruct_is_set
=
OR
(
KconfigCheck
(
'self_protection'
,
'kspp'
,
'RANDSTRUCT_FULL'
,
'y'
),
KconfigCheck
(
'self_protection'
,
'kspp'
,
'GCC_PLUGIN_RANDSTRUCT'
,
'y'
))
KconfigCheck
(
'self_protection'
,
'kspp'
,
'GCC_PLUGIN_RANDSTRUCT'
,
'y'
))
l
+=
[
randstruct_is_set
]
l
+=
[
randstruct_is_set
]
l
+=
[
AND
(
KconfigCheck
(
'self_protection'
,
'kspp'
,
'RANDSTRUCT_PERFORMANCE'
,
'is not set'
),
KconfigCheck
(
'self_protection'
,
'kspp'
,
'GCC_PLUGIN_RANDSTRUCT_PERFORMANCE'
,
'is not set'
),
randstruct_is_set
)]
hardened_usercopy_is_set
=
KconfigCheck
(
'self_protection'
,
'kspp'
,
'HARDENED_USERCOPY'
,
'y'
)
hardened_usercopy_is_set
=
KconfigCheck
(
'self_protection'
,
'kspp'
,
'HARDENED_USERCOPY'
,
'y'
)
l
+=
[
hardened_usercopy_is_set
]
l
+=
[
hardened_usercopy_is_set
]
l
+=
[
AND
(
KconfigCheck
(
'self_protection'
,
'kspp'
,
'HARDENED_USERCOPY_FALLBACK'
,
'is not set'
),
l
+=
[
AND
(
KconfigCheck
(
'self_protection'
,
'kspp'
,
'HARDENED_USERCOPY_FALLBACK'
,
'is not set'
),
...
@@ -450,6 +453,8 @@ def add_kconfig_checks(l, arch):
...
@@ -450,6 +453,8 @@ def add_kconfig_checks(l, arch):
# Starting from v5.11 CONFIG_PAGE_POISONING unconditionally checks
# Starting from v5.11 CONFIG_PAGE_POISONING unconditionally checks
# the 0xAA poison pattern on allocation.
# the 0xAA poison pattern on allocation.
# That brings higher performance penalty.
# That brings higher performance penalty.
l
+=
[
OR
(
KconfigCheck
(
'self_protection'
,
'kspp'
,
'EFI_DISABLE_PCI_DMA'
,
'y'
),
efi_not_set
)]
ubsan_bounds_is_set
=
KconfigCheck
(
'self_protection'
,
'kspp'
,
'UBSAN_BOUNDS'
,
'y'
)
ubsan_bounds_is_set
=
KconfigCheck
(
'self_protection'
,
'kspp'
,
'UBSAN_BOUNDS'
,
'y'
)
l
+=
[
ubsan_bounds_is_set
]
l
+=
[
ubsan_bounds_is_set
]
l
+=
[
OR
(
KconfigCheck
(
'self_protection'
,
'kspp'
,
'UBSAN_LOCAL_BOUNDS'
,
'y'
),
l
+=
[
OR
(
KconfigCheck
(
'self_protection'
,
'kspp'
,
'UBSAN_LOCAL_BOUNDS'
,
'y'
),
...
@@ -468,6 +473,12 @@ def add_kconfig_checks(l, arch):
...
@@ -468,6 +473,12 @@ def add_kconfig_checks(l, arch):
ubsan_bounds_is_set
)]
# ARCH_HAS_UBSAN_SANITIZE_ALL is not enabled for ARM
ubsan_bounds_is_set
)]
# ARCH_HAS_UBSAN_SANITIZE_ALL is not enabled for ARM
stackleak_is_set
=
KconfigCheck
(
'self_protection'
,
'kspp'
,
'GCC_PLUGIN_STACKLEAK'
,
'y'
)
stackleak_is_set
=
KconfigCheck
(
'self_protection'
,
'kspp'
,
'GCC_PLUGIN_STACKLEAK'
,
'y'
)
l
+=
[
AND
(
stackleak_is_set
,
gcc_plugins_support_is_set
)]
l
+=
[
AND
(
stackleak_is_set
,
gcc_plugins_support_is_set
)]
l
+=
[
AND
(
KconfigCheck
(
'self_protection'
,
'kspp'
,
'STACKLEAK_METRICS'
,
'is not set'
),
stackleak_is_set
,
gcc_plugins_support_is_set
)]
l
+=
[
AND
(
KconfigCheck
(
'self_protection'
,
'kspp'
,
'STACKLEAK_RUNTIME_DISABLE'
,
'is not set'
),
stackleak_is_set
,
gcc_plugins_support_is_set
)]
l
+=
[
KconfigCheck
(
'self_protection'
,
'kspp'
,
'RANDOMIZE_KSTACK_OFFSET_DEFAULT'
,
'y'
)]
l
+=
[
KconfigCheck
(
'self_protection'
,
'kspp'
,
'RANDOMIZE_KSTACK_OFFSET_DEFAULT'
,
'y'
)]
if
arch
in
(
'X86_64'
,
'X86_32'
):
if
arch
in
(
'X86_64'
,
'X86_32'
):
l
+=
[
KconfigCheck
(
'self_protection'
,
'kspp'
,
'SCHED_CORE'
,
'y'
)]
l
+=
[
KconfigCheck
(
'self_protection'
,
'kspp'
,
'SCHED_CORE'
,
'y'
)]
...
@@ -485,19 +496,7 @@ def add_kconfig_checks(l, arch):
...
@@ -485,19 +496,7 @@ def add_kconfig_checks(l, arch):
# 'self_protection', 'clipos'
# 'self_protection', 'clipos'
l
+=
[
KconfigCheck
(
'self_protection'
,
'clipos'
,
'DEBUG_VIRTUAL'
,
'y'
)]
l
+=
[
KconfigCheck
(
'self_protection'
,
'clipos'
,
'DEBUG_VIRTUAL'
,
'y'
)]
l
+=
[
KconfigCheck
(
'self_protection'
,
'clipos'
,
'STATIC_USERMODEHELPER'
,
'y'
)]
# needs userspace support
l
+=
[
KconfigCheck
(
'self_protection'
,
'clipos'
,
'STATIC_USERMODEHELPER'
,
'y'
)]
# needs userspace support
l
+=
[
OR
(
KconfigCheck
(
'self_protection'
,
'clipos'
,
'EFI_DISABLE_PCI_DMA'
,
'y'
),
efi_not_set
)]
l
+=
[
KconfigCheck
(
'self_protection'
,
'clipos'
,
'SLAB_MERGE_DEFAULT'
,
'is not set'
)]
l
+=
[
KconfigCheck
(
'self_protection'
,
'clipos'
,
'SLAB_MERGE_DEFAULT'
,
'is not set'
)]
l
+=
[
AND
(
KconfigCheck
(
'self_protection'
,
'clipos'
,
'RANDSTRUCT_PERFORMANCE'
,
'is not set'
),
KconfigCheck
(
'self_protection'
,
'clipos'
,
'GCC_PLUGIN_RANDSTRUCT_PERFORMANCE'
,
'is not set'
),
randstruct_is_set
)]
if
arch
in
(
'X86_64'
,
'ARM64'
,
'X86_32'
):
l
+=
[
AND
(
KconfigCheck
(
'self_protection'
,
'clipos'
,
'STACKLEAK_METRICS'
,
'is not set'
),
stackleak_is_set
,
gcc_plugins_support_is_set
)]
l
+=
[
AND
(
KconfigCheck
(
'self_protection'
,
'clipos'
,
'STACKLEAK_RUNTIME_DISABLE'
,
'is not set'
),
stackleak_is_set
,
gcc_plugins_support_is_set
)]
if
arch
in
(
'X86_64'
,
'X86_32'
):
if
arch
in
(
'X86_64'
,
'X86_32'
):
l
+=
[
AND
(
KconfigCheck
(
'self_protection'
,
'clipos'
,
'INTEL_IOMMU_DEFAULT_ON'
,
'y'
),
l
+=
[
AND
(
KconfigCheck
(
'self_protection'
,
'clipos'
,
'INTEL_IOMMU_DEFAULT_ON'
,
'y'
),
iommu_support_is_set
)]
iommu_support_is_set
)]
...
...
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