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

Unified Diff: src/platform-linux.cc

Issue 8115014: Add hinting to improve ASLR for macos (all allocations) and linux (newly added allocation types). (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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
« no previous file with comments | « no previous file | src/platform-macos.cc » ('j') | src/platform-macos.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-linux.cc
===================================================================
--- src/platform-linux.cc (revision 9508)
+++ src/platform-linux.cc (working copy)
@@ -456,7 +456,8 @@
int size = ftell(file);
void* memory =
- mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0);
+ mmap(GetRandomMmapAddr(), size, PROT_READ | PROT_WRITE,
Vyacheslav Egorov (Chromium) 2011/10/04 09:18:33 preferred formatting is one arguments per line
Cris Neckar 2011/10/04 19:20:47 Done.
+ MAP_SHARED, fileno(file), 0);
return new PosixMemoryMappedFile(file, memory, size);
}
@@ -471,7 +472,8 @@
return NULL;
}
void* memory =
- mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0);
+ mmap(GetRandomMmapAddr(), size, PROT_READ | PROT_WRITE,
Vyacheslav Egorov (Chromium) 2011/10/04 09:18:33 ditto
Cris Neckar 2011/10/04 19:20:47 Done.
+ MAP_SHARED, fileno(file), 0);
return new PosixMemoryMappedFile(file, memory, size);
}
@@ -556,8 +558,8 @@
// kernel log.
int size = sysconf(_SC_PAGESIZE);
FILE* f = fopen(kGCFakeMmap, "w+");
- void* addr = mmap(NULL, size, PROT_READ | PROT_EXEC, MAP_PRIVATE,
- fileno(f), 0);
+ void* addr = mmap(GetRandomMmapAddr(), size, PROT_READ | PROT_EXEC,
Vyacheslav Egorov (Chromium) 2011/10/04 09:18:33 ditto
Cris Neckar 2011/10/04 19:20:47 Done.
+ MAP_PRIVATE, fileno(f), 0);
ASSERT(addr != MAP_FAILED);
OS::Free(addr, size);
fclose(f);
« no previous file with comments | « no previous file | src/platform-macos.cc » ('j') | src/platform-macos.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698