Commit 02615e8b authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

Make randomized allocations along 64k granularity boundaries to avoid comitting unused memory.

BUG=56036
TEST=None.

Patch by Justin Schuh <jschuh@chromium.org>

Review URL: http://codereview.chromium.org/3849004



git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5655 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 82b380d3
...@@ -845,14 +845,15 @@ void* OS::Allocate(const size_t requested, ...@@ -845,14 +845,15 @@ void* OS::Allocate(const size_t requested,
bool is_executable) { bool is_executable) {
// The address range used to randomize RWX allocations in OS::Allocate // The address range used to randomize RWX allocations in OS::Allocate
// Try not to map pages into the default range that windows loads DLLs // Try not to map pages into the default range that windows loads DLLs
// Use a multiple of 64k to prevent committing unused memory.
// Note: This does not guarantee RWX regions will be within the // Note: This does not guarantee RWX regions will be within the
// range kAllocationRandomAddressMin to kAllocationRandomAddressMax // range kAllocationRandomAddressMin to kAllocationRandomAddressMax
#ifdef V8_HOST_ARCH_64_BIT #ifdef V8_HOST_ARCH_64_BIT
static const intptr_t kAllocationRandomAddressMin = 0x0000000080000000; static const intptr_t kAllocationRandomAddressMin = 0x0000000080000000;
static const intptr_t kAllocationRandomAddressMax = 0x000004FFFFFFFFFF; static const intptr_t kAllocationRandomAddressMax = 0x000003FFFFFF0000;
#else #else
static const intptr_t kAllocationRandomAddressMin = 0x04000000; static const intptr_t kAllocationRandomAddressMin = 0x04000000;
static const intptr_t kAllocationRandomAddressMax = 0x4FFFFFFF; static const intptr_t kAllocationRandomAddressMax = 0x3FFF0000;
#endif #endif
// VirtualAlloc rounds allocated size to page size automatically. // VirtualAlloc rounds allocated size to page size automatically.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment