Add ARM64_MTE for userspace
[kconfig-hardened-check.git] / kconfig_hardened_check / __init__.py
index f6bc68c0df2a219ab9ba8d5a77db7e48c950a96a..a5bac1c2348f4e4056abd6dcae58a601eeaff46a 100644 (file)
@@ -19,6 +19,7 @@
 #    init_on_alloc=1
 #    init_on_free=1
 #    loadpin.enforce=1
+#    debugfs=no-mount (or off if possible)
 #
 #    Mitigations of CPU vulnerabilities:
 #       Аrch-independent:
@@ -405,7 +406,7 @@ def construct_checklist(l, arch):
         l += [AND(OptCheck('self_protection', 'my', 'AMD_IOMMU_V2', 'y'),
                   iommu_support_is_set)]
     if arch == 'ARM64':
-        l += [OptCheck('self_protection', 'my', 'SHADOW_CALL_STACK', 'y')]
+        l += [OptCheck('self_protection', 'my', 'SHADOW_CALL_STACK', 'y')] # maybe it should be alternative to STACKPROTECTOR_STRONG
 
     # 'security_policy'
     if arch in ('X86_64', 'ARM64', 'X86_32'):
@@ -525,6 +526,8 @@ def construct_checklist(l, arch):
         l += [OptCheck('userspace_hardening', 'defconfig', 'INTEGRITY', 'y')]
     if arch == 'ARM':
         l += [OptCheck('userspace_hardening', 'my', 'INTEGRITY', 'y')]
+    if arch == 'ARM64':
+        l += [OptCheck('userspace_hardening', 'defconfig', 'ARM64_MTE', 'y')]
     if arch in ('ARM', 'X86_32'):
         l += [OptCheck('userspace_hardening', 'defconfig', 'VMSPLIT_3G', 'y')]
     if arch in ('X86_64', 'ARM64'):
@@ -601,22 +604,22 @@ def print_checklist(mode, checklist, with_results):
 
 
 def perform_check(opt, parsed_options, kernel_version):
-        if hasattr(opt, 'opts'):
-            # prepare ComplexOptCheck
-            for o in opt.opts:
-                if hasattr(o, 'opts'):
-                    # Recursion for nested ComplexOptChecks
-                    perform_check(o, parsed_options, kernel_version)
-                if hasattr(o, 'state'):
-                    o.state = parsed_options.get(o.name, None)
-                if hasattr(o, 'ver'):
-                    o.ver = kernel_version
-        else:
-            # prepare simple check, opt.state is mandatory
-            if not hasattr(opt, 'state'):
-                sys.exit('[!] ERROR: bad simple check {}'.format(vars(opt)))
-            opt.state = parsed_options.get(opt.name, None)
-        opt.check()
+    if hasattr(opt, 'opts'):
+        # prepare ComplexOptCheck
+        for o in opt.opts:
+            if hasattr(o, 'opts'):
+                # Recursion for nested ComplexOptChecks
+                perform_check(o, parsed_options, kernel_version)
+            if hasattr(o, 'state'):
+                o.state = parsed_options.get(o.name, None)
+            if hasattr(o, 'ver'):
+                o.ver = kernel_version
+    else:
+        # prepare simple check, opt.state is mandatory
+        if not hasattr(opt, 'state'):
+            sys.exit('[!] ERROR: bad simple check {}'.format(vars(opt)))
+        opt.state = parsed_options.get(opt.name, None)
+    opt.check()
 
 
 def perform_checks(checklist, parsed_options, kernel_version):