[base] Simplify ASLR on Windows.

Change-Id: I1cb2eb715646366d516c26b11849955990dcda53
Reviewed-on: https://chromium-review.googlesource.com/558881
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46383}
This commit is contained in:
Ulan Degenbaev 2017-07-03 13:44:25 +02:00 committed by Commit Bot
parent 53d0e1cb59
commit 48dfb6077a
2 changed files with 2 additions and 6 deletions

View File

@ -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.

View File

@ -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.