From 4e999f237877532077090f17d76e47f9b535e3f7 Mon Sep 17 00:00:00 2001 From: Alban Crequy Date: Thu, 8 Mar 2018 19:45:26 +0100 Subject: [PATCH] runtimetest: fix uid_map parsing The fields of /proc/$pid/uid_map and /proc/$pid/gid_map were parsed in the wrong order. Related: https://github.com/opencontainers/runtime-spec/pull/956 Signed-off-by: Alban Crequy --- cmd/runtimetest/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/runtimetest/main.go b/cmd/runtimetest/main.go index b754294a7..a0dd592a2 100644 --- a/cmd/runtimetest/main.go +++ b/cmd/runtimetest/main.go @@ -632,11 +632,13 @@ func getIDMappings(path string) ([]rspec.LinuxIDMapping, error) { idMap := strings.Fields(strings.TrimSpace(s.Text())) if len(idMap) == 3 { - hostID, err := strconv.ParseUint(idMap[0], 0, 32) + // "man 7 user_namespaces" explains the format of uid_map and gid_map: + // + containerID, err := strconv.ParseUint(idMap[0], 0, 32) if err != nil { return nil, err } - containerID, err := strconv.ParseUint(idMap[1], 0, 32) + hostID, err := strconv.ParseUint(idMap[1], 0, 32) if err != nil { return nil, err }