v8/test/unittests/heap
Ulan Degenbaev 0640cbf378 [heap] Rework ASLR for base::Platform::VirtualMemory
Currently every VirtualMemory allocation on 64-bit systems
uses a random 46-bit address hint for ASLR.

This leads to wired page leak on MacOS discovered by Erik Chen (see
crbug.com/700928 and https://chromium-review.googlesource.com/c/557958/):
"The Darwin kernel [as of macOS 10.12.5] does not clean up page directory
entries [PDE] created from mmap or mach_vm_allocate, even after
the region is destroyed. Using a virtual address space that is too large
causes a leak of about 1 wired [can never be paged out] page per call to
mmap(). The page is only reclaimed when the process is killed."

This patch changes VirtualMemory to accept the hint parameter explicitly.

On MacOS the hints are confined to 4GB contiguous region. Algorithm:
- On startup, set heap.mmap_region_base_ to a random address.
- For each mmap use heap.mmap_region_base_ + (random_offset % (4*GB)).

BUG=chromium:700928

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I2ae6a024e02fbe63f940105d7920b57c19abacc6
Reviewed-on: https://chromium-review.googlesource.com/558876
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46656}
2017-07-14 07:15:40 +00:00
..
bitmap-unittest.cc [heap] Fix mark bits for partially compacted pages. 2015-10-08 13:49:30 +00:00
embedder-tracing-unittest.cc Reland of "[heap] Report wrappers after processing the marking deque incrementally" 2017-01-02 13:06:11 +00:00
gc-idle-time-handler-unittest.cc [heap] Avoid full GC for large heaps. 2017-06-30 09:43:27 +00:00
gc-tracer-unittest.cc Fix more -Wsign-compare warnings in heap, mips, base, etc. 2016-11-11 14:56:10 +00:00
heap-unittest.cc [heap] Rework ASLR for base::Platform::VirtualMemory 2017-07-14 07:15:40 +00:00
item-parallel-job-unittest.cc [heap] Fix ItemParallelJobTest.DistributeItemsMultipleTasks 2017-05-17 08:31:04 +00:00
marking-unittest.cc [heap] Move AccessMode out from MarkBit into globals 2017-06-13 17:49:17 +00:00
memory-reducer-unittest.cc [heap] Reland "Add a guard for restarting the memory reducer after mark-compact." 2016-11-18 13:50:22 +00:00
scavenge-job-unittest.cc Represent speed in GCTracer functions as double instead of int. 2016-03-29 17:34:41 +00:00
slot-set-unittest.cc Fix unused lambda captures. 2017-01-19 21:34:00 +00:00
spaces-unittest.cc [heap] MinorMC: Evacuation for young generation 2017-05-03 21:31:06 +00:00
unmapper-unittest.cc [heap] Fix address space leak in Unmapper 2017-02-10 14:26:04 +00:00
worklist-unittest.cc [heap] Templatize worklist for arbitrary entry types 2017-07-05 10:13:33 +00:00