- if i == 0 or not hasattr(opt, 'expected'):
+ if opt.result != 'OK' or i == 0:
+ # Preserve additional explanation of this OK result.
+ # Simple OK is enough only for the main option that
+ # this OR-check is about.
self.result = 'OK: CONFIG_{} "{}"'.format(opt.name, opt.expected)
return True
self.result = self.opts[0].result
self.result = 'OK: CONFIG_{} "{}"'.format(opt.name, opt.expected)
return True
self.result = self.opts[0].result
- if hasattr(opt, 'expected'):
+ # This FAIL is caused by additional checks,
+ # and not by the main option that this AND-check is about.
+ if opt.result.startswith('FAIL: \"'):
+ # Describe the reason of the FAIL.
l += [OptCheck('self_protection', 'defconfig', 'ARM64_PAN', 'y')]
l += [OptCheck('self_protection', 'defconfig', 'UNMAP_KERNEL_AT_EL0', 'y')]
l += [OR(OptCheck('self_protection', 'defconfig', 'HARDEN_EL2_VECTORS', 'y'),
l += [OptCheck('self_protection', 'defconfig', 'ARM64_PAN', 'y')]
l += [OptCheck('self_protection', 'defconfig', 'UNMAP_KERNEL_AT_EL0', 'y')]
l += [OR(OptCheck('self_protection', 'defconfig', 'HARDEN_EL2_VECTORS', 'y'),
- VerCheck((5,9)))] # HARDEN_EL2_VECTORS was removed in v5.9
+ AND(OptCheck('self_protection', 'defconfig', 'RANDOMIZE_BASE', 'y'),
+ 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')]
if arch in ('X86_64', 'ARM64'):
l += [OptCheck('self_protection', 'defconfig', 'RODATA_FULL_DEFAULT_ENABLED', 'y')]
l += [OptCheck('self_protection', 'defconfig', 'ARM64_PTR_AUTH', 'y')]
if arch in ('X86_64', 'ARM64'):
print('[+] Config check is finished: \'OK\' - {}{} / \'FAIL\' - {}{}'.format(ok_count, ok_suppressed, fail_count, fail_suppressed))
print('[+] Config check is finished: \'OK\' - {}{} / \'FAIL\' - {}{}'.format(ok_count, ok_suppressed, fail_count, fail_suppressed))
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 not hasattr(opt, 'state'):
sys.exit('[!] ERROR: bad simple check {}'.format(vars(opt)))
opt.state = parsed_options.get(opt.name, None)
opt.check()
def parse_config_file(parsed_options, fname):
with open(fname, 'r') as f:
opt_is_on = re.compile("CONFIG_[a-zA-Z0-9_]*=[a-zA-Z0-9_\"]*")
def parse_config_file(parsed_options, fname):
with open(fname, 'r') as f:
opt_is_on = re.compile("CONFIG_[a-zA-Z0-9_]*=[a-zA-Z0-9_\"]*")