summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorJiyong Park <jiyong@google.com>2019-09-06 03:41:10 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-09-06 03:41:10 -0700
commit2ce280c5d5ccdef035b8de7466eac87b5b1e5219 (patch)
treeef9a9ee4d95c9c0eab152c0748e436c91d21ba9d /core/java
parent6500b83b4072ec3d5dd33794d0e2e45f877081d8 (diff)
parentc93d704df2e5bcd9cecbf32f1fa49e62f1589171 (diff)
Revert "Fix: vendor public libraries are accessible via System.loadLibrary" am: 9c7d8b12b4
am: c93d704df2 Change-Id: Iee36c8f242d6fc7b29af0b3cc1811af3e4890e98
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/LoadedApk.java42
1 files changed, 0 insertions, 42 deletions
diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java
index 8987b239013c..f0b354650cf4 100644
--- a/core/java/android/app/LoadedApk.java
+++ b/core/java/android/app/LoadedApk.java
@@ -883,48 +883,6 @@ public final class LoadedApk {
}
}
- // /apex/com.android.art/lib, /vendor/lib, /odm/lib and /product/lib
- // are added to the native lib search paths of the classloader.
- // Note that this is done AFTER the classloader is
- // created by ApplicationLoaders.getDefault().getClassLoader(...). The
- // reason is because if we have added the paths when creating the classloader
- // above, the paths are also added to the search path of the linker namespace
- // 'classloader-namespace', which will allow ALL libs in the paths to apps.
- // Since only the libs listed in <partition>/etc/public.libraries.txt can be
- // available to apps, we shouldn't add the paths then.
- //
- // However, we need to add the paths to the classloader (Java) though. This
- // is because when a native lib is requested via System.loadLibrary(), the
- // classloader first tries to find the requested lib in its own native libs
- // search paths. If a lib is not found in one of the paths, dlopen() is not
- // called at all. This can cause a problem that a vendor public native lib
- // is accessible when directly opened via dlopen(), but inaccesible via
- // System.loadLibrary(). In order to prevent the problem, we explicitly
- // add the paths only to the classloader, and not to the native loader
- // (linker namespace).
- List<String> extraLibPaths = new ArrayList<>(4);
- String abiSuffix = VMRuntime.getRuntime().is64Bit() ? "64" : "";
- if (!defaultSearchPaths.contains("/apex/com.android.art/lib")) {
- extraLibPaths.add("/apex/com.android.art/lib" + abiSuffix);
- }
- if (!defaultSearchPaths.contains("/vendor/lib")) {
- extraLibPaths.add("/vendor/lib" + abiSuffix);
- }
- if (!defaultSearchPaths.contains("/odm/lib")) {
- extraLibPaths.add("/odm/lib" + abiSuffix);
- }
- if (!defaultSearchPaths.contains("/product/lib")) {
- extraLibPaths.add("/product/lib" + abiSuffix);
- }
- if (!extraLibPaths.isEmpty()) {
- StrictMode.ThreadPolicy oldPolicy = allowThreadDiskReads();
- try {
- ApplicationLoaders.getDefault().addNative(mDefaultClassLoader, extraLibPaths);
- } finally {
- setThreadPolicy(oldPolicy);
- }
- }
-
if (addedPaths != null && addedPaths.size() > 0) {
final String add = TextUtils.join(File.pathSeparator, addedPaths);
ApplicationLoaders.getDefault().addPath(mDefaultClassLoader, add);