git: e5a8b8152ade - stable/13 - crt_malloc: Be more persistent when handling mmap() failure
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 23 Oct 2021 01:12:27 UTC
The branch stable/13 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=e5a8b8152ade3c658a9a180f0bd2f6ae82302948
commit e5a8b8152ade3c658a9a180f0bd2f6ae82302948
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-10-11 16:13:31 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-10-22 23:32:27 +0000
crt_malloc: Be more persistent when handling mmap() failure
PR: 259076
(cherry picked from commit 19e008e7f79ce55182d227be8513b3fa520471d8)
---
libexec/rtld-elf/rtld_malloc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libexec/rtld-elf/rtld_malloc.c b/libexec/rtld-elf/rtld_malloc.c
index f22c3c727c73..64218b5bb786 100644
--- a/libexec/rtld-elf/rtld_malloc.c
+++ b/libexec/rtld-elf/rtld_malloc.c
@@ -184,7 +184,9 @@ morecore(int bucket)
nblks = 1;
}
if (amt > pagepool_end - pagepool_start)
- if (morepages(amt/pagesz + NPOOLPAGES) == 0)
+ if (morepages(amt / pagesz + NPOOLPAGES) == 0 &&
+ /* Retry with min required size */
+ morepages(amt / pagesz) == 0)
return;
op = (union overhead *)pagepool_start;
pagepool_start += amt;
@@ -269,6 +271,8 @@ morepages(int n)
}
}
+ if (pagepool_start == MAP_FAILED)
+ pagepool_start = 0;
offset = (uintptr_t)pagepool_start - rounddown2(
(uintptr_t)pagepool_start, pagesz);