[commit: ghc] master: rts/M32Alloc: Abort if m32 linker mmap fails (86f6890)
git at git.haskell.org
git at git.haskell.org
Thu Nov 22 18:43:34 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/86f6890e3689f2f75ecca8172eda0338fe3e9769/ghc
>---------------------------------------------------------------
commit 86f6890e3689f2f75ecca8172eda0338fe3e9769
Author: Ben Gamari <ben at smart-cactus.org>
Date: Sat Nov 10 15:35:37 2018 -0500
rts/M32Alloc: Abort if m32 linker mmap fails
Previously we should just blinding dereference a NULL pointer.
>---------------------------------------------------------------
86f6890e3689f2f75ecca8172eda0338fe3e9769
rts/linker/M32Alloc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/rts/linker/M32Alloc.c b/rts/linker/M32Alloc.c
index 6a2996d..52b182e 100644
--- a/rts/linker/M32Alloc.c
+++ b/rts/linker/M32Alloc.c
@@ -158,6 +158,9 @@ m32_allocator_init(void)
// fragment the memory.
size_t pgsz = getPageSize();
char* bigchunk = mmapForLinker(pgsz * M32_MAX_PAGES,MAP_ANONYMOUS,-1,0);
+ if (bigchunk == NULL)
+ barf("m32_allocator_init: Failed to map");
+
int i;
for (i=0; i<M32_MAX_PAGES; i++) {
alloc.pages[i].base_addr = bigchunk + i*pgsz;
More information about the ghc-commits
mailing list