Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1548)

Unified Diff: third_party/WebKit/Source/wtf/AddressSpaceRandomization.cpp

Issue 1383153002: Fix PartitionAlloc randomization on 32-bit systems (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: jfb was half right Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/wtf/AddressSpaceRandomization.cpp
diff --git a/third_party/WebKit/Source/wtf/AddressSpaceRandomization.cpp b/third_party/WebKit/Source/wtf/AddressSpaceRandomization.cpp
index 2a363a33e306649fdf2dfc68a43e537f20a8d937..7f98d9dcac7e5b586ff7696a68230652a8a5f25d 100644
--- a/third_party/WebKit/Source/wtf/AddressSpaceRandomization.cpp
+++ b/third_party/WebKit/Source/wtf/AddressSpaceRandomization.cpp
@@ -108,6 +108,17 @@ void* getRandomPageBase()
random &= 0x3fffffffffUL;
random += 0x1000000000UL;
#else // !CPU(X86_64) && !CPU(ARM64)
+#if OS(WIN)
+ // On win32 host systems the randomization plus huge alignment causes
+ // excessive fragmentation. Plus most of these systems lack ASLR, so the
+ // randomization isn't buying anything. In that case we just skip it.
+ // TODO(jschuh): Just dump the randomization when HE-ASLR is present.
+ static BOOL isWow64 = -1;
+ if (isWow64 == -1 && !IsWow64Process(GetCurrentProcess(), &isWow64))
+ isWow64 = FALSE;
+ if (!isWow64)
+ return nullptr;
+#endif // OS(WIN)
// This is a good range on Windows, Linux and Mac.
// Allocates in the 0.5-1.5GB region.
random &= 0x3fffffff;
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/PageAllocator.cpp » ('j') | third_party/WebKit/Source/wtf/PageAllocator.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698