rts: fix Windows megablock allocator

Authored by Phyx on Nov 22 2018, 10:47 AM.

Description

rts: fix Windows megablock allocator

The megablock allocator does not currently check that after aligning the
free region if it still has enough space to actually do the allocation.

This causes it to return a memory region which it didn't fully allocate
itself. Even worse, it can cause it to return a block with a region
that will be present in two allocation pools.

This causes if you're lucky an error from the OS that you're committing
memory that has never been reserved, or causes random heap corruption.

This change makes it consider the alignment as well.

Test Plan: ./validate , testcase testmblockalloc

Reviewers: bgamari, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, carter

Differential Revision: https://phabricator.haskell.org/D5363

Details

Committed
bgamariNov 22 2018, 12:14 PM
Reviewer
simonmar
Differential Revision
D5363: rts: fix Windows megablock allocator
Parents
rGHC7cba71fc25af: Don't reverse explicit export lists during renaming
Branches
Unknown
Tags
Unknown