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

Unified Diff: third_party/android_crazy_linker/src/src/crazy_linker_elf_loader.cpp

Issue 443393003: Speculative fix for occasional crazy linker crash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback changes Created 6 years, 4 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 | « third_party/android_crazy_linker/README.chromium ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/android_crazy_linker/src/src/crazy_linker_elf_loader.cpp
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_elf_loader.cpp b/third_party/android_crazy_linker/src/src/crazy_linker_elf_loader.cpp
index 13221817c946c383a81e414ac03814bc93471a57..03589fc944bf654b4db0c5c4768b4c5170b557a8 100644
--- a/third_party/android_crazy_linker/src/src/crazy_linker_elf_loader.cpp
+++ b/third_party/android_crazy_linker/src/src/crazy_linker_elf_loader.cpp
@@ -181,7 +181,9 @@ bool ElfLoader::ReadProgramHeader(Error* error) {
// segments of a program header table. This is done by creating a
// private anonymous mmap() with PROT_NONE.
//
-// This will use the wanted_load_address_ value,
+// This will use the wanted_load_address_ value. Fails if the requested
+// address range cannot be reserved. Typically this would be because
+// it overlaps an existing, possibly system, mapping.
bool ElfLoader::ReserveAddressSpace(Error* error) {
ELF::Addr min_vaddr;
load_size_ =
@@ -197,7 +199,6 @@ bool ElfLoader::ReserveAddressSpace(Error* error) {
// Support loading at a fixed address.
if (wanted_load_address_) {
addr = static_cast<uint8_t*>(wanted_load_address_);
- mmap_flags |= MAP_FIXED;
}
LOG("%s: address=%p size=%p\n", __FUNCTION__, addr, load_size_);
@@ -206,6 +207,11 @@ bool ElfLoader::ReserveAddressSpace(Error* error) {
error->Format("Could not reserve %d bytes of address space", load_size_);
return false;
pasko 2014/09/10 18:46:17 Random suggestion: Printing /proc/self/maps to lo
}
+ if (wanted_load_address_ && start != addr) {
+ error->Format("Could not map at %p requested, backing out", addr);
+ munmap(start, load_size_);
+ return false;
+ }
load_start_ = start;
load_bias_ = reinterpret_cast<ELF::Addr>(start) - min_vaddr;
« no previous file with comments | « third_party/android_crazy_linker/README.chromium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698