*: correctly chown() consoles

In user namespaces, we need to make sure we don't chown() the console to
unmapped users. This means we need to get both the UID and GID of the
root user in the container when changing the owner.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
This commit is contained in:
Aleksa Sarai
2016-04-23 23:39:38 +10:00
parent 60eb77dd3c
commit 1a913c7b89
6 changed files with 23 additions and 17 deletions
+2 -1
View File
@@ -117,6 +117,7 @@ using the runc checkpoint command.`,
func restoreContainer(context *cli.Context, spec *specs.Spec, config *configs.Config, imagePath string) (code int, err error) {
var (
rootuid = 0
rootgid = 0
id = context.Args().First()
)
factory, err := loadFactory(context)
@@ -149,7 +150,7 @@ func restoreContainer(context *cli.Context, spec *specs.Spec, config *configs.Co
defer destroy(container)
}
process := &libcontainer.Process{}
tty, err := setupIO(process, rootuid, "", false, detach)
tty, err := setupIO(process, rootuid, rootgid, "", false, detach)
if err != nil {
return -1, err
}