diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2022-11-14 23:00:27 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-11-16 15:11:13 +0100 |
commit | b27d6d121c8fad94658bbcf433e99f7fff542550 (patch) | |
tree | cd63cf53f155a67f02d60ed9c96c1a8f599aba2f /util.c | |
parent | 5f7446501052233e472cb1e6b3f403c7923ce90a (diff) | |
download | passt-b27d6d121c8fad94658bbcf433e99f7fff542550.tar passt-b27d6d121c8fad94658bbcf433e99f7fff542550.tar.gz passt-b27d6d121c8fad94658bbcf433e99f7fff542550.tar.bz2 passt-b27d6d121c8fad94658bbcf433e99f7fff542550.tar.lz passt-b27d6d121c8fad94658bbcf433e99f7fff542550.tar.xz passt-b27d6d121c8fad94658bbcf433e99f7fff542550.tar.zst passt-b27d6d121c8fad94658bbcf433e99f7fff542550.zip |
arp, tap, util: Don't use perror() after seccomp filter is installed
If stderr is closed, after we fork to background, glibc's
implementation of perror() will try to re-open it by calling dup(),
upon which the seccomp filter causes the process to terminate,
because dup() is not included in the list of allowed syscalls.
Replace perror() calls that might happen after isolation_postfork().
We could probably replace all of them, but early ones need a bit more
attention as we have to check whether log.c functions work in early
stages.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -125,7 +125,7 @@ int sock_l4(const struct ctx *c, int af, uint8_t proto, fd = socket(af, SOCK_DGRAM | SOCK_NONBLOCK, proto); if (fd < 0) { - perror("L4 socket"); + warn("L4 socket: %s", strerror(errno)); return -1; } @@ -193,7 +193,7 @@ int sock_l4(const struct ctx *c, int af, uint8_t proto, } if (proto == IPPROTO_TCP && listen(fd, 128) < 0) { - perror("TCP socket listen"); + warn("TCP socket listen: %s", strerror(errno)); close(fd); return -1; } @@ -201,7 +201,7 @@ int sock_l4(const struct ctx *c, int af, uint8_t proto, ev.events = EPOLLIN; ev.data.u64 = ref.u64; if (epoll_ctl(c->epollfd, EPOLL_CTL_ADD, fd, &ev) == -1) { - perror("L4 epoll_ctl"); + warn("L4 epoll_ctl: %s", strerror(errno)); return -1; } |