aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-11-16 19:04:17 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-11-16 19:04:18 +0000
commit8945d5e43a25737f3f888a90742cc918b1124a05 (patch)
tree6757a77ed8efe27ee2f5e9dbf0e53144b1a26568
parentbd15515cfc0219963123bcf982782100ad0f6085 (diff)
parent4cc5a60f9113d7cb5bae01334df06e6ccd0018e5 (diff)
downloadandroid_bionic-8945d5e43a25737f3f888a90742cc918b1124a05.tar.gz
android_bionic-8945d5e43a25737f3f888a90742cc918b1124a05.tar.bz2
android_bionic-8945d5e43a25737f3f888a90742cc918b1124a05.zip
Merge "Downgrade W+E load segments to a warning unless targeting O."
-rw-r--r--android-changes-for-ndk-developers.md6
-rw-r--r--linker/linker_phdr.cpp11
2 files changed, 11 insertions, 6 deletions
diff --git a/android-changes-for-ndk-developers.md b/android-changes-for-ndk-developers.md
index 11648fa88..069b004e7 100644
--- a/android-changes-for-ndk-developers.md
+++ b/android-changes-for-ndk-developers.md
@@ -218,6 +218,6 @@ $ readelf --program-headers -W libBadFlags.so | grep WE
LOAD 0x000000 0x00000000 0x00000000 0x4c01d 0x4c01d RWE 0x1000
```
-*Resolution*: right now we're not actually sure where these are coming
-from, so if you find and fix these in your app, please let us know how
-they snuck in!
+*Resolution*: we're aware of one middleware product that introduces these
+into your app. The middleware vendor is aware of the problem and has a fix
+available.
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),