diff options
author | Dimitry Ivanov <dimitry@google.com> | 2016-02-25 15:22:04 -0800 |
---|---|---|
committer | Dimitry Ivanov <dimitry@google.com> | 2016-02-26 16:57:53 -0800 |
commit | df91dc2c192aa2789320c500037d28c919daa820 (patch) | |
tree | 4ba5a6847130b9e27ec632af9e257d8c4e3a9f0c /linker/linker.cpp | |
parent | 2465df001c7b1d3dc0a0e003f15c5fe6000a0452 (diff) |
Add android_dlwarning() method
This is temporary method intended to use
for a toast message on preview and beta
releases. Will be removed before the
production release.
Bug: http://b/27365747
Change-Id: I39cc716bb82863ae761b6821bcec77cce6db3781
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r-- | linker/linker.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp index 77642e7cc..a38a56603 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -52,6 +52,7 @@ #include "linker.h" #include "linker_block_allocator.h" #include "linker_debug.h" +#include "linker_dlwarning.h" #include "linker_sleb128.h" #include "linker_phdr.h" #include "linker_relocs.h" @@ -1707,6 +1708,7 @@ static const char* fix_dt_needed(const char* dt_needed, const char* sopath __unu const char* bname = basename(dt_needed); if (bname != dt_needed) { DL_WARN("'%s' library has invalid DT_NEEDED entry '%s'", sopath, dt_needed); + add_dlwarning(sopath, "invalid DT_NEEDED entry", dt_needed); } return bname; @@ -1803,12 +1805,12 @@ static bool load_library(android_namespace_t* ns, // print warning only if needed by non-system library if (needed_by == nullptr || !is_system_library(needed_by->get_realpath())) { const soinfo* needed_or_dlopened_by = task->get_needed_by(); + const char* sopath = needed_or_dlopened_by == nullptr ? "(unknown)" : + needed_or_dlopened_by->get_realpath(); DL_WARN("library \"%s\" (\"%s\") needed or dlopened by \"%s\" is not accessible for the namespace \"%s\"" " - the access is temporarily granted as a workaround for http://b/26394120", - name, realpath.c_str(), - needed_or_dlopened_by == nullptr ? "(unknown)" : - needed_or_dlopened_by->get_realpath(), - ns->get_name()); + name, realpath.c_str(), sopath, ns->get_name()); + add_dlwarning(sopath, "unauthorized access to", name); } } else { // do not load libraries if they are not accessible for the specified namespace. @@ -3809,6 +3811,7 @@ bool soinfo::prelink_image() { soname_ = basename(realpath_.c_str()); DL_WARN("%s: is missing DT_SONAME will use basename as a replacement: \"%s\"", get_realpath(), soname_); + add_dlwarning(get_realpath(), "missing DT_SONAME"); } return true; } @@ -3843,6 +3846,7 @@ bool soinfo::link_image(const soinfo_list_t& global_group, const soinfo_list_t& // phdr_table_protect_segments() after all of them are applied. DL_WARN("%s has text relocations. This is wasting memory and prevents " "security hardening. Please fix.", get_realpath()); + add_dlwarning(get_realpath(), "text relocations"); if (phdr_table_unprotect_segments(phdr, phnum, load_bias) < 0) { DL_ERR("can't unprotect loadable segments for \"%s\": %s", get_realpath(), strerror(errno)); |