Commit 48dfb607 authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[base] Simplify ASLR on Windows.

Change-Id: I1cb2eb715646366d516c26b11849955990dcda53
Reviewed-on: https://chromium-review.googlesource.com/558881Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46383}
parent 53d0e1cb
......@@ -143,9 +143,7 @@ static void* RandomizedVirtualAlloc(size_t size, int action, int protection) {
if (protection == PAGE_EXECUTE_READWRITE || protection == PAGE_NOACCESS) {
// For exectutable pages try and randomize the allocation address
for (size_t attempts = 0; base == NULL && attempts < 3; ++attempts) {
base = VirtualAlloc(OS::GetRandomMmapAddr(), size, action, protection);
}
base = VirtualAlloc(OS::GetRandomMmapAddr(), size, action, protection);
}
// After three attempts give up and let the OS find an address to use.
......
......@@ -753,9 +753,7 @@ static void* RandomizedVirtualAlloc(size_t size, int action, int protection) {
if (use_aslr &&
(protection == PAGE_EXECUTE_READWRITE || protection == PAGE_NOACCESS)) {
// For executable pages try and randomize the allocation address
for (size_t attempts = 0; base == NULL && attempts < 3; ++attempts) {
base = VirtualAlloc(OS::GetRandomMmapAddr(), size, action, protection);
}
base = VirtualAlloc(OS::GetRandomMmapAddr(), size, action, protection);
}
// After three attempts give up and let the OS find an address to use.
......
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