about summary refs log tree commit diff
path: root/inet/netinet
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2022-08-15 16:45:40 +0200
committerFlorian Weimer <fweimer@redhat.com>2022-08-15 16:45:40 +0200
commit85860ad6eaf4c9739318f6b2a1ff7c2fa6b12ab5 (patch)
treedf93f85338333de44d8ee2002ff855da0927c573 /inet/netinet
parentf82e05ebb295cadd35f7372f652c72264da810ad (diff)
downloadglibc-85860ad6eaf4c9739318f6b2a1ff7c2fa6b12ab5.tar.gz
glibc-85860ad6eaf4c9739318f6b2a1ff7c2fa6b12ab5.tar.xz
glibc-85860ad6eaf4c9739318f6b2a1ff7c2fa6b12ab5.zip
malloc: Do not use MAP_NORESERVE to allocate heap segments
Address space for heap segments is reserved in a mmap call with
MAP_ANONYMOUS | MAP_PRIVATE and protection flags PROT_NONE.  This
reservation does not count against the RSS limit of the process or
system.  Backing memory is allocated using mprotect in alloc_new_heap
and grow_heap, and at this point, the allocator expects the kernel
to provide memory (subject to memory overcommit).

The SIGSEGV that might generate due to MAP_NORESERVE (according to
the mmap manual page) does not seem to occur in practice, it's always
SIGKILL from the OOM killer.  Even if there is a way that SIGSEGV
could be generated, it is confusing to applications that this only
happens for secondary heaps, not for large mmap-based allocations,
and not for the main arena.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'inet/netinet')
0 files changed, 0 insertions, 0 deletions