From c004ff7745a3f12a2cb251ed7edd4a929704501e Mon Sep 17 00:00:00 2001 From: Andrey Vagin Date: Fri, 31 Oct 2014 12:14:30 +0300 Subject: [PATCH] restore: set PR_SET_DUMPABLE to have access to proc files It is cleared when a process is forked in a new userns. Signed-off-by: Andrey Vagin Signed-off-by: Pavel Emelyanov --- namespaces.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/namespaces.c b/namespaces.c index 54325f3a6..db13813a0 100644 --- a/namespaces.c +++ b/namespaces.c @@ -836,6 +836,17 @@ static int prepare_userns_creds() return -1; } + /* + * This flag is dropped after entering userns, but is + * required to access files in /proc, so put one here + * temoprarily. It will be set to proper value at the + * very end. + */ + if (prctl(PR_SET_DUMPABLE, 1, 0)) { + pr_perror("Unable to set PR_SET_DUMPABLE"); + exit(1); + } + return 0; }