summaryrefslogtreecommitdiff
path: root/libnativeloader/native_loader.cpp
AgeCommit message (Collapse)Author
2016-11-04Allow different namespace types for different classloadersDimitry Ivanov
An app should be able to make cross-arch calls to different apps via other app's Context.getClassLoader() Bug: 32542970 Test: Boot fugu. Check that there are no linker-namespace related errors in the log. Change-Id: I1593f4688bcde0121a5e24a707441a4935fa7dc4
2016-11-01Return nullptr from FindNamespaceByClassLoader for NB-enabled apps.Dimitry Ivanov
This function is always called by the frameworks in order to initialize vulkan layer path. For NB apps returning nullptr disables vulkan layer library lookup as expected. Bug: http://b/32542970 Test: mm Change-Id: I426b2b9f5ea7227b00f063ed6040f37bb2b4f21f
2016-10-25Upgrade native bridge to version 3 to support namespaceZhenhua WANG
Native bridge implements namespace related interfaces in version 3. The namespace semantic here is same as Android dynamic linker's. Native loader wraps library loading functions of dynamic linker and native bridge. Thus, Android runtime is able to load native library of different ISA on one device by calling native loader directly. Bug: http://b/28242460 Test: mm && make test-art-host -j48 Change-Id: Idde2b9d99fb6ebe547407c716b5478a231f745a7 Signed-off-by: Zhenhua WANG <zhenhua.wang@intel.com>
2016-09-30system/core Replace log/log.h with android/log.hMark Salyzyn
Should use android/log.h instead of log/log.h as a good example to all others. Adjust header order to comply with Android Coding standards. Test: Compile Bug: 26552300 Bug: 31289077 Change-Id: I33a8fb4e754d2dc4754d335660c450e0a67190fc
2016-06-22Merge \"Add support to indicate bitness of public library.\"Christopher Ferris
am: 3fb358478f Change-Id: Ia5a7580cb26dbafa5863ae5d85aaaccb62936921
2016-06-22Add support to indicate bitness of public library.Christopher Ferris
For public vendor libraries, a vendor might have only a 32 bit or only a 64 bit version of the library. Add a way to indicate this in the public.libraries.txt files. The new format is: library.so 32 This indicates that this is a 32 bit only public library. library.so 64 This indicates that this is a 64 bit only public library. Bug: 29370721 Bug: 29512261 (cherry picked from commit 6664a805cae6983c7a19caf8abbe88ad2d918bcb) Change-Id: Id52c8b61d5c802ce62edda7e25f2755f6f93d6b7
2016-05-24Merge "Remove target_sdk_version parameter" into nyc-devDimitry Ivanov
am: 07f46c84e6 * commit '07f46c84e614e2635e8072403dce8f17cc9285ba': Remove target_sdk_version parameter Change-Id: Idf4bca526e7a40064518ad0e5ccc5aa1f63dbe75
2016-05-24Remove target_sdk_version parameterDimitry Ivanov
Since linker-namespaces are enabled for all target_sdk_versions and there is no longer need in workarounds in libnativeloader - remove unused target_sdk_version parameter for internal calls. This also brings libnativeloader closer to aosp/master Bug: http://b/26040253 Change-Id: I7d6f6ac31be0dca5f3c3f6ea20e6cc87ce3a3c7f
2016-05-17Merge "Set parent namespace for linker-namespaces" am: ac50d0cc57Dimitry Ivanov
am: 3457aba394 * commit '3457aba39480e85d582dd6890c4c72e418958782': Set parent namespace for linker-namespaces Change-Id: I20ea9239e95377894f477c33cf65bc7da7ad1e5a
2016-05-17Set parent namespace for linker-namespacesDimitry Ivanov
This change allows applications to share RTLD_GLOBAL native libraries between namespaces associated with different classloaders. The rule is - if a library is GLOBAL within namespace associated with parent classloader, it is shared with namespace associated with this classloader Note that the sharing happens on create_namespace event, which is tied to createClassloader in case of application classloaders created by the framework, for custom application classloaders it is tied to first loadLibrary() event. Bug: http://b/28560538 Bug: https://code.google.com/p/android/issues/detail?id=208458 Change-Id: I7ee701166f8ec5eff033b7acc0f80c7aa4ec5bda (cherry picked from commit 24db75c1ce7ff8376a475214b059b9a37ac07936)
2016-05-17Pass permitted_path to the linker as is.Dimitry Ivanov
am: 25df4bff44 * commit '25df4bff44a0d1a342dc45521bf7e860b3fef947': Pass permitted_path to the linker as is. Change-Id: Idf8459267f8e1cc7bebc9a55b1272871b3d8119a
2016-05-16Set parent namespace for linker-namespacesDimitry Ivanov
This change allows applications to share RTLD_GLOBAL native libraries between namespaces associated with different classloaders. The rule is - if a library is GLOBAL within namespace associated with parent classloader, it is shared with namespace associated with this classloader Note that the sharing happens on create_namespace event, which is tied to createClassloader in case of application classloaders created by the framework, for custom application classloaders it is tied to first loadLibrary() event. Bug: http://b/28560538 Bug: https://code.google.com/p/android/issues/detail?id=208458 Change-Id: I7ee701166f8ec5eff033b7acc0f80c7aa4ec5bda
2016-05-16Pass permitted_path to the linker as is.Dimitry Ivanov
Now that we have the fixed list of whitelisted libraries there is no longer need to check if java_permitted_path is nullptr. In fact checking it prevents custom classloaders created by apps from loading libraries using absolute path. Bug: http://b/28659864 Change-Id: I1bfc16a573b090f70f078ecccd0e4016939a5dc0 (cherry picked from commit b31caa95ec1ab9da7b300544e9716c1cac92d8f8)
2016-05-16Pass permitted_path to the linker as is.Dimitry Ivanov
Now that we have the fixed list of whitelisted libraries there is no longer need to check if java_permitted_path is nullptr. In fact checking it prevents custom classloaders created by apps from loading libraries using absolute path. Bug: http://b/28659864 Change-Id: I1bfc16a573b090f70f078ecccd0e4016939a5dc0
2016-05-11Merge "Move linker-namespace functions declarations" am: 37ed923d1cDimitry Ivanov
am: 3f0a12622b * commit '3f0a12622b8d35f1223945498a086e19c791bf24': Move linker-namespace functions declarations Change-Id: I6f3e8b5ef608e3b930510b5c483ec6e7963eb4f7
2016-05-11Move linker-namespace functions declarationsDimitry Ivanov
They are intended for platform use only and we shouldn't have them in the public header file. This CL moves them to libnativeloader private header file. Bug: http://b/28174921 Change-Id: I01cf446d2d8d7cf6f9e31130aa3d4e54fbbbb9fc (cherry picked from commit 6796522256b4cd861d3ebaf8264bd272b3c7441f)
2016-05-11Merge "Move linker-namespace functions declarations"Dimitry Ivanov
2016-05-11Merge "nativeloader: Ignore empty java_permitted_path" into nyc-devDimitry Ivanov
am: 6edd0c3a68 * commit '6edd0c3a68f60541c31fd65080e52939f2be3bc2': nativeloader: Ignore empty java_permitted_path Change-Id: I1777b3a05d2e233000815172cfa1e56326be634b
2016-05-10nativeloader: Ignore empty java_permitted_pathDimitry Ivanov
Passing empty permitted path should result in no-op. This addresses review comment on CL with commit f334cbf0e1425633bef96a21b0ce9e30f4c6ffa9 Bug: http://b/28639227 Change-Id: I4a4540e522e90a145a374939921932c86f35e88d (cherry picked from commit d0b1531929d76411d964d4077d441d751e2c01fb)
2016-05-11Merge "Check if public namespace has already been initialized" am: 0756fae4f1Dimitry Ivanov
am: 5cd1e6822a * commit '5cd1e6822abd016e5ee6e642528b39acaf15ae55': Check if public namespace has already been initialized Change-Id: I13740764783765256af2fb1672fbfc5592147760
2016-05-11Merge "Check if public namespace has already been initialized"Dimitry Ivanov
2016-05-10nativeloader: Ignore empty java_permitted_pathDimitry Ivanov
Passing empty permitted path should result in no-op. This addresses review comment on CL with commit f334cbf0e1425633bef96a21b0ce9e30f4c6ffa9 Bug: http://b/28639227 Change-Id: I4a4540e522e90a145a374939921932c86f35e88d
2016-05-10Extend white-listed directories to include /mnt/expandDimitry Ivanov
Apps on sdcard live under /mnt/expand and therefore this directory should be under linker namespaces permitted_path. Bug: http://b/28639227 Change-Id: I462f9f23656c95d9c2a48bb3f513abcd9d08f340 (cherry picked from commit f334cbf0e1425633bef96a21b0ce9e30f4c6ffa9)
2016-05-10Extend white-listed directories to include /mnt/expandDimitry Ivanov
Apps on sdcard live under /mnt/expand and therefore this directory should be under linker namespaces permitted_path. Bug: http://b/28639227 Change-Id: I462f9f23656c95d9c2a48bb3f513abcd9d08f340
2016-05-09Check if public namespace has already been initializedDimitry Ivanov
There is no point in reading/loading the list of public libraries once public namespace is already initialized. Change-Id: I5a53c46bb57b8de241ba521a6321c12e94a76476
2016-05-09Move linker-namespace functions declarationsDimitry Ivanov
They are intended for platform use only and we shouldn't have them in the public header file. This CL moves them to libnativeloader private header file. Bug: http://b/28174921 Change-Id: I01cf446d2d8d7cf6f9e31130aa3d4e54fbbbb9fc
2016-05-09nativeloader: Fix the case of search_path == nullDimitry Ivanov
When user creates custom classloader which does not extend BaseDexClassLoader the librarySearchPath gets set to null by java.lang.Runtime.doLoad(). This patch makes nativeloader correctly handle it. Bug: http://b/28659864 Change-Id: I1b61c6bc952984d7c49775a9178fc3270948e62a (cherry picked from commit 8a0425b86acd4f20ef68ef350ac32e1c5057c558)
2016-05-09nativeloader: Fix the case of search_path == nullDimitry Ivanov
When user creates custom classloader which does not extend BaseDexClassLoader the librarySearchPath gets set to null by java.lang.Runtime.doLoad(). This patch makes nativeloader correctly handle it. Bug: http://b/28659864 Change-Id: I1b61c6bc952984d7c49775a9178fc3270948e62a
2016-05-06Add public libs from an environment variableDimitry Ivanov
This is enabled only for builds with ro.debuggable=1 It is intended for use only in tests using dalvikvm and needing access to platform libraries. Bug: http://b/28449304 Change-Id: I402457d0da542996ccf265aeaa305f09881e4333 (cherry picked from commit 4ddabd01bf361cadb33baa7213e2ca5129b938f0)
2016-05-06Add public libs from an environment variableDimitry Ivanov
This is enabled only for builds with ro.debuggable=1 It is intended for use only in tests using dalvikvm and needing access to platform libraries. Bug: http://b/28449304 Change-Id: I402457d0da542996ccf265aeaa305f09881e4333
2016-05-04Merge "nativeloader: Add CloseNativeLibrary() method"Treehugger Robot
2016-05-04nativeloader: Add CloseNativeLibrary() methodDimitry Ivanov
This method is called by art on UnloadNativeLibraries() Bug: http://b/28406866 Change-Id: Ibccff93c83d6ccd3d0a1c0294a64b09281b4e05e (cherry picked from commit 09a516bf161c5cabdaa3a67df5aa7fbac667f5f9)
2016-05-03nativeloader: Add CloseNativeLibrary() methodDimitry Ivanov
This method is called by art on UnloadNativeLibraries() Bug: http://b/28406866 Change-Id: Ibccff93c83d6ccd3d0a1c0294a64b09281b4e05e
2016-05-02nativeloader: Add Reset capabilitiesDimitry Ivanov
In the case when VM is restarted all weak references from the old VM become invalid. In such event NativeLoader needs to clear the list of classloaders from old VM. Bug: http://b/28453840 Bug: http://b/28449304 Change-Id: I2268c1e21cf940c57ddc5f0312f56b71aa702134 (cherry picked from commit be4ca3afc0636b314d676480156eb6977739dd00)
2016-05-02nativeloader: Add Reset capabilitiesDimitry Ivanov
In the case when VM is restarted all weak references from the old VM become invalid. In such event NativeLoader needs to clear the list of classloaders from old VM. Bug: http://b/28453840 Bug: http://b/28449304 Change-Id: I2268c1e21cf940c57ddc5f0312f56b71aa702134
2016-04-27native_loader: Use ANDROID_ROOT environment variableDimitry Ivanov
Replace "/system" with ANDROID_ROOT environment variable. Bug: http://b/28320913 Bug: http://b/28082914 Change-Id: Ib039722cb059bae1635b45f6af20ef0180e83ba9 (cherry picked from commit 7e8cee8fb2e3d92e60554296eebe9d1e75cfd473)
2016-04-27Enable namespaces for all target sdk versionsDimitry Ivanov
We previously relied on the fact that target sdk version 0 implies system_server, which is not true, target sdk version may be set to 0 for other apps and it means 1 - the earliest version of android. This change enables namespaces for apps targeting all sdk version and for system_server. Bug: http://b/27702070 Change-Id: I16fbdeb6868c7035aec71132c80c150c08ea2cc3 (cherry picked from commit 213676b88019016f8c968a05c50a196e2aaaeff8)
2016-04-21native_loader: Use ANDROID_ROOT environment variableDimitry Ivanov
Replace "/system" with ANDROID_ROOT environment variable. Bug: http://b/28320913 Bug: http://b/28082914 Change-Id: Ib039722cb059bae1635b45f6af20ef0180e83ba9
2016-04-21Enable namespaces for all target sdk versionsDimitry Ivanov
We previously relied on the fact that target sdk version 0 implies system_server, which is not true, target sdk version may be set to 0 for other apps and it means 1 - the earliest version of android. This change enables namespaces for apps targeting all sdk version and for system_server. Bug: http://b/27702070 Change-Id: I16fbdeb6868c7035aec71132c80c150c08ea2cc3
2016-04-15Remove workaround for libart greylist.Alex Light
Bug: 27775991 Change-Id: I77f03b95f70957df58e666b011a07cfc2a33b480
2016-04-11Allow vendors to extend the list of public libsDimitry Ivanov
native_loader adds libraries specified in the (optional) file: /vendor/etc/public.libraries.txt to the list of public native libraries. Bug: http://b/27073931 Change-Id: I927193cce99d48c3395bd0e6c373ae9fad0f13f4 (cherry picked from commit 617f495cf7a8e07b433058fb7f4c7611b584fda9)
2016-04-06Allow vendors to extend the list of public libsDimitry Ivanov
native_loader adds libraries specified in the (optional) file: /vendor/etc/public.libraries.txt to the list of public native libraries. Bug: http://b/27073931 Change-Id: I927193cce99d48c3395bd0e6c373ae9fad0f13f4
2016-03-29Adjust check for target_sdk_version for workaroundsDimitry Ivanov
target_sdk_version=0 is a valid version, it basically means 1 (the very first version of android) not current one. Bug: http://b/27702070 Change-Id: Ib7843718f364b975e1d09a05377bf8580b407d9d
2016-03-29A workaround for apps using custom classloadersDimitry Ivanov
Allow custom classloaders to load native libraries from anywhere under /data Bug: http://b/27588281 Change-Id: Idb87b33361903f52b734ddd0ceaabe1ff9c281eb
2016-03-17Move list of public libraries to a config fileDimitry Ivanov
This list contains libraries that should directly or indirectly be accessible to apps for the platform. Note that this list is not device specific but rather device class specific. For now we have 2 separate lists; one for Android Phones and Tablets, and another one for Android Wear devices. Bug: http://b/27546414 Bug: http://b/22548808 Change-Id: I83de5e3cf67392d0e9af66f70123898bd5997146 (cherry picked from commit 4b0e963872715775a63f36b385150cba4801b1d0)
2016-03-17Move list of public libraries to a config fileDimitry Ivanov
This list contains libraries that should directly or indirectly be accessible to apps for the platform. Note that this list is not device specific but rather device class specific. For now we have 2 separate lists; one for Android Phones and Tablets, and another one for Android Wear devices. Bug: http://b/27546414 Bug: http://b/22548808 Change-Id: I83de5e3cf67392d0e9af66f70123898bd5997146
2016-03-16Revert "libnativeloader: Make webviewchromium so file optional"Dimitry Ivanov
This reverts commit 75dda7551f6a3499c0c45ed0f9530353c7616357. Bug: http://b/27546414
2016-03-16libnativeloader: Make webviewchromium so file optionalPrashant Malani
Not all android devices ship with Webview. The requirement of libwebviewchromium_plat_support.so to be loaded while initializing the android namespace is therefore liable to cause a crash on devices that don't support or use Webview. Therefore, this patch makes this requirement conditional, but enabled by default. To remove the dependency, device make files should add the following: TARGET_IGNORE_WEBVIEW_CHROMIUM := true Bug: 27336841 Bug: 27546414 Change-Id: Iaec1b58236356d981504ea8f716413ea334ca4f4
2016-03-04Handle the case when libart.so is not in useDimitry Ivanov
In the case when libartd.so is used libart.so does not have to be included in the public namespace. Bug: http://b/27496326 Change-Id: I464bafec1d9da5c3f3f03fef02af3f34bf377297
2016-02-29Fix locking of libnativeloaderDimitry Ivanov
This commit fixes race condition introduced in d047c925af62e1fe28fcd1c1940df4afe18d458a Bug: http://b/27189432 Bug: http://b/22548808 Change-Id: I5d94f130937f18d3443878b3521715a8f87427e0 (cherry picked from commit 34d5a20c8bb57adae8711c7f9d90a77fbd4043c7)