Page MenuHomeFreeBSD

crt_malloc: Be more persistent when handling mmap() failure
ClosedPublic

Authored by kib on Oct 12 2021, 9:48 PM.
Tags
None
Referenced Files
F102588238: D32474.id96767.diff
Thu, Nov 14, 11:14 AM
Unknown Object (File)
Thu, Nov 7, 2:50 AM
Unknown Object (File)
Tue, Nov 5, 12:28 PM
Unknown Object (File)
Thu, Oct 17, 11:16 AM
Unknown Object (File)
Tue, Oct 15, 11:19 PM
Unknown Object (File)
Oct 15 2024, 8:33 AM
Unknown Object (File)
Oct 15 2024, 8:33 AM
Unknown Object (File)
Oct 14 2024, 12:07 PM
Subscribers

Details

Summary
In the situation with limited address space, together with
fragmentation, it is possible for mmap() request in morecore() to fail
when asking for required size + NPOOLPAGES, but succeed without the
addend.  Retry allocation there.

PR:     259076
Reported by:    Denis Koreshkov <dynamic-wind@mail.ru>

Also

crt_malloc: use uintptr_t instead of long for arithmetic on addresses

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Oct 12 2021, 9:48 PM

LGTM. roundup2 usage can be simplified but feel free to ignore that suggestion.

libexec/rtld-elf/rtld_malloc.c
262

roundup2 is now type-preserving, so you should be able to pass a caddr_t argument.

This revision is now accepted and ready to land.Oct 12 2021, 10:17 PM