SLUB_DEBUG_ON is very slow, leave it for the kernel command line
[kconfig-hardened-check.git] / kconfig_hardened_check / __init__.py
index a5bac1c2348f4e4056abd6dcae58a601eeaff46a..28ab04e105d342f201f51a2986619e739460f8b4 100644 (file)
 #
 #
 # N.B Hardening command line parameters:
-#    slub_debug=FZP
 #    slab_nomerge
 #    page_alloc.shuffle=1
 #    iommu=force (does it help against DMA attacks?)
+#    slub_debug=FZ (slow)
 #    page_poison=1 (if enabled)
 #    init_on_alloc=1
 #    init_on_free=1
@@ -322,7 +322,10 @@ def construct_checklist(l, arch):
     if arch == 'ARM':
         l += [OptCheck('self_protection', 'defconfig', 'CPU_SW_DOMAIN_PAN', 'y')]
         l += [OptCheck('self_protection', 'defconfig', 'STACKPROTECTOR_PER_TASK', 'y')]
-    if arch in ('ARM64', 'ARM'):
+    if arch == 'ARM64':
+        l += [OR(OptCheck('self_protection', 'defconfig', 'HARDEN_BRANCH_PREDICTOR', 'y'),
+             VerCheck((5, 10)))] # HARDEN_BRANCH_PREDICTOR is enabled by default since v5.10
+    if arch == 'ARM':
         l += [OptCheck('self_protection', 'defconfig', 'HARDEN_BRANCH_PREDICTOR', 'y')]
 
     # 'self_protection', 'kspp'
@@ -400,7 +403,6 @@ def construct_checklist(l, arch):
     l += [AND(OptCheck('self_protection', 'my', 'UBSAN_BOUNDS', 'y'),
               OptCheck('self_protection', 'my', 'UBSAN_MISC', 'is not set'),
               OptCheck('self_protection', 'my', 'UBSAN_TRAP', 'y'))]
-    l += [OptCheck('self_protection', 'my', 'SLUB_DEBUG_ON', 'y')] # TODO: is it better to set that via kernel cmd?
     l += [OptCheck('self_protection', 'my', 'RESET_ATTACK_MITIGATION', 'y')] # needs userspace support (systemd)
     if arch == 'X86_64':
         l += [AND(OptCheck('self_protection', 'my', 'AMD_IOMMU_V2', 'y'),