From: Christian Brauner Date: Mon, 27 Jul 2020 08:12:16 +0000 (+0200) Subject: seccomp: remove seccomp fd from event loop after task exited X-Git-Tag: lxc-5.0.0~380^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2acb9dce972ed52905903e325896b8a11b6799a;p=thirdparty%2Flxc.git seccomp: remove seccomp fd from event loop after task exited Linux v5.8 will land my patch where seccomp notifies when a filter goes unused, i.e. when the last task using a given seccomp filter has exited. This wasn't possible before and so we accumulated file descriptors in the container's event loop whenever we attached to the container. I'm not sure whether the task exiting before we could handle its syscall should cause us to report and error or not. For now, let's simply close the event loop and not report an error. Signed-off-by: Christian Brauner --- diff --git a/src/lxc/seccomp.c b/src/lxc/seccomp.c index 66f9a70f2..55216bc0b 100644 --- a/src/lxc/seccomp.c +++ b/src/lxc/seccomp.c @@ -1373,6 +1373,9 @@ int seccomp_notify_handler(int fd, uint32_t events, void *data, char *cookie = conf->seccomp.notifier.cookie; uint64_t req_id; + if (events & EPOLLHUP) + return log_trace(LXC_MAINLOOP_CLOSE, "Syscall supervisee already exited"); + memset(req, 0, sizeof(*req)); ret = seccomp_notify_receive(fd, req); if (ret) {