rootless: exec handle processes that create an user namespace

Manage the case where the main process of the container creates and
joins a new user namespace.

In this case we want to join only the first child in the new
hierarchy, which is the user namespace that was used to create the
container.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1331
Approved by: rhatdan
This commit is contained in:
Giuseppe Scrivano
2018-08-24 12:15:34 +02:00
committed by Atomic Bot
parent 720eb85ba5
commit c5753f57c1
5 changed files with 127 additions and 15 deletions

View File

@ -335,11 +335,7 @@ func (c *Container) Exec(tty, privileged bool, env, cmd []string, user string) e
execCmd, err := c.runtime.ociRuntime.execContainer(c, cmd, capList, env, tty, hostUser, sessionID)
if err != nil {
return errors.Wrapf(err, "error creating exec command for container %s", c.ID())
}
if err := execCmd.Start(); err != nil {
return errors.Wrapf(err, "error starting exec command for container %s", c.ID())
return errors.Wrapf(err, "error exec %s", c.ID())
}
pidFile := c.execPidPath(sessionID)