diff options
author | Luca Boccassi <bluca@debian.org> | 2024-06-25 14:44:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-25 14:44:21 +0200 |
commit | 4d2a86936a9d834a1d59d00be92f32df50be1807 (patch) | |
tree | 0c16a76d53217cfb665c7a406cb175690a51f635 /src/core | |
parent | Merge pull request #33450 from yuwata/network-ndisc-do-not-override-static-ro... (diff) | |
parent | test-execute: add a test case for issue #33299 (diff) | |
download | systemd-4d2a86936a9d834a1d59d00be92f32df50be1807.tar.xz systemd-4d2a86936a9d834a1d59d00be92f32df50be1807.zip |
Merge pull request #33451 from yuwata/core-exec-use-write
core: use write() instead of send()
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/exec-invoke.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/exec-invoke.c b/src/core/exec-invoke.c index ec5684d1a5..3f713e731f 100644 --- a/src/core/exec-invoke.c +++ b/src/core/exec-invoke.c @@ -1439,6 +1439,13 @@ static int apply_syscall_filter(const ExecContext *c, const ExecParameters *p, b return r; } + /* Sending over exec_fd or handoff_timestamp_fd requires write() syscall. */ + if (p->exec_fd >= 0 || p->handoff_timestamp_fd >= 0) { + r = seccomp_filter_set_add_by_name(c->syscall_filter, c->syscall_allow_list, "write"); + if (r < 0) + return r; + } + return seccomp_load_syscall_filter_set_raw(default_action, c->syscall_filter, action, false); } @@ -4013,7 +4020,7 @@ static int send_handoff_timestamp( dual_timestamp dt; dual_timestamp_now(&dt); - if (send(p->handoff_timestamp_fd, (const usec_t[2]) { dt.realtime, dt.monotonic }, sizeof(usec_t) * 2, 0) < 0) { + if (write(p->handoff_timestamp_fd, (const usec_t[2]) { dt.realtime, dt.monotonic }, sizeof(usec_t) * 2) < 0) { if (reterr_exit_status) *reterr_exit_status = EXIT_EXEC; return log_exec_error_errno(c, p, errno, "Failed to send handoff timestamp: %m"); |