From 01617bdd2b47d4e75894ae6e2061334ac1868798 Mon Sep 17 00:00:00 2001 From: Eneas U de Queiroz Date: Wed, 6 Sep 2023 14:20:53 -0300 Subject: [PATCH] Skip unprivileged_bpf_disabled if BPF_SYSCALL not set Signed-off-by: Eneas U de Queiroz --- kernel_hardening_checker/checks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel_hardening_checker/checks.py b/kernel_hardening_checker/checks.py index fa5c08a..9f48d58 100644 --- a/kernel_hardening_checker/checks.py +++ b/kernel_hardening_checker/checks.py @@ -676,7 +676,9 @@ def add_sysctl_checks(l, _arch): have_config_file))] l += [SysctlCheck('cut_attack_surface', 'kspp', 'user.max_user_namespaces', '0')] # may break the upower daemon in Ubuntu l += [SysctlCheck('cut_attack_surface', 'kspp', 'dev.tty.ldisc_autoload', '0')] - l += [SysctlCheck('cut_attack_surface', 'kspp', 'kernel.unprivileged_bpf_disabled', '1')] + l += [OR(SysctlCheck('cut_attack_surface', 'kspp', 'kernel.unprivileged_bpf_disabled', '1'), + AND(KconfigCheck('cut_attack_surface', 'lockdown', 'BPF_SYSCALL', 'is not set'), + have_config_file))] l += [SysctlCheck('cut_attack_surface', 'kspp', 'kernel.kptr_restrict', '2')] l += [SysctlCheck('cut_attack_surface', 'kspp', 'dev.tty.legacy_tiocsti', '0')] l += [SysctlCheck('cut_attack_surface', 'kspp', 'vm.unprivileged_userfaultfd', '0')] -- 2.31.1