From net/ipv4/sysctl_net_ipv4.c:
static int ipv4_ping_group_range(struct ctl_table *table, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos)
{
...
if (write && ret == 0) {
low = make_kgid(user_ns, urange[0]);
high = make_kgid(user_ns, urange[1]);
if (!gid_valid(low) || !gid_valid(high) ||
(urange[1] < urange[0]) || gid_lt(high, low)) {
low = make_kgid(&init_user_ns, 1);
high = make_kgid(&init_user_ns, 0);
}
set_ping_group_range(table, low, high);
}
return ret;
}
So what this means is that if either the minimum or maximum GID value in the specified range is not valid inside of the user namespace, the kernel will (silently) set the sysctl’s value to the range of “1 0” from the init user namespace (IMO, it should be returning an error in this situation).
After the write has silently failed and you read back the sysctl value, the kernel does something silly by reporting that the min and max values of the GID range are the overflow gid (DEFAULT_OVERFLOWGID
in the source code) since the actual sysctl value doesn’t map to a valid GID range inside the container. This is why you see 65534 65534
when reading the sysctl from inside the 18.04 container.
I suspect that in your 16.04 container, 429296729
is a valid GID and that your 18.04 container is configured differently in a way that 2000000
is not a valid GID inside the container.
@stgraber’s request for the gid_map
contents will give us useful information. Please include the gid_map
contents from both containers.