Age | Commit message (Collapse) | Author |
|
To make it easier to reason about thread safety.
Test: atest libnativeloader_e2e_tests libnativeloader_test \
art_libnativeloader_cts_test libnativeloader_lazy_test
Bug: 326505705
Bug: 326610154
Change-Id: I2447ed8120625823d3298d392d22828af2c22402
|
|
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
|
|
Replace uses of `android::base::{Starts,Ends}With()`.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: I80a0ca93f433464270989d248dd999e9366a1c17
|
|
(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
|
|
Previous change on handling product partition was based on the
assumption that all devices for mainline update would be product
treblelized, but it was not true. There are some upgrade devices to S
which is not product treblelized. This change checks if the device is
treblelized with first api level and product vndk version.
Bug: 305749591
Test: AOSP cuttlefish boot succeeded
Test: libnativeloader_e2e_tests passed
Change-Id: I46f9c0e253363b891bdc6b073df3cc14e9f7b5aa
|
|
There are some logic in libnativeloader to check if product is
treblelized by checking ro.product.vndk.version. However, this property
is no longer valid to check if product is treblelized, because of vndk
deprecation. This makes libnativeloader to consider as product is not
treblelized when the property is empty from the VNDK deprecation. This
causes unexpected error from libnativeloader which allows product apps
to use system / system_ext libraries when the product partition is VNDK
deprecated. Product is force-treblelized from R, so it is safe to assume
that product partition is always treblelized as long as the device is
treblelized. This change removes existing check of
ro.product.vndk.version, and use this check only to confirm if product
VNDK is deprecated.
Bug: 290159430
Test: Cuttlefish build and run succeeded
Test: libnativeloader_e2e_tests passed
Change-Id: Ieee3ff2dde4244e7c46420ad8dde5f8e5cf249e4
|
|
Directly extending the search path to /system/${LIB} for system APKs
may result in system libs being loaded in an app classloader namespace
rather than the system namespace. If those libs then depend on other
non-public libraries, e.g. in APEXes, that are only accessible through
links from the system namespace, then those dependencies will fail to
load because the app classloader namespace doesn't have the same links.
This CL functionally undoes https://r.android.com/2211602, but only
disables tests that break, and adds some tests to exercise the
situation above.
Also change native libs in the test to use `min_sdk_version` rather
than `sdk_version`, because now when they contain code they need an
NDK, and one with exactly version 31 is normally not available in the
build. (Otoh, the java libraries with `product_specific: true` or
`vendor: true` aren't allowed to use `min_sdk_version`.)
Test: atest -a libnativeloader_test libnativeloader_lazy_test \
libnativeloader_e2e_tests
Bug: 258340826
Bug: 237577392
Change-Id: I95a3fbc6c8021c037fffda1423aa90c62973ec89
|
|
Also take the opportunity to switch to shorter names, when they are
changing anyway. These namespaces aren't visible, so renaming them
shouldn't be a compat issue.
Test: atest libnativeloader_test libnativeloader_e2e_tests
Test: adb shell "setprop debug.ld.all dlopen,dlerror && setprop log.tag.nativeloader :v && stop && start"
Then check logcat that the classloader namespaces get the expected
unique names (per process).
Bug: 258340826
Change-Id: Ic5d6ba850d8cd9cdfb3a66e175dfc87046c0ba31
|
|
system apps.
Test: n/a - comment change only
Bug: 237577392
Change-Id: I12a2d731fd3b8bff908e8bd363b105d0eb8ad7f8
|
|
With the changed logic in https://r.android.com/2211602 it would
otherwise be treated as a system APK and given full access to system
libraries, which would be unfortunate.
/vendor must be a separate partition starting in U, but this is
necessary for the module on S and T.
A note on tests: It's difficult to set up fixtures to test
/system/{product,vendor} paths if the device has them as symlinks to
/{product,vendor}, because it would require moving the mount points and
symlink in the other direction.
Test: atest libnativeloader_e2e_tests
Bug: 237577392
Change-Id: I9267c008db644ebe38f6215d3b692b98dd88ee34
|
|
In particular this addresses the case when an app without a shared
namespace loads a shared system library that in turn loads a system JNI
library.
Give full access both ways between /system and /system_ext libraries,
and add a shared system_ext library and loading from system_ext to test
that.
Test: atest libnativeloader_e2e_tests
Bug: 237577392
Change-Id: Ief4e24dadbadd26c5602c9e593276fae01bd7038
|
|
This is a correction - it reused the vendor classloader namspace name
by mistake when product apps were introduced.
Test: `atest libnativeloader_e2e_tests` and look at logcat messages
Bug: 137356719
Change-Id: I3e8cfcb9ed8112bb0144ff2ea53fe7a8bcb63694
|
|
Test: atest -a libnativeloader_e2e_tests
Bug: 237572732
Change-Id: I93e38e81ef6f37a4dbf78833e83ec5a02d6b8211
|
|
Largely based on go/hiddenapi-list-renaming
Bug: 161336379
Test: TH
Change-Id: Iaa06eed26ab0cb9bb4e2995a148f3251386ad33d
|
|
When /product is unbundled from the /system, /product/etc/ may not
have 'public.libraries-<companyname>.txt' to extend public libraries.
Instead, /product/etc/public.library.txt can provide public libraries
from /product.
Bug: 186055799
Test: atest libnativeloader_test
Change-Id: I8994649826657f59ac1dac655205b9704a2c67c9
|
|
When library_path is ":" splitted list of .jar files, we should iterate
over each .jar file path to link a proper APEX namespace for JNI lib.
Bug: 169826971
Test: libnativeloader_test
Test: move libicing to appsearch apex
Change-Id: I3df47203d336036d0e015f9c5421b30a0377087f
|
|
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
|
|
The code path through native bridge and NDK translation should
propagate nullptr as well.
This to support a later change that changes the way native test
libraries are loaded in ART run tests.
Test: art/test/testrunner/testrunner.py --target --64 --optimizing
Bug: 130340935
Change-Id: I934d11942e41ccc6d140a7044faa160b006166f1
|
|
JNI library(libstat_jni) from statsd apex is handled via the build
system and linkerconfig.
Bug: 150767721
Test: presubmit
Test: atest libnativeloader_test
Change-Id: Ia7527f053508d5992c3eef209f77260f0d210e81
|
|
art, nn, i18n apexes provide some of libs listed in
public.libraries.txt. The list of these apexes are now read from
/linkerconfig/apex.libraries.config.txt generated by
/system/bin/linkerconfig.
Bug: 150767721
Test: cuttlefish boots
Test: atest libnativeloader_test
Change-Id: Ic603b42669dff89d5d3da2f6822312e827eddd86
|
|
Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference
#inclusivefixit
Bug: http://b/162536543
Test: device boots
Change-Id: Ia80fb2f3be6abdadbd061570d48a4ef0fefcfebc
|
|
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
|
|
The change was previously submitted in https://r.android.com/1283897
"Calling @IntraCoreApi from core-icu4j should not cause Core platform API violation"
https://r.android.com/1299494
Bug: 138994281
Test: m checkbuild on aosp_x86-userdebug
Test: device boots
Change-Id: Idb3e2450fca5d8300aef353fc1e4e99e24f04372
|
|
Revert "Move v8 and libpac into i18n APEX"
Revert "Move core-icu4j into I18n APEX"
Revert "Move ICU from ART APEX into i18n APEX"
Revert "Move core-icu4j into i18n APEX"
Revert "Move libpac into i18n APEX"
Revert "Add shared library into i18n APEX and add the required s..."
Revert "Make com_android_i18n namespace visible"
Revert submission 1299494-i18nApex
Reason for revert: Breaking aosp_x86-eng on aosp-master
Reverted Changes:
I30fc3735b:Move ICU from ART APEX to i18n APEX
Icb7e98b5c:Calling @IntraCoreApi from core-icu4j should not c...
Ic7de63fe3:Move core-icu4j into I18n APEX
I65b97bdba:Make com_android_i18n namespace visible
Ia4c83bc15:Move v8 and libpac into i18n APEX
I10e6d4948:Move core-icu4j into i18n APEX
I8d989cad7:Move ICU from ART APEX into i18n APEX
I72216ca12:Move ICU into i18n APEX
Ief9dace85:Add shared library into i18n APEX and add the requ...
I7d97a10ba:Move libpac into i18n APEX
I90fff9c55:Move ICU from ART APEX into i18n APEX
Change-Id: I516a8d290e3a3cc2b45d71ba5400364b0478a57a
|
|
It involves a change of boot class path to use core-icu4j
from i18n APEX.
Bug: 138994281
Test: device boots
Test: m build-art-target-tests
Test: CtsJniTestCases
Test: atest libnativeloader_test
Test: ./art/test/testrunner/run_build_test_target.py -j80 art-test
Test: art/build/apex/runtests.sh
Change-Id: I30fc3735be760cba48856cd102852d2a6c796374
|
|
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
|
|
Because cronet apex sets its jni_libs, its classloader-namespace is
linked automatically via jni.config.txt.
Bug: 143733063
Bug: 146420818
Test: atest CronetApiTest
Change-Id: I7ae0f7bc60f09e7e384abd1f0a1e4f8f90f64052
|
|
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
|
|
As product partition may have a different VNDK version than that of
vendor partition, they may not share the same VNDK namespace for
their apps.
Define a new vndk_product namespace in the system section for product
apps that uses ro.product.vndk.version.
Bug: 149063221
Test: atest libnativeloader_test
Change-Id: I1bb76617104a49b0d11af13d2f116959a18390a3
|
|
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
|
|
As part of statsd becoming a Mainline module, moving libstats_jni to the
apex requires adding it to the linker namespace here.
Bug: 145922701
Test: m -j
Change-Id: Ifcbea47cc36604e4a86df9af711d678b23012724
|
|
Follow-up to https://r.android.com/1220299.
Test: atest libnativeloader_test
Bug: 147987608
Change-Id: Ib5849c9a9f5dbde1bf2a85aad2fe96cc2a394f31
|
|
Linkerconfig now uses apex_names to automatically generate linker
namespaces from apexes.
Bug: 148826508
Test: build / boot
Change-Id: Id7fa68531033124727e618284af4fd2a61bdd85f
|
|
ro.vndk.version is only for vendor modules. Product modules use
different vndk version that is set in ro.product.vndk.version.
Use product vndk version for creating namespaces for product apps.
Bug: 148823287
Test: atest libnativeloader_test
Change-Id: Iade4b3ca846f1e47e5138f2ceda81bf188276a91
|
|
No functionality change.
Test: m
Change-Id: I3056596785447c5fb7410bcfc7d037eb295affc4
|
|
No functionality changes, this is a mechanical cleanup.
Test: m
Change-Id: I10030314ad8a06d49a63f1e2f3c5aa5b484e34b6
|
|
Platform namespace has been renamed as 'system' from linkerconfig
generator. To meet this requirement, libnativeloader should search for
namespace 'system' rather than namespace 'platform'.
Bug: 147987608
Test: m -j passed
Test: atest libnativeloader_test passed
Change-Id: I23d865ac71a80619f291eb9ae0761a2cad5df352
|
|
Only requires header library dependency.
Test: m
Change-Id: I84de37651f4cb01bdaaa2b354f0a71058a5772f8
|
|
Test: device boots
Test: atest libnativeloader_test
Change-Id: I5c20f7f5c65a707fbeacf644e24b95ffab370cae
|
|
Unbundling product apps must be triggerred if the target is enforcing
the product interfaces. The device must have ro.product.vndk.version
property if its product interface is enforced.
Unbundled product apps can use product libraries.
Bug: 144534640
Bug: 127738095
Bug: 128557860
Test: check boot and basic features
Change-Id: I32b2a1bd3e4f62b6acdbfab6bd277ec1132478a2
|
|
This is a workaround since apex module library path is not
supported in jni
Bug: 139397529
Bug: 145474221
Test: Build
Test: manual test with Cronet
Test: atest CtsJniTestCases
Test: atest libnativeloader_test
Change-Id: Ifd8aa85bd78e95131b2ce3eab0ad32c2bb19cee2
|
|
Test: atest libnativeloader_test
Bug: 130388701
Change-Id: I6dbb53cac7fb7ac8fb5178611a164c83c2ab59ba
|