]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
attach: be paranoid about file descriptors 3692/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 24 Feb 2021 00:53:05 +0000 (01:53 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 24 Feb 2021 00:53:05 +0000 (01:53 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/attach.c

index 9b79158603569669be186817f08fa51970bf3ea2..f1700da4f434960a501dfffa66c99ed0d812466d 100644 (file)
@@ -1657,6 +1657,13 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
                TRACE("Moved transient process %d into container cgroup", pid);
        }
 
+       /*
+        * Close sensitive file descriptors we don't need anymore. Even if
+        * we're the parent.
+        */
+       if (!attach_context_security_barrier(ctx))
+               goto on_error;
+
        /* Setup /proc limits */
        if (!lxc_list_empty(&conf->procs)) {
                ret = setup_proc_filesystem(&conf->procs, pid);