diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-01-10 22:22:37 +0100 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-01-10 22:33:30 +0100 |
commit | 7a11ed5a77a631ea055dd09fbaca3111e5530085 (patch) | |
tree | 6874393642a12513453905c8b66119c55a04165f /libpod/container_api.go | |
parent | e1ffac6cc73eb36640cbaf6a1a28ba44749a96d9 (diff) | |
download | podman-7a11ed5a77a631ea055dd09fbaca3111e5530085.tar.gz podman-7a11ed5a77a631ea055dd09fbaca3111e5530085.tar.bz2 podman-7a11ed5a77a631ea055dd09fbaca3111e5530085.zip |
libpod: fix --userns=keep-id with big UIDs
when creating a keep-id namespace, we split the original user
namespace in:
inner ns | outer ns | size:
0 | 1 | ID
ID | 0 | 1
ID+1 | ID+1 | availableIds - ID
When the user ID is bigger than the number of available
subuids/subgids we fail to create the user namespace because the first
slice is bigger than the available number of IDs and the third one has
a negative size.
Fix it by not using more than the available number of IDs in the first
slice and creating the third one only if there are other IDs left.
When the user ID is bigger than the number of additional IDs, there
will be a gap between the two mappings so the IDs between the maximum
additional ID and the user ID won't be present inside of the
namespace.
Closes: https://github.com/containers/libpod/issues/4838
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'libpod/container_api.go')
0 files changed, 0 insertions, 0 deletions