]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: drop meaningless parse_syscall_and_errno() calls
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 8 Mar 2021 02:54:05 +0000 (11:54 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 8 Mar 2021 12:26:13 +0000 (21:26 +0900)
parse_syscall_and_errno() does not check the validity of syscall name or
syscall group name, but it just split into syscall name and errno.
So, it is not necessary to call it for SystemCallLog=.

src/core/dbus-execute.c
src/core/load-fragment.c

index b664bbffa674e3db63e072c4fd5e575d1c3e40ea..399986db4a441f4dcf3c7365df1cf9d14551dfa5 100644 (file)
@@ -2315,15 +2315,8 @@ int bus_exec_context_set_transient_property(
                         }
 
                         STRV_FOREACH(s, l) {
-                                _cleanup_free_ char *n = NULL;
-                                int e;
-
-                                r = parse_syscall_and_errno(*s, &n, &e);
-                                if (r < 0)
-                                        return r;
-
-                                r = seccomp_parse_syscall_filter(n,
-                                                                 0, /* errno not used */
+                                r = seccomp_parse_syscall_filter(*s,
+                                                                 -1, /* errno not used */
                                                                  c->syscall_log,
                                                                  SECCOMP_PARSE_LOG | SECCOMP_PARSE_PERMISSIVE |
                                                                  invert_flag |
index f9c334cc65ed2a178db05db165188c04290c1767..41ee7b643805ce792a9795780b0595723272bc03 100644 (file)
@@ -3280,8 +3280,7 @@ int config_parse_syscall_log(
 
         p = rvalue;
         for (;;) {
-                _cleanup_free_ char *word = NULL, *name = NULL;
-                int num;
+                _cleanup_free_ char *word = NULL;
 
                 r = extract_first_word(&p, &word, NULL, 0);
                 if (r == 0)
@@ -3293,14 +3292,8 @@ int config_parse_syscall_log(
                         return 0;
                 }
 
-                r = parse_syscall_and_errno(word, &name, &num);
-                if (r < 0 || num >= 0) { /* errno code not allowed */
-                        log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse syscall, ignoring: %s", word);
-                        continue;
-                }
-
                 r = seccomp_parse_syscall_filter(
-                                name, 0, c->syscall_log,
+                                word, -1, c->syscall_log,
                                 SECCOMP_PARSE_LOG|SECCOMP_PARSE_PERMISSIVE|
                                 (invert ? SECCOMP_PARSE_INVERT : 0)|
                                 (c->syscall_log_allow_list ? SECCOMP_PARSE_ALLOW_LIST : 0),