Add ARM64_BTI_KERNEL
[kconfig-hardened-check.git] / kconfig_hardened_check / __init__.py
index f82c07c45f3aa5f72e0d45dbdc7cfacfdbaf132e..eb256de8b2e95b47ede1045bbbab2535d7886f2b 100644 (file)
@@ -312,6 +312,7 @@ def construct_checklist(l, arch):
                      VerCheck((5, 9))))] # HARDEN_EL2_VECTORS was included in RANDOMIZE_BASE in v5.9
         l += [OptCheck('self_protection', 'defconfig', 'RODATA_FULL_DEFAULT_ENABLED', 'y')]
         l += [OptCheck('self_protection', 'defconfig', 'ARM64_PTR_AUTH', 'y')]
+        l += [OptCheck('self_protection', 'defconfig', 'ARM64_BTI_KERNEL', 'y')]
     if arch in ('X86_64', 'ARM64'):
         l += [OptCheck('self_protection', 'defconfig', 'VMAP_STACK', 'y')]
     if arch in ('X86_64', 'ARM64', 'X86_32'):
@@ -354,7 +355,7 @@ def construct_checklist(l, arch):
     l += [OR(OptCheck('self_protection', 'kspp', 'INIT_STACK_ALL', 'y'),
              OptCheck('self_protection', 'kspp', 'GCC_PLUGIN_STRUCTLEAK_BYREF_ALL', 'y'))]
     l += [OR(OptCheck('self_protection', 'kspp', 'INIT_ON_FREE_DEFAULT_ON', 'y'),
-             OptCheck('self_protection', 'kspp', 'PAGE_POISONING', 'y'))] # before v5.3
+             OptCheck('self_protection', 'kspp', 'PAGE_POISONING_ZERO', 'y'))] # before v5.3
     if arch in ('X86_64', 'ARM64', 'X86_32'):
         stackleak_is_set = OptCheck('self_protection', 'kspp', 'GCC_PLUGIN_STACKLEAK', 'y')
         l += [stackleak_is_set]
@@ -395,6 +396,9 @@ def construct_checklist(l, arch):
                   iommu_support_is_set)]
 
     # 'self_protection', 'my'
+    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':