Skip to content

Commit d6a14fb

Browse files
committed
test: explicitly exclude restart_syscall from seccomp analysis
This syscall is inserted at runtime by the linux kernel, and thus not actually present in our binary. The static analysis tool thus correctly marks it as unused. Introduce an allowlist of syscalls that are ignored by the static analysis tool to deal with this. Signed-off-by: Patrick Roy <[email protected]>
1 parent 5cf6525 commit d6a14fb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/framework/static_analysis.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,12 @@ def load_seccomp_rules(seccomp_path: Path):
584584
return allowlist
585585

586586

587+
KNOWN_SUPERFLUOUS_RULES = {
588+
# This syscall is inserted at runtime by the linux kernel, and thus not actually present in our binary.
589+
"restart_syscall": [{}]
590+
}
591+
592+
587593
def determine_unneeded_seccomp_rules(seccomp_rules, found_syscalls):
588594
"""Based on the given list of syscall determined through static analysis, compute which of the
589595
given seccomp rules are redundant. By 'redundant' we here mean that no syscall that would match
@@ -596,6 +602,12 @@ def determine_unneeded_seccomp_rules(seccomp_rules, found_syscalls):
596602

597603
for syscall, rules in seccomp_rules.items():
598604
for allowed_arguments in rules:
605+
if (
606+
syscall in KNOWN_SUPERFLUOUS_RULES
607+
and allowed_arguments in KNOWN_SUPERFLUOUS_RULES[syscall]
608+
):
609+
continue
610+
599611
# A rule is not needed if for all actual invocation of the syscall the rule governs,
600612
# the rule does not match.
601613
# Here, we determine "does not match" as "the rule specifies some value for an argument of the syscall to be

0 commit comments

Comments
 (0)