mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-08-01 00:22:49 +03:00
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:6d6a08547c
(cherry picked from commit950c0ed389
) (cherry picked from commit7822ae021b
)
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
4b0ae9d418
commit
f76e47b810
@ -58,17 +58,38 @@ static int load_kernel_syscalls(Set **ret) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int syscall_set_add(Set **s, const SyscallFilterSet *set) {
|
||||||
|
const char *sc;
|
||||||
|
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) {
|
static void syscall_set_remove(Set *s, const SyscallFilterSet *set) {
|
||||||
const char *syscall;
|
const char *sc;
|
||||||
|
|
||||||
if (!set)
|
if (!set)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NULSTR_FOREACH(syscall, set->value) {
|
NULSTR_FOREACH(sc, set->value) {
|
||||||
if (syscall[0] == '@')
|
if (sc[0] == '@')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
free(set_remove(s, syscall));
|
free(set_remove(s, sc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,17 +109,17 @@ static void dump_syscall_filter(const SyscallFilterSet *set) {
|
|||||||
|
|
||||||
int verb_syscall_filters(int argc, char *argv[], void *userdata) {
|
int verb_syscall_filters(int argc, char *argv[], void *userdata) {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
int r;
|
||||||
|
|
||||||
pager_open(arg_pager_flags);
|
pager_open(arg_pager_flags);
|
||||||
|
|
||||||
if (strv_isempty(strv_skip(argv, 1))) {
|
if (strv_isempty(strv_skip(argv, 1))) {
|
||||||
_cleanup_set_free_ Set *kernel = NULL, *known = NULL;
|
_cleanup_set_free_ Set *kernel = NULL, *known = NULL;
|
||||||
const char *sys;
|
|
||||||
int k = 0; /* explicit initialization to appease gcc */
|
int k = 0; /* explicit initialization to appease gcc */
|
||||||
|
|
||||||
NULSTR_FOREACH(sys, syscall_filter_sets[SYSCALL_FILTER_SET_KNOWN].value)
|
r = syscall_set_add(&known, syscall_filter_sets + SYSCALL_FILTER_SET_KNOWN);
|
||||||
if (set_put_strdup(&known, sys) < 0)
|
if (r < 0)
|
||||||
return log_oom();
|
return log_error_errno(r, "Failed to prepare set of known system calls: %m");
|
||||||
|
|
||||||
if (!arg_quiet)
|
if (!arg_quiet)
|
||||||
k = load_kernel_syscalls(&kernel);
|
k = load_kernel_syscalls(&kernel);
|
||||||
|
Reference in New Issue
Block a user