diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-03-24 11:35:55 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-03-24 12:29:30 +0100 |
commit | 950c0ed38935198a67a57c645e499555eaf006eb (patch) | |
tree | bff91a7f8fe250161d8b285f1d33ef722c75d50e /src/analyze | |
parent | 50524bd8879072ee41e539de768d4ab4a2792060 (diff) | |
download | systemd-950c0ed38935198a67a57c645e499555eaf006eb.tar.gz |
analyze: don't claim "@known" was an unlisted syscall
It's a sycall group of our own definition, and the output is erroneous
to claim otherwise. Let's hide it.
This adds syscall_set_add() which is nicely symmetric to the existing
syscall_set_remove().
Follow-up for: 6d6a08547c03f96dc798cda1ef4a8d3013d292d5
Diffstat (limited to 'src/analyze')
-rw-r--r-- | src/analyze/analyze-syscall-filter.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/analyze/analyze-syscall-filter.c b/src/analyze/analyze-syscall-filter.c index 50662da062..66a52da897 100644 --- a/src/analyze/analyze-syscall-filter.c +++ b/src/analyze/analyze-syscall-filter.c @@ -58,15 +58,35 @@ static int load_kernel_syscalls(Set **ret) { return 0; } +static int syscall_set_add(Set **s, const SyscallFilterSet *set) { + int r; + + assert(s); + + if (!set) + return 0; + + NULSTR_FOREACH(sc, set->value) { + if (sc[0] == '@') + continue; + + r = set_put_strdup(s, sc); + if (r < 0) + return r; + } + + return 0; +} + static void syscall_set_remove(Set *s, const SyscallFilterSet *set) { if (!set) return; - NULSTR_FOREACH(syscall, set->value) { - if (syscall[0] == '@') + NULSTR_FOREACH(sc, set->value) { + if (sc[0] == '@') continue; - free(set_remove(s, syscall)); + free(set_remove(s, sc)); } } @@ -84,6 +104,7 @@ static void dump_syscall_filter(const SyscallFilterSet *set) { int verb_syscall_filters(int argc, char *argv[], void *userdata) { bool first = true; + int r; pager_open(arg_pager_flags); @@ -91,9 +112,9 @@ int verb_syscall_filters(int argc, char *argv[], void *userdata) { _cleanup_set_free_ Set *kernel = NULL, *known = NULL; int k = 0; /* explicit initialization to appease gcc */ - NULSTR_FOREACH(sys, syscall_filter_sets[SYSCALL_FILTER_SET_KNOWN].value) - if (set_put_strdup(&known, sys) < 0) - return log_oom(); + r = syscall_set_add(&known, syscall_filter_sets + SYSCALL_FILTER_SET_KNOWN); + if (r < 0) + return log_error_errno(r, "Failed to prepare set of known system calls: %m"); if (!arg_quiet) k = load_kernel_syscalls(&kernel); |