diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-10-14 10:31:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-14 10:31:59 +0200 |
commit | a748b122be6472de2db5090d6fa3ce7a1818d4c6 (patch) | |
tree | 729d019eddadf2b403bcb78c9da4082e9f8eb521 /src/analyze | |
parent | 5fad3913e2db5eda2339419e049af88953c17ff3 (diff) | |
download | systemd-a748b122be6472de2db5090d6fa3ce7a1818d4c6.tar.gz |
analyze: show ungrouped syscalls separately (#17343)
This updates the "systemd-analyze syscall-filter" command to show a
special section of syscalls that are included in @known but in no other
group. Typically this should show syscalls we either should add to any
of the existing groups or where we unsure were they best fit in.
Right now, it mostly shows arch-specific compat syscalls, we probably
should move "@obsolete". This patch doesn't add thta however.
Diffstat (limited to 'src/analyze')
-rw-r--r-- | src/analyze/analyze.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c index 591ba6d33c..9a0b1a7bbf 100644 --- a/src/analyze/analyze.c +++ b/src/analyze/analyze.c @@ -1685,7 +1685,7 @@ static int load_kernel_syscalls(Set **ret) { return 0; } -static void kernel_syscalls_remove(Set *s, const SyscallFilterSet *set) { +static void syscall_set_remove(Set *s, const SyscallFilterSet *set) { const char *syscall; NULSTR_FOREACH(syscall, set->value) { @@ -1716,9 +1716,14 @@ static int dump_syscall_filters(int argc, char *argv[], void *userdata) { (void) pager_open(arg_pager_flags); if (strv_isempty(strv_skip(argv, 1))) { - _cleanup_set_free_ Set *kernel = NULL; + _cleanup_set_free_ Set *kernel = NULL, *known = NULL; + const char *sys; int i, k; + NULSTR_FOREACH(sys, syscall_filter_sets[SYSCALL_FILTER_SET_KNOWN].value) + if (set_put_strdup(&known, sys) < 0) + return log_oom(); + k = load_kernel_syscalls(&kernel); for (i = 0; i < _SYSCALL_FILTER_SET_MAX; i++) { @@ -1727,10 +1732,30 @@ static int dump_syscall_filters(int argc, char *argv[], void *userdata) { puts(""); dump_syscall_filter(set); - kernel_syscalls_remove(kernel, set); + syscall_set_remove(kernel, set); + if (i != SYSCALL_FILTER_SET_KNOWN) + syscall_set_remove(known, set); first = false; } + if (!set_isempty(known)) { + _cleanup_free_ char **l = NULL; + char **syscall; + + printf("\n" + "# %sUngrouped System Calls%s (known but not included in any of the groups except @known):\n", + ansi_highlight(), ansi_normal()); + + l = set_get_strv(known); + if (!l) + return log_oom(); + + strv_sort(l); + + STRV_FOREACH(syscall, l) + printf("# %s\n", *syscall); + } + if (k < 0) { fputc('\n', stdout); fflush(stdout); |