New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 875510 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac , Fuchsia
Pri: 3
Type: Bug

Blocked on: View detail
issue 875772
issue 875774



Sign in to add a comment

Verify that v8's ASLR doesn't waste memory on all platforms

Project Member Reported by brucedaw...@chromium.org, Aug 17

Issue description

 crbug.com/700928  and  crbug.com/738925  are memory bugs caused by aggressive ASLR in v8 triggering the allocation of lots of page tables which OSX never frees.

 crbug.com/870054  is a memory and hang bug caused by worker threads allocating temporary CodeRange objects with random reservation addresses that then cause Windows to allocate and never free CFG memory.

When the OSX bugs were found and fixed we missed an opportunity to find and fix the Windows bug. If we had found it at the time (not a given, by any means, since we wouldn't have known exactly what we were looking for) we could have fixed it much earlier, perhaps in a unified way.

We should learn from this and run some tests on all platforms to make sure that we aren't triggering any other platform "leaks".

I have done manual testing on Windows which suggests that temporary allocations of non-executable memory do not cause any permanent loss of memory - no CFG memory, no page tables, nothing.

However we should consider testing this on Linux and Android and other platforms as well, to see if they have ASLR memory wastage issues.


Alternately/as well we should have a test which attempts to trigger all of the ASLR facilities in v8 - allocate lots of temporary CodeRange objects, allocate and free lots of JavaScript heap objects - and then measure the memory footprint at the end to ensure that it is not higher than it should be. I don't know how to trigger all of these but I assume there should be some way.

We should also consider whether the Windows fix means that we no longer need the OSX fix. The Windows fix (reusing CodeRange reservation addresses) has the advantage of using less CFG/page-table memory in most cases (assuming that just a few CodeRange objects are ever allocated simultaneously) while also not imposing any arbitrary restrictions on how many CodeRange objects are permitted to be allocated simultaneously.

 
Cc: hpayer@chromium.org mlippautz@chromium.org
Components: -Blink>JavaScript>Compiler Blink>JavaScript>GC
OSX bug was about data pages allocated within the same V8 instance. The test was allocating data pages in the same V8 instance and would not discover the CodeRange issue on Windows that triggers only when new V8 instances (workers) are created in a loop. There is a big leap from allocating objects within the same V8 instance to allocating V8 instances, so I don't think I had a chance to discover the CodeRange issue at the time.

The CodeRange fix does not make the OSX fix obsolete as they are for different issues.

I think we can make a memory benchmark that allocates workers in a loop and shows the private memory footprint of the renderer process.

We can also make a synthetic unittest that allocates CodeRances and stresses VirtualMemory operations in V8. That would require porting Chrome's private memory footprint getter to V8.  








Blockedon: 875772
Blockedon: 875774
I hadn't realized that the OSX bug was about data instead of code. Good to know.

Having a test that allocates workers and/or data in a loop and monitors the private memory footprint (which seems to include page tables on Windows, I don't if it does on OSX) might cover all of these.

Sign in to add a comment