diff options
author | Elliott Hughes <enh@google.com> | 2016-11-15 16:54:16 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2016-11-15 16:59:33 -0800 |
commit | 4cc5a60f9113d7cb5bae01334df06e6ccd0018e5 (patch) | |
tree | d26c93b81f74b378518331e3e93bec607cf69788 /linker | |
parent | d5aa03600e796b894bec7662852f5715bed9e19e (diff) | |
download | android_bionic-4cc5a60f9113d7cb5bae01334df06e6ccd0018e5.tar.gz android_bionic-4cc5a60f9113d7cb5bae01334df06e6ccd0018e5.tar.bz2 android_bionic-4cc5a60f9113d7cb5bae01334df06e6ccd0018e5.zip |
Downgrade W+E load segments to a warning unless targeting O.
I don't think we're getting any value from more dupes of the same dodgy
middleware, and I worry that we're hiding other, more subtle, compatibility
issues behind this one.
Test: bionic tests
Change-Id: I556cf36eac96c90976bae32621d1c133bbb8fcc7
Diffstat (limited to 'linker')
-rw-r--r-- | linker/linker_phdr.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/linker/linker_phdr.cpp b/linker/linker_phdr.cpp index bced72296..5b0ee491a 100644 --- a/linker/linker_phdr.cpp +++ b/linker/linker_phdr.cpp @@ -36,6 +36,7 @@ #include <unistd.h> #include "linker.h" +#include "linker_dlwarning.h" #include "linker_globals.h" #include "linker_debug.h" #include "linker_utils.h" @@ -605,10 +606,14 @@ bool ElfReader::LoadSegments() { if (file_length != 0) { int prot = PFLAGS_TO_PROT(phdr->p_flags); - // W + E PT_LOAD segments are not allowed. if ((prot & (PROT_EXEC | PROT_WRITE)) == (PROT_EXEC | PROT_WRITE)) { - DL_ERR_AND_LOG("\"%s\": W + E load segments are not allowed", name_.c_str()); - return false; + // W + E PT_LOAD segments are not allowed in O. + if (get_application_target_sdk_version() > 25) { + DL_ERR_AND_LOG("\"%s\": W + E load segments are not allowed", name_.c_str()); + return false; + } + DL_WARN("\"%s\": W + E load segments are not allowed", name_.c_str()); + add_dlwarning(name_.c_str(), "W+E load segments"); } void* seg_addr = mmap64(reinterpret_cast<void*>(seg_page_start), |