Merge changes from topic "dup_icu4c"
* changes: Linker namespace changes for moving ICU4C to APEX Remove the public libs in runtime namespace
This commit is contained in:
commit
ce912aadda
4 changed files with 47 additions and 0 deletions
|
|
@ -137,6 +137,12 @@ static constexpr const char* kWhitelistedDirectories = "/data:/mnt/expand";
|
||||||
|
|
||||||
static constexpr const char* kApexPath = "/apex/";
|
static constexpr const char* kApexPath = "/apex/";
|
||||||
|
|
||||||
|
#if defined(__LP64__)
|
||||||
|
static constexpr const char* kRuntimeApexLibPath = "/apex/com.android.runtime/lib64";
|
||||||
|
#else
|
||||||
|
static constexpr const char* kRuntimeApexLibPath = "/apex/com.android.runtime/lib";
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool is_debuggable() {
|
static bool is_debuggable() {
|
||||||
char debuggable[PROP_VALUE_MAX];
|
char debuggable[PROP_VALUE_MAX];
|
||||||
property_get("ro.debuggable", debuggable, "0");
|
property_get("ro.debuggable", debuggable, "0");
|
||||||
|
|
@ -408,6 +414,14 @@ class LibraryNamespaces {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove the public libs in the runtime namespace.
|
||||||
|
// These libs are listed in public.android.txt, but we don't want the rest of android
|
||||||
|
// in default namespace to dlopen the libs.
|
||||||
|
// For example, libicuuc.so is exposed to classloader namespace from runtime namespace.
|
||||||
|
// Unfortunately, it does not have stable C symbols, and default namespace should only use
|
||||||
|
// stable symbols in libandroidicu.so. http://b/120786417
|
||||||
|
removePublicLibsIfExistsInRuntimeApex(sonames);
|
||||||
|
|
||||||
// android_init_namespaces() expects all the public libraries
|
// android_init_namespaces() expects all the public libraries
|
||||||
// to be loaded so that they can be found by soname alone.
|
// to be loaded so that they can be found by soname alone.
|
||||||
//
|
//
|
||||||
|
|
@ -502,6 +516,27 @@ class LibraryNamespaces {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the public libs in runtime namespace
|
||||||
|
*/
|
||||||
|
void removePublicLibsIfExistsInRuntimeApex(std::vector<std::string>& sonames) {
|
||||||
|
for (const std::string& lib_name : kRuntimePublicLibraries) {
|
||||||
|
std::string path(kRuntimeApexLibPath);
|
||||||
|
path.append("/").append(lib_name);
|
||||||
|
|
||||||
|
struct stat s;
|
||||||
|
// Do nothing if the path in /apex does not exist.
|
||||||
|
// Runtime APEX must be mounted since libnativeloader is in the same APEX
|
||||||
|
if (stat(path.c_str(), &s) != 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto it = std::find(sonames.begin(), sonames.end(), lib_name);
|
||||||
|
if (it != sonames.end()) {
|
||||||
|
sonames.erase(it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool ReadConfig(const std::string& configFile, std::vector<std::string>* sonames,
|
bool ReadConfig(const std::string& configFile, std::vector<std::string>* sonames,
|
||||||
const std::function<bool(const std::string& /* soname */,
|
const std::function<bool(const std::string& /* soname */,
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,10 @@ namespace.default.link.runtime.shared_libs += libdexfile_external.so
|
||||||
namespace.default.link.runtime.shared_libs += libnativebridge.so
|
namespace.default.link.runtime.shared_libs += libnativebridge.so
|
||||||
namespace.default.link.runtime.shared_libs += libnativehelper.so
|
namespace.default.link.runtime.shared_libs += libnativehelper.so
|
||||||
namespace.default.link.runtime.shared_libs += libnativeloader.so
|
namespace.default.link.runtime.shared_libs += libnativeloader.so
|
||||||
|
namespace.default.link.runtime.shared_libs += libandroidicu.so
|
||||||
|
|
||||||
|
# TODO(b/122876336): Remove libpac.so once it's migrated to Webview
|
||||||
|
namespace.default.link.runtime.shared_libs += libpac.so
|
||||||
|
|
||||||
# When libnetd_resolv.so can't be found in the default namespace, search for it
|
# When libnetd_resolv.so can't be found in the default namespace, search for it
|
||||||
# in the resolv namespace. Don't allow any other libraries from the resolv namespace
|
# in the resolv namespace. Don't allow any other libraries from the resolv namespace
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,10 @@ namespace.default.link.runtime.shared_libs += libdexfile_external.so
|
||||||
namespace.default.link.runtime.shared_libs += libnativebridge.so
|
namespace.default.link.runtime.shared_libs += libnativebridge.so
|
||||||
namespace.default.link.runtime.shared_libs += libnativehelper.so
|
namespace.default.link.runtime.shared_libs += libnativehelper.so
|
||||||
namespace.default.link.runtime.shared_libs += libnativeloader.so
|
namespace.default.link.runtime.shared_libs += libnativeloader.so
|
||||||
|
namespace.default.link.runtime.shared_libs += libandroidicu.so
|
||||||
|
|
||||||
|
# TODO(b/122876336): Remove libpac.so once it's migrated to Webview
|
||||||
|
namespace.default.link.runtime.shared_libs += libpac.so
|
||||||
|
|
||||||
# When libnetd_resolv.so can't be found in the default namespace, search for it
|
# When libnetd_resolv.so can't be found in the default namespace, search for it
|
||||||
# in the resolv namespace. Don't allow any other libraries from the resolv namespace
|
# in the resolv namespace. Don't allow any other libraries from the resolv namespace
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,10 @@ namespace.default.link.runtime.shared_libs += libdexfile_external.so
|
||||||
namespace.default.link.runtime.shared_libs += libnativebridge.so
|
namespace.default.link.runtime.shared_libs += libnativebridge.so
|
||||||
namespace.default.link.runtime.shared_libs += libnativehelper.so
|
namespace.default.link.runtime.shared_libs += libnativehelper.so
|
||||||
namespace.default.link.runtime.shared_libs += libnativeloader.so
|
namespace.default.link.runtime.shared_libs += libnativeloader.so
|
||||||
|
namespace.default.link.runtime.shared_libs += libandroidicu.so
|
||||||
|
|
||||||
|
# TODO(b/122876336): Remove libpac.so once it's migrated to Webview
|
||||||
|
namespace.default.link.runtime.shared_libs += libpac.so
|
||||||
|
|
||||||
# When libnetd_resolv.so can't be found in the default namespace, search for it
|
# When libnetd_resolv.so can't be found in the default namespace, search for it
|
||||||
# in the resolv namespace. Don't allow any other libraries from the resolv namespace
|
# in the resolv namespace. Don't allow any other libraries from the resolv namespace
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue