2023-05-23 14:18:54

by Alessandro Astone

[permalink] [raw]
Subject: Increasing the vm.max_map_count value

We are seeing userspace requiring more than the default 65330 mappings,
specifically some Windows games running through wine. We are looking into
changing the default in Fedora, but the source code includes a scary comment
about the current value:

> Default maximum number of active map areas, this limits the number of
vmas
> per mm struct. Users can overwrite this number by sysctl but there is a
> problem.
>
> When a program's coredump is generated as ELF format, a section is
created
> per a vma. In ELF, the number of sections is represented in unsigned
short.
> This means the number of sections should be smaller than 65535 at
coredump.
> Because the kernel adds some informative sections to a image of
program at
> generating coredump, we need some margin. The number of extra sections is
> 1-3 now and depends on arch. We use "5" as safe margin, here.

It seems that going over 16 bits would at least break ELF coredumps (for
programs actually requesting as many mappings).

Do you think it is otherwise safe to increase this value arbitrarily?