Age | Commit message (Collapse) | Author |
|
This complements the treatment of NATIVELOADER_DEFAULT_NAMESPACE_LIBS,
so that ART internal libs can load the libraries listed in that
variable, as well as the other way around.
This makes it possible to load libartagent(d).so without absolute paths
in run tests on target, so use that to re-enable 900-hello-plugin.
Test: art/test/testrunner/testrunner.py --target --64 900
in armv8 target chroot
Test: art/test/testrunner/testrunner.py --host 900
Bug: 186654484
Change-Id: Ic418b26b2b77af8839af7b65ad44ea8b5121169c
|
|
Significantly shortens the locked durations, and makes it easier to
ascertain there's no reentrancy through the load code paths.
Test: atest libnativeloader_e2e_tests libnativeloader_test \
art_libnativeloader_cts_test libnativeloader_lazy_test
with and without CHECK condition inverted
Bug: 326505705
Bug: 326610154
Change-Id: Ib2290714fd102ae22f960e9f631c1623236f4d27
|
|
Bug: 349878424
Change-Id: I0a5f851dc7e54cd151f372d3e3eed0488ce64006
|
|
Avoid loading the libsobrige library.
Test: device boots after mainline update.
Bug: 349878424
Bug: 343621630
Change-Id: I19e1b9a9328eb5a39b9a91580f602a09d5366ae7
|
|
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
|
|
Bug: 264654008
Test: m tidy-art
Change-Id: I7cbe86ab1cc9de2ca2e80583203e8d9e7abcf44b
|
|
Add a function to native bridge that generates trampolines
for guest pointers and call it for native-bridged namespaces.
Bug: http://b/330367443
Test: art/libnativebridge/tests/runtests.sh --skip-target
Test: ./android-cts/tools/cts-tradefed run cts -m CtsJniTestCases
Change-Id: I02cab5ea6c87cb4d5065033a4b6793eb57fe0f52
|
|
(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
|
|
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
|
|
(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
|
|
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
|
|
Also some related code cleanups.
Test: atest libnativeloader_e2e_tests \
libnativeloader_test libnativeloader_lazy_test
Bug: 237577392
Change-Id: Ia8842cdaf84d282353f3b0c55ca3d56bbc3bd4aa
|
|
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
|
|
To allow running tests on user builds. The (non)existence of the
environment variable itself serves fine as a toggle, and it is hard to
inject into the zygote environment on a user build anyway.
Also a few other cleanups from comments on
https://r.android.com/1689792.
Test: art/test/testrunner/testrunner.py --target --64 --optimizing
Bug: 130340935
Change-Id: I1843a8bbfb5dadc560919022d1f2123eb652be5a
|
|
It's not needed any more since libarttest(d).so is loaded from the ART
linker namespace.
Test: art/test/testrunner/testrunner.py --target --64 --optimizing
Bug: 130340935
Bug: 167578583
Change-Id: I785133e921277cb25360856e9af20fa681b54a3b
|
|
(reland).
dlopen() calls in ART will use its own linker namespace
(com_android_art). That's appropriate for internal libraries in the
APEX, but not when ART loads libraries on behalf of external requests.
In those cases we should instead use android_dlopen_ext to load them
from the system namespace, i.e. the one that searches /system/lib(64).
The linker config has been using allow_all_shared_libs, so any loads
from com_android_art fall back to the system namespace, and hence
dlopen() usually works regardless which namespace it ought to use.
However we want to drop allow_all_shared_libs, so we need to figure out
which dlopen's should use which namespace:
1. Several ART libraries are loaded on-demand, e.g. libart-compiler and
libart-disassembler. There are also those going through the runtime
plugin system, like libperfetto_hprofd and heapprofd_client_api. All
these are internal or at least statically known (so we can provide
links for them in the linker config), and should continue to use
dlopen from the ART namespace.
2. libnativeloader loads the preloadable public libraries from
system/etc/public.libraries.txt, and should use the system namespace
for that.
3. libnativebridge loads the native bridge implementation specified
through the command line (or ultimately the system property
ro.dalvik.vm.native.bridge). It's not part of the ART APEX and not
known statically, so the system namespace should be used.
4. libnativeloader also loads JNI libraries from classloader
namespaces, but has a fallback if no such namespace can be found
based on caller location. Fall back to the system namespace to
handle libraries loaded during the preload phase in the zygote.
5. JVMTI agents are loaded by dalvik.system.VMDebug.attachAgent().
Treat these too as external libraries - they are loaded in a way
similar to JNI libraries through OpenNativeLibrary in
libnativeloader, so are covered by #4.
They are normally loaded by apps with a classloader, but a special
case is adbconnection which loads libjdwp.so in the ART APEX without
one and hence falls back to the system namespace. We therefore need
to create a link for it (https://r.android.com/1690889,
https://r.android.com/1690795).
All cases #2-#5 are covered by libnativeloader and libnativebridge.
Introduce OpenSystemLibrary, and since libnativeloader depends on
libnativebridge, put it in the latter to be usable from both. It's only
an internal dependency not exposed in the APEX stubs.
(Another possibility could be to put it in the generic toolbox lib
libartbase, but it's split into -d and non-d variants, and we don't
want to split libnative{loader,bridge} that way.)
Since libnativeloader_test no longer needs to mock dlopen we can
simplify it to a more regular test that loads the tested libs
dynamically.
This relands https://r.android.com/1673312 without setting
ANDROID_ADDITIONAL_PUBLIC_LIBRARIES in run-test-jar, because that made
libnativeloader try to preload internal libraries from the system
namespace.
Test: mmm art
Test: atest art/libnativeloader
Test: atest CtsJniTestCases
Test: Cuttlefish app compat test that uses NDK translation
Test: Manual tests with Android Studio TI agents
(http://g/art-module-team/7Jy3Tg7LCh0)
Test: art/test/testrunner/testrunner.py --target --64 --optimizing
in chroot on cuttlefish
Bug: 130340935
Change-Id: I7fb32faacc1c214402b58125d8190e97bbbcfad2
|
|
This reverts commit 582448f29f2f2529202bf868d00ba5d3d3776bb6.
Reason for revert: breaks tests
Change-Id: I2e0b2a28d4644b314887673d4aef4f1094aea289
|
|
dlopen() calls in ART will use its own linker namespace
(com_android_art). That's appropriate for internal libraries in the
APEX, but not when ART loads libraries on behalf of external requests.
In those cases we should instead use android_dlopen_ext to load them
from the system namespace, i.e. the one that searches /system/lib(64).
The linker config has been using allow_all_shared_libs, so any loads
from com_android_art fall back to the system namespace, and hence
dlopen() usually works regardless which namespace it ought to use.
However we want to drop allow_all_shared_libs, so we need to figure out
which dlopen's should use which namespace:
1. Several ART libraries are loaded on-demand, e.g. libart-compiler and
libart-disassembler. There are also those going through the runtime
plugin system, like libperfetto_hprofd and heapprofd_client_api. All
these are internal or at least statically known (so we can provide
links for them in the linker config), and should continue to use
dlopen from the ART namespace.
2. libnativeloader loads the preloadable public libraries from
system/etc/public.libraries.txt, and should use the system namespace
for that.
3. libnativebridge loads the native bridge implementation specified
through the command line (or ultimately the system property
ro.dalvik.vm.native.bridge). It's not part of the ART APEX and not
known statically, so the system namespace should be used.
4. libnativeloader also loads JNI libraries from classloader
namespaces, but has a fallback if no such namespace can be found
based on caller location. Fall back to the system namespace to
handle libraries loaded during the preload phase in the zygote.
5. JVMTI agents are loaded by dalvik.system.VMDebug.attachAgent().
Treat these too as external libraries - they are loaded in a way
similar to JNI libraries through OpenNativeLibrary in
libnativeloader, so are covered by #4.
They are normally loaded by apps with a classloader, but a special
case is adbconnection which loads libjdwp.so in the ART APEX without
one and hence falls back to the system namespace. We therefore need
to create a link for it (https://r.android.com/1690889,
https://r.android.com/1690795).
All cases #2-#5 are covered by libnativeloader and libnativebridge.
Introduce OpenSystemLibrary, and since libnativeloader depends on
libnativebridge, put it in the latter to be usable from both. It's only
an internal dependency not exposed in the APEX stubs.
(Another possibility could be to put it in the generic toolbox lib
libartbase, but it's split into -d and non-d variants, and we don't
want to split libnative{loader,bridge} that way.)
Since libnativeloader_test no longer needs to mock dlopen we can
simplify it to a more regular test that loads the tested libs
dynamically.
Test: mmm art
Test: atest art/libnativeloader
Test: atest CtsJniTestCases
Test: Cuttlefish app compat test that uses NDK translation
Test: Manual tests with Android Studio TI agents
(http://g/art-module-team/7Jy3Tg7LCh0)
Bug: 130340935
Change-Id: I2513472c4e1c44f0fcb01a6b4f6eccbb03718f1d
|
|
with an allow_all_shared_libs fallback to system.
The system and com_android_art namespaces need to be properly
separated, but run tests have relied on loading test libraries through
either LD_LIBRARY_PATH or java.library.path without a clear separation.
That has worked through a combination of
ANDROID_ADDITIONAL_PUBLIC_LIBRARIES and fallback dlopen() calls that
used the ART namespace.
This change introduces a new directory
/data/nativetest(64)/com.android.art for test libraries that depend on
internal ART libraries. It's added with LD_LIBRARY_PATH to the default
namespace, which in the APEX linker config has full access to
com_android_art.
Normal JNI libraries that don't depend on ART internals stay in
/data/nativetest(64)/art/<arch>. There should be no overlap between the
two locations.
A new environment variable NATIVELOADER_DEFAULT_NAMESPACE_LIBS is
introduced to list the libraries added through LD_LIBRARY_PATH, so
libnativeloader can link to them from classloader namespaces and in the
fallback namespace when no classloader is specified.
Like ANDROID_ADDITIONAL_PUBLIC_LIBRARIES,
NATIVELOADER_DEFAULT_NAMESPACE_LIBS is only effective when
ro.debuggable is true.
A new cc_defaults "art_test_internal_library_defaults" is added to
Android.bp, to be used in libraries that should be installed in the new
com.android.art directory.
Some run tests that are special and need more treatment are disabled
for now, to be addressed in b/186654484.
Test: art/test/testrunner/testrunner.py --target --64 --optimizing
Test: art/test/testrunner/testrunner.py --target --32 --jit
Test: art/test/testrunner/testrunner.py --host --64 --optimizing
Bug: 130340935
Change-Id: Iec640d5e22b46af2c1a4d375ce3f06c57b1d224e
|
|
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
|
|
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
|
|
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
|
|
Current APEX Namespace is named with APEX name itself, which also uses
.(dot) so linker configuration can keep the syntax safe.
For example, if there are APEX modules named 'A' and 'A.link.A', then
'namespace.A.link.A.link.A = a.so' phrase can be ambiguous from the
linker. To allow any additional linker syntax in the future, we should
avoid dot separator from the namespace name.
Bug: 148826508
Test: m -j passed
Test: boot succeeded from cuttlefish and walleye
Change-Id: I11b6da1b59b4ebf3016f1d783636c7e5d0f8309a
|
|
Linkerconfig now uses apex_names to automatically generate linker
namespaces from apexes.
Bug: 148826508
Test: build / boot
Change-Id: Id7fa68531033124727e618284af4fd2a61bdd85f
|
|
No functionality changes, this is a mechanical cleanup.
Test: m
Change-Id: I10030314ad8a06d49a63f1e2f3c5aa5b484e34b6
|
|
Only requires header library dependency.
Test: m
Change-Id: I84de37651f4cb01bdaaa2b354f0a71058a5772f8
|
|
This change moves system/core/libnative{bridge,loader} under art/.
Bug: 137364733
Test: m
Change-Id: I9be7333d00fcd3f36cd80520e50a30ea840187ad
|