bionic: loader: Don't bail out if reading pad_segment note fails
The PAD_SEGMENT note is used to optimize memory usage of the loader.
If the note parsing fails, skip the optimization and continue
loading the ELF normally.
Bug: 324309329
Bug: 316403210
Change-Id: I2aabc9f399816c53eb33ff303208a16022571edf
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
diff --git a/linker/linker_phdr.cpp b/linker/linker_phdr.cpp
index 85cd949..8925e62 100644
--- a/linker/linker_phdr.cpp
+++ b/linker/linker_phdr.cpp
@@ -721,8 +721,9 @@
// at most 1 PT_NOTE mapped at anytime during this search.
MappedFileFragment note_fragment;
if (!note_fragment.Map(fd_, file_offset_, phdr->p_offset, phdr->p_memsz)) {
- DL_ERR("\"%s\" note mmap failed: %s", name_.c_str(), strerror(errno));
- return false;
+ DL_WARN("\"%s\" note mmap failed: %s", name_.c_str(), strerror(errno));
+ // If mmap failed, skip the optimization but don't block ELF loading
+ return true;
}
const ElfW(Nhdr)* note_hdr = nullptr;