[lxc-devel] [lxc/master] execute: pass /proc/self/fd/<nr>

brauner on Github lxc-bot at linuxcontainers.org
Thu Aug 23 15:37:53 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 558 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180823/4191821c/attachment.bin>
-------------- next part --------------
From e8f0f7739d5756914b17a391a3c91f62a4054912 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 23 Aug 2018 17:35:40 +0200
Subject: [PATCH] execute: pass /proc/self/fd/<nr>

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 at ubuntu.com>
---
 src/lxc/execute.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/execute.c b/src/lxc/execute.c
index 26b8fa864..dc23bb3ea 100644
--- a/src/lxc/execute.c
+++ b/src/lxc/execute.c
@@ -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;
 


More information about the lxc-devel mailing list