]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
execute: pass /proc/self/fd/<nr> 2570/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 23 Aug 2018 15:35:40 +0000 (17:35 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 23 Aug 2018 15:43:03 +0000 (17:43 +0200)
Passing /proc/1/fd/<nr> presupposes that CLONE_NEWPID was specified. This isn't
the case when users use lxc.namespace.keep = pid to inherit pid namespaces.
Pass /proc/self/fd/<nr> instead.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Reported-by: Mrinal Dhillon <mdhillon@juniper.net>
src/lxc/execute.c

index 26b8fa8647ed8a2f41b70c421fe5b068b809714c..dc23bb3ea71aafccd100767bebd6c30b1250b66d 100644 (file)
@@ -95,7 +95,7 @@ static int execute_start(struct lxc_handler *handler, void* data)
                        goto out2;
                }
 
-               ret = snprintf(logfile, sizeof(logfile), "/proc/1/fd/%d", logfd);
+               ret = snprintf(logfile, sizeof(logfile), "/proc/self/fd/%d", logfd);
                if (ret < 0 || (size_t)ret >= sizeof(logfile))
                        goto out3;