From: Robert Swiecki Date: Fri, 6 Oct 2017 17:42:58 +0000 (+0200) Subject: pid: comment on the ns-init process X-Git-Tag: 1.9~34 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ee3d45445785800b23e1073fb7ac19e27f4e88c0;p=platform%2Fupstream%2Fnsjail.git pid: comment on the ns-init process --- diff --git a/pid.c b/pid.c index 3d4affe..42efb83 100644 --- a/pid.c +++ b/pid.c @@ -39,6 +39,11 @@ bool pidInitNs(struct nsjconf_t *nsjconf) LOG_D("Creating a dummy 'init' process"); + /* + * If -Me is used then we need to create permanent init inside PID ns, otherwise only the first + * clone/fork will work, and the rest will fail with ENOMEM (see 'man pid_namespaces' for + * details on this behavior) + */ pid_t pid = subprocClone(CLONE_FS); if (pid == -1) { PLOG_E("Couldn't create a dummy init process"); @@ -51,7 +56,7 @@ bool pidInitNs(struct nsjconf_t *nsjconf) if (prctl(PR_SET_PDEATHSIG, SIGKILL, 0UL, 0UL, 0UL) == -1) { PLOG_W("(prctl(PR_SET_PDEATHSIG, SIGKILL) failed"); } - if (prctl(PR_SET_NAME, "init", 0UL, 0UL, 0UL) == -1) { + if (prctl(PR_SET_NAME, "ns-init", 0UL, 0UL, 0UL) == -1) { PLOG_W("(prctl(PR_SET_NAME, 'init') failed"); } if (prctl(PR_SET_DUMPABLE, 0UL, 0UL, 0UL, 0UL) == -1) {