[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:
parent
53d0e1cb59
commit
48dfb6077a
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user