There is a limit on the number of lines in the /proc/<pid>/{g,u}id_map
files. In Linux 4.14 and earlier, this limit was (arbitrarily) set at
5 lines. Since Linux 4.15, which was released on 28 Jan 2018, the limit
is 340 lines.
This change is documented in user_namespaces(7).
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=
6397fac4915ab3002dc15aae751455da1a852f25
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
size_t i;
int ret = -1;
+ /* The kernel supports up to 340 lines in /proc/<pid>/{g,u}id_map */
+ if (num > 340) {
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Too many id mappings defined."));
+ goto cleanup;
+ }
+
for (i = 0; i < num; i++)
virBufferAsprintf(&map_value, "%u %u %u\n",
map[i].start, map[i].target, map[i].count);