From 4cb434df9bb8ee8e4ba50436e76952ebe0e0473a Mon Sep 17 00:00:00 2001 From: John Reck Date: Fri, 15 May 2015 07:47:17 -0700 Subject: Fix regression in crash reporting Bug: 19532651 Partial revert of be0e43b77676338fd5e6a82c9cc2b6302d579de2 Change-Id: I99e220328aff985facb920ebcd84ac1a016759b5 --- linker/debugger.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/linker/debugger.cpp b/linker/debugger.cpp index 357fbdc..46c97af 100644 --- a/linker/debugger.cpp +++ b/linker/debugger.cpp @@ -205,15 +205,6 @@ static bool have_siginfo(int signum) { } static void send_debuggerd_packet(siginfo_t* info) { - if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0) { - // process has disabled core dumps and PTRACE_ATTACH, and does not want to be dumped. - // Honor that intention by not connecting to debuggerd and asking it - // to dump our internal state. - __libc_format_log(ANDROID_LOG_INFO, "libc", - "Suppressing debuggerd output because prctl(PR_GET_DUMPABLE)==0"); - return; - } - // Mutex to prevent multiple crashing threads from trying to talk // to debuggerd at the same time. static pthread_mutex_t crash_mutex = PTHREAD_MUTEX_INITIALIZER; -- cgit v1.1 From c3351ea94d7e0a47c600e82c0973d9c3f257efc9 Mon Sep 17 00:00:00 2001 From: Dmitriy Ivanov Date: Wed, 27 May 2015 18:29:41 -0700 Subject: Work around incorrect dt_needed entries This applies for apps targeting sdk<=22 and only for lp32 platforms. Bug: http://b/21364029 Change-Id: I903e81c9ccda2a8beaba1d132d68c77d30a4cdb2 (cherry picked from commit d974e8804689058714dc4fe9adcb57ee9a6996a8) --- linker/dlfcn.cpp | 2 ++ linker/linker.cpp | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp index 8fafded..8705d9a 100644 --- a/linker/dlfcn.cpp +++ b/linker/dlfcn.cpp @@ -158,6 +158,8 @@ int dlclose(void* handle) { } void android_set_application_target_sdk_version(uint32_t target) { + // lock to avoid modification in the middle of dlopen. + ScopedPthreadMutexLocker locker(&g_dl_mutex); set_application_target_sdk_version(target); } diff --git a/linker/linker.cpp b/linker/linker.cpp index f3ca761..e8bebff 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -1215,11 +1215,27 @@ static int open_library(const char* name, off64_t* file_offset) { return fd; } +static const char* fix_dt_needed(const char* dt_needed, const char* sopath __unused) { +#if !defined(__LP64__) + // Work around incorrect DT_NEEDED entries for old apps: http://b/21364029 + uint32_t target_sdk_version = get_application_target_sdk_version(); + if (target_sdk_version != 0 && target_sdk_version <= 22) { + const char* bname = basename(dt_needed); + if (bname != dt_needed) { + DL_WARN("'%s' library has invalid DT_NEEDED entry '%s'", sopath, dt_needed); + } + + return bname; + } +#endif + return dt_needed; +} + template static void for_each_dt_needed(const soinfo* si, F action) { for (ElfW(Dyn)* d = si->dynamic; d->d_tag != DT_NULL; ++d) { if (d->d_tag == DT_NEEDED) { - action(si->get_string(d->d_un.d_val)); + action(fix_dt_needed(si->get_string(d->d_un.d_val), si->get_realpath())); } } } -- cgit v1.1