Merge "linker: mark library .bss pages with anon:.bss"
am: 0e915b294b
* commit '0e915b294b2b1f0d20cd1b9a4e1721d59ccbfa7a':
linker: mark library .bss pages with anon:.bss
This commit is contained in:
commit
2c1589f568
1 changed files with 6 additions and 1 deletions
|
@ -39,6 +39,8 @@
|
||||||
#include "linker_debug.h"
|
#include "linker_debug.h"
|
||||||
#include "linker_utils.h"
|
#include "linker_utils.h"
|
||||||
|
|
||||||
|
#include "private/bionic_prctl.h"
|
||||||
|
|
||||||
static int GetTargetElfMachine() {
|
static int GetTargetElfMachine() {
|
||||||
#if defined(__arm__)
|
#if defined(__arm__)
|
||||||
return EM_ARM;
|
return EM_ARM;
|
||||||
|
@ -540,8 +542,9 @@ bool ElfReader::LoadSegments() {
|
||||||
// between them. This is done by using a private anonymous
|
// between them. This is done by using a private anonymous
|
||||||
// map for all extra pages.
|
// map for all extra pages.
|
||||||
if (seg_page_end > seg_file_end) {
|
if (seg_page_end > seg_file_end) {
|
||||||
|
size_t zeromap_size = seg_page_end - seg_file_end;
|
||||||
void* zeromap = mmap(reinterpret_cast<void*>(seg_file_end),
|
void* zeromap = mmap(reinterpret_cast<void*>(seg_file_end),
|
||||||
seg_page_end - seg_file_end,
|
zeromap_size,
|
||||||
PFLAGS_TO_PROT(phdr->p_flags),
|
PFLAGS_TO_PROT(phdr->p_flags),
|
||||||
MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE,
|
MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE,
|
||||||
-1,
|
-1,
|
||||||
|
@ -550,6 +553,8 @@ bool ElfReader::LoadSegments() {
|
||||||
DL_ERR("couldn't zero fill \"%s\" gap: %s", name_.c_str(), strerror(errno));
|
DL_ERR("couldn't zero fill \"%s\" gap: %s", name_.c_str(), strerror(errno));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, zeromap, zeromap_size, ".bss");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue