summaryrefslogtreecommitdiff
path: root/libnativeloader/library_namespaces.h
AgeCommit message (Collapse)Author
2024-06-19Recognise system/system_ext as a system image partition path. Martin Stjernholm
Also move the regex used for that next to the other partition regex'es for visibility, and add some unit tests. Test: atest libnativeloader_tests libnativeloader_e2e_tests on mokey_go32 Bug: 346515837 Change-Id: I30a85678e0d3c45645d6f089f5f1d92e1360e8bf
2024-03-18Give full access to native libs from Java libs in the same partition Martin Stjernholm
(reland 2). For both packages and shared Java libs in system image partitions (system, product, vendor), load native libraries from the same partition by using the linker namespace for that partition ("default" or "system", "product", "sphal", respectively). This is only done for native libraries in the <partition root>/lib(64) directories when specified by an absolute path (i.e. use java.lang.System.load rather than loadLibrary). Otherwise it's looked up using the classloader namespace for the package, as before. Since only loads with absolute paths are affected, compat issues are unlikely. However to be on the safe side it's only enabled for SDK level 35 (VIC) and later (regardless of targetSdkVersion of the package, because the affected code is in system image partitions). This relands https://r.android.com/2933611 but keeps the vendor and product API domain checks unchanged in the CreateClassLoaderNamespace code paths (cf. b/326631342). Test: atest libnativeloader_e2e_tests \ libnativeloader_test libnativeloader_lazy_test Test: libnativeloader_e2e_tests on S, Sv2, T, and U platforms in CI Test: ImsServiceEntitlementUnitTests Bug: 237577392 Change-Id: I246101c1663d81089d9b4ae9450c28d564a7603a
2024-02-23Revert "Give full access to native libs from java libs in the sa..." Becky Siegel
Revert submission 2933611-libnativeloader-shared-syslibs Reason for revert: Fixing test breakage b/326622518, b/326631342 Reverted changes: /q/submissionid:2933611-libnativeloader-shared-syslibs Change-Id: I746478191c0e3a2d1a36d87e7a3db980de196420
2024-02-23Give full access to native libs from java libs in the same partition Martin Stjernholm
(reland). For both packages and shared java libs in system image partitions (system, product, vendor), load native libraries from the same partition by using the linker namespace for that partition ("default" or "system", "product", "sphal", respectively). This is only done for native libraries in the <partition root>/lib(64) directories when specified by an absolute path (i.e. use java.lang.System.load rather than loadLibrary). Otherwise it's looked up using the classloader namespace for the package, as before. Since only loads with absolute paths are affected, compat issues are unlikely. However to be on the safe side it's only enabled for SDK level 35 (VIC) and later (regardless of targetSdkVersion of the package, because the affected code is in system image partitions). This is based on a reland of commit 453b9fe909c22eb0f01b3072a5213dd46aed6f45, but with a different solution. It also extends the approach to work for vendor and product partitions. Test: atest libnativeloader_e2e_tests \ libnativeloader_test libnativeloader_lazy_test Test: libnativeloader_e2e_tests on S, Sv2, T, and U platforms in CI Bug: 237577392 Change-Id: If8b74503edfa9229b9eada73968b7d7b5c75ca10
2024-02-20Separate handling of a single path and a list of paths when determining Martin Stjernholm
API domains. Becomes necessary in a later CL where it gets used on more or less arbitrary paths where we shouldn't treat colons specially. The old code crashed with a fatal if a list of paths had both vendor and product directories in it. This changes that to a more appropriate error that gets propagated to the java level and becomes an exception where the classloader is created. Test: atest libnativeloader_test Bug: 237577392 Change-Id: I783af87a03de18c65fadcd1fd5a71423ec0c786b
2024-02-15Improve debug logging to reflect all code paths in OpenNativeLibrary. Martin Stjernholm
Also some related code cleanups. Test: atest libnativeloader_e2e_tests \ libnativeloader_test libnativeloader_lazy_test Bug: 237577392 Change-Id: Ia8842cdaf84d282353f3b0c55ca3d56bbc3bd4aa
2024-02-15Refactorings to make more logic available at the top level in Martin Stjernholm
native_loader.cpp. - Make the code that determines the partition from the dex path available to code in native_loader.cpp, and rename it since it'll be applied to arbitrary paths, not just APK's. - Move the linker namespace constants to a header file. - Various other minor code cleanups. To prepare for a later CL that needs to access these things from OpenNativeLibrary. No functional changes. Test: atest libnativeloader_e2e_tests libnativeloader_test Bug: 237577392 Change-Id: Ifc762bf6d4664b2d477c4ed3af58f149fb4c1189
2020-07-24libnativeloader understands uses-native-library tag Jiyong Park
Previously, libnativeloader provided all the partner-provided public shared libraries to apps unconditionally. Starting from Android S, apps targeting S (or higher) get only the libs that are explicited listed as dependencies using the <uses-native-library> tag in the app manifest. The libs not listed there are not available to the app even if they are registered as public libraries. The changed behavior affects new (S+) apps. Existing apps are not affected; they still get all the libraries. The implementation is rather straightforward. The library accepts a new parameter soname_list from the framework, which is actually from the <uses-native-library> tags of the app manifest. The list is used to filter the partner-provided libraries when the target sdk is > 30. Bug: 142191088 Test: atest CtsUsesNativeLibraryTest Merged-In: I52e23dda58fc69f51451c5dbeffd0a77125c9bff (cherry picked from commit e741dfd18dcd15f002bc1db9bd6634322e4eeef8) Change-Id: I52e23dda58fc69f51451c5dbeffd0a77125c9bff
2020-04-27Use ART_TARGET_ANDROID instead of __ANDROID__ Nicolas Geoffray
On golem, we build for ART_TARGET_LINUX, which doesn't have support for linkerconfig. Therefore, guard all linker namespace code on ART_TARGET_ANDROID instead of __ANDROID__ (which is unfortunately not under ART's control). Test: build for golem and run Bug: 154074847 Change-Id: I7a2b81918177704b42d8aafbd6d7e9d06d34e5f4
2020-03-04Loading JNI libraries in an APEX Jooyung Han
To load JNI libraries in an APEX, libnativeloader relies on jni.config.txt file which contains available JNI libraries for APEX namespaces: com_android_foo libfoo_jni.so:... com_android_bar libbar_jni.so:... This file is generated by linkerconfig. Bug: 143733063 Test: cuttlestone boots (For now, no behavioral changes because jni.config.txt is empty) Change-Id: I066de90a73875118be53972e50d076061922d762
2019-10-16Remove temporary CPPLINT.cfg files Orion Hodson
Temporary CPPLINT.cfg files were introduced when move libnativeloader and libnativebridge under art/. Bug: 141749154 Test: mm cpplint-art-all Change-Id: I85e75180138a512aef025f1e5275e20d8d1d14b0
2019-10-11Move libnative{bridge,loader} to art/ Orion Hodson
This change moves system/core/libnative{bridge,loader} under art/. Bug: 137364733 Test: m Change-Id: I9be7333d00fcd3f36cd80520e50a30ea840187ad