论坛版主
|
阅读:8095回复:1
Android8.1Apk调用系统灰名单的lib库时警告信息
楼主#
更多
发布于:2020-05-13 17:20
客户的Apk中link了系统灰名单中的lib库,在Android7.1 中没有任何提示。但是在Android8.1中会有Toast提示: unauthorized access to libxxx之类的。
logcat也有这样类似的打印:
04-30 02:37:14.956 2591 2591 W linker : library "libstagefright.so" ("/system/lib/libstagefright.so") needed or dlopened by "/data/app/air.com.joystudy.subsix-tAB-mk_Cnd4Kg4l1f6Icsg==/lib/arm/libCore.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android. 04-30 02:37:14.957 2591 2591 W linker : library "libutils.so" ("/system/lib/libutils.so") needed or dlopened by "/data/app/air.com.joystudy.subsix-tAB-mk_Cnd4Kg4l1f6Icsg==/lib/arm/libCore.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android. 04-30 02:37:14.957 2591 2591 W linker : library "libui.so" ("/system/lib/libui.so") needed or dlopened by "/data/app/air.com.joystudy.subsix-tAB-mk_Cnd4Kg4l1f6Icsg==/lib/arm/libCore.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android. 看这个打印日志是警告,意思是现在你们还可以暂时使用灰名单中的系统lib库,限期整改,以后的安卓版本中就会删除灰名单,你们就彻底不能用这些系统lib库,直接崩溃报错? 看了一下打印信息是在源码的 bionic/linker/linker.cpp中 这里是灰名单:
// TODO(dimitry): The grey-list is a workaround for http://b/26394120 --- // gradually remove libraries from this list until it is gone. static bool is_greylisted(const char* name, const soinfo* needed_by) { static const char* const kLibraryGreyList[] = { "libandroid_runtime.so", "libbinder.so", "libcrypto.so", "libcutils.so", "libexpat.so", "libgui.so", "libmedia.so", "libnativehelper.so", "libskia.so", "libssl.so", "libstagefright.so", "libsqlite.so", "libui.so", "libutils.so", "libvorbisidec.so", nullptr };
这里是警告日志Toast提示的地方:
if (!ns->is_accessible(realpath)) { // TODO(dimitry): workaround for http://b/26394120 - the grey-list const soinfo* needed_by = task->is_dt_needed() ? task->get_needed_by() : nullptr; if (is_greylisted(name, needed_by)) { // 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, note that the access" " will be removed in future releases of Android.", 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. const char* needed_or_dlopened_by = task->get_needed_by() == nullptr ? 我是不是可以把这个Toast去掉应该就行了,APK应该还是可以正常使用的
|