summaryrefslogtreecommitdiff
path: root/linker/linker_main.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-01-07 10:38:20 -0800
committerElliott Hughes <enh@google.com>2017-01-07 10:38:20 -0800
commit3bdb31b51b353d12e482d28d6ffe115944f8819e (patch)
treede5bab575b8b24dcb183784862a5fdc6fc4c1791 /linker/linker_main.cpp
parentfb07c36bc061db4ca5d8348ff6bc1e60b6c53191 (diff)
Exit rather than abort if asked to run a non-PIE executable.
Each release we're asked to investigate tombstones from code that hasn't been allowed to run on Android since L. This is just wasting our time, and clearly the "obviousness" of aborting rather than exiting hasn't ensured that all app developers rebuild their old binaries. In some cases it seems like they run them "just in case" and don't care if they fail. Bug: http://b/34112178 Test: ran libsupervisor.so from com.ss.android.article.news Change-Id: I8a3f196c4755601a3888281566fbb7b817f01dca
Diffstat (limited to 'linker/linker_main.cpp')
-rw-r--r--linker/linker_main.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index 13edfe1f7..a5abdfffa 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -306,9 +306,21 @@ static ElfW(Addr) __linker_init_post_relocation(KernelArgumentBlock& args, ElfW(
si->dynamic = nullptr;
ElfW(Ehdr)* elf_hdr = reinterpret_cast<ElfW(Ehdr)*>(si->base);
+
+ // We haven't supported non-PIE since Lollipop for security reasons.
if (elf_hdr->e_type != ET_DYN) {
- __libc_fatal("\"%s\": error: only position independent executables (PIE) are supported.",
- g_argv[0]);
+ // We don't use __libc_fatal here because we don't want a tombstone: it's
+ // been several years now but we still find ourselves on app compatibility
+ // investigations because some app's trying to launch an executable that
+ // hasn't worked in at least three years, and we've "helpfully" dropped a
+ // tombstone for them. The tombstone never provided any detail relevant to
+ // fixing the problem anyway, and the utility of drawing extra attention
+ // to the problem is non-existent at this late date.
+ __libc_format_fd(STDOUT_FILENO,
+ "\"%s\": error: Android 5.0 and later only support "
+ "position-independent executables (-fPIE).",
+ g_argv[0]);
+ exit(0);
}
// Use LD_LIBRARY_PATH and LD_PRELOAD (but only if we aren't setuid/setgid).