summaryrefslogtreecommitdiff
path: root/libnativeloader
AgeCommit message (Collapse)Author
2019-10-09Move libnative{bridge,loader} to art/Orion Hodson
Bug: 137364733 Test: m Change-Id: I8fc0796745f7310f477fe9f8b0821586742dd9c0
2019-10-08Prepare for libnative{bridge,loader} moving to art/Orion Hodson
Add temporary public visibility for libraries. Update bpfmt for ART's repohooks. Bug: 137364733 Test: m nothing Test: copy libs to art/, create a CL, run repohooks, m nothing. Change-Id: Ib9a280136e4b992fe17b8943cf404c9c803efb8d
2019-10-08Merge "Rename the runtime linker namespace following ART/Runtime APEX split."Treehugger Robot
2019-10-07Fix explicit constructor warning from cpplintOrion Hodson
Bug: 137364733 Test: m Change-Id: Ia3badccda5e6ca139d889c3c7b5aa8a9ab79ef38
2019-10-07Rename the runtime linker namespace following ART/Runtime APEX split.Martin Stjernholm
Remove the kludge in libnativeloader to deal with the inconsistency wrt the name of the APEX package. Test: Build & boot Test: atest system/core/libnativeloader (on cf_x86_phone) Bug: 139408016 Change-Id: I6115b49237c78c2ea4aa943ca4fe0b296b5a2b62
2019-10-03Merge "public libs from APEXes are pre-loadable"Jiyong Park
2019-10-03public libs from APEXes are pre-loadableJiyong Park
This change fixes a bug that public libs from APEXes are never pre-loaded. This was happening because those libs are removed by InitDefaultPublicLibraries which was originaly designed for listing up the libs that needs to be provided to the app namespace from the default namespace. Since the libs from APEXes are not available from the default namespace, but from their own namespaces (e.g."runtime", etc.), the removal was fine. But the problem happend when the same function is parameterized (with bool for_preload) and used to get the libs for preloading. This change fixes the problem by not removing the libs from APEXes when the function is called with for_preload == true. Bug: 141847343 Test: m Change-Id: I9edf2f94bac473ac7d0651514a2dabe976f81058
2019-10-02Merge "libnativeloader: fix typo in README.md"Treehugger Robot
2019-09-30libnativeloader: fix typo in README.mdJooyung Han
Test: N/A Change-Id: I7766ebaafa193b90096c5061adbf67eaf26e651c
2019-09-27Add temporary CPPLINT.cfg files to libnative{bridge,loader}Orion Hodson
This is just to permit moving under art/. We'll back these out after the move (assuming it's not too much gratuitous churn). Bug: 141749154 Test: symlink libraries under art/, m cpplint-art-all Change-Id: Ibd4882f416072076d4605bc329192f0bc1b196fb
2019-09-12Remove unused libnativeloader-dummy-headersPaul Duffin
Has been replaced by better name libnativeloader-headers. Test: m checkbuild Change-Id: I922530812dbe4f0b30793241a8e1d5c874a75730
2019-08-30Update paths and names for the new ART APEX.Martin Stjernholm
Test: Build & boot Test: atest CtsJniTestCases Bug: 135753770 Exempt-From-Owner-Approval: Approved internally Change-Id: Ic59b7bc8aae7ce521cf3ec9df4ab72aa611d0b75 Merged-In: Ic59b7bc8aae7ce521cf3ec9df4ab72aa611d0b75
2019-08-21add nopreload option in public.libraries.txtJiyong Park
A lib with 'nopreload' option in public.libraries.txt is not preloaded during zygote. This is useful for seldom used public libraries; they don't contribute to the zygote startup time and only affect the apps that they are used. Bug: 132911956 Test: libnativeloader_test Change-Id: I6f97c90e6721aec7f2f96c8fc7b963b34f8edd3e
2019-08-15Initialize pointer member of LibaryNamespacesJiyong Park
Explicitly initialize the pointer member `app_main_namespace_` of the class LibraryNamespaces. Test: atest libnativeloader_tests Change-Id: I3932e7fb3c4074a127fcdbdedbd9c88652a7e36c
2019-08-12Don't create anonymous namespaceJiyong Park
Don't create anonymous namespace separately, use the first namespace that is created for app classloader as the anonymous namespace. Note that the anonymous namespace is set via the new ANDROID_NAMESPACE_TYPE_ALSO_USED_AS_ANONYMOUS. I didn't creat a new function like android_set_anonymous_namespace as it requires uprev of the libnativebridge interface and makes it harder to delete the old android_init_anonymous_namespace as we have to keep it until all proprietary bridged loaders are updated. Bug: 130388701 Test: CtsBionicTestCases Test: run games on http://www.monogame.net/showcase/?Android Change-Id: I0fdd614365eaa56c4ab47538bf3772d94bd9ae55
2019-08-01Don't fail if default namespace isn't foundJiyong Park
This fixes a regression caused by 8f4afc8298ebae34e8f944a0807943997908c67d that libnativeloader can't no longer handle the case that it has failed to find the default namespace. Previously before the change, libnativeloader continued to use nullptr as the parent namespace which is reconized as the default namespace inside the linker. This change recovers the previous behavior. When the default namespace is not found, NativeLoaderNamespace object is constructed from nullptr. Bug: 138607234 Test: run app-compat/app-startup-gce on cf_x86_phone using forrest Change-Id: If518fbc055399b73e7d3a6b45ace0f71e9c25dae (cherry picked from commit db825ceba694eb6abe4ecff45fc4e1121646385f) Merged-In: If518fbc055399b73e7d3a6b45ace0f71e9c25dae
2019-07-27Merge "Use android::base::Result in libnativeloader"Treehugger Robot
2019-07-26Merge "Don't fail catastrophically on non-existing namespace"Treehugger Robot
2019-07-26Don't fail catastrophically on non-existing namespaceJiyong Park
When a new namespace is added to ld.config.txt, it has to be reflected to native_loader_test.cpp. However, failing to do so crashes the test instead of showing an error message that the namespace hasn't been added. Fixing the issue by not returning nullptr when the namespace isn't found. Bug: 138304345 Test: libnativeloader_test Change-Id: I9eee1293956caac69f95a946604a2e6f665bde89
2019-07-26Use android::base::Result in libnativeloaderJiyong Park
Remove the out parameters for error messages using Result<T>. Bug: 130388701 Test: libnativeloader_test Change-Id: Idbaf391c183fb20d5e1d7c96f3a4ccbf9745b7e6
2019-07-25Fix libnativeloader_testJiyong Park
Just before the test is enabled, the neuralnetwork namespace was added by https://android-review.googlesource.com/c/platform/system/core/+/1014637. This is breaking the libnativeloader_test. Fix the test by adding the code for the new namespace. Bug: 138304345 Test: libnativeloader_test on aosp_cf_x86_phone Change-Id: Ifa762e395a3b9b5debdbcfcbcb395eeda3a1b2a4
2019-07-24Merge "ld.config for com.android.neuralnetworks APEX."Przemyslaw Szczepaniak
2019-07-23Add TEST_MAPPING for libnativeloaderJiyong Park
Bug: 130388701 Test: watch TH to see if libnativeloader_test is running Change-Id: I0940d13ec4e5c680ce1dbf2f5980b3b20080f7e4
2019-07-23Test the link to the sphal namespace when only neededJiyong Park
The link to the spahal namespace is not done when there is no lib in vendor/etc/public.libraries.txt Bug: 130388701 Test: libnativeloader_test on cuttlefish Change-Id: I38f2d01305bca5ea942573484a0e0b9b44b1c0be
2019-07-22ld.config for com.android.neuralnetworks APEX.Przemyslaw Szczepaniak
Makes updated libneuralnetworks.so in /apex/com.android.neuralnetworks/{LIB} loadable from all relevant namespaces. Test: Verified that right library is being loaded using lsof and Test: verbose debug logs from bionic/ld. Bug: 137320025 Change-Id: I38140bb9915a3f85f10456e15ed0f492dbdba802
2019-07-19Revert "Revert "add unittests for libnativeloader""Jiyong Park
This reverts commit 4ec2b289834e37a518a1d9a006fccefd78c2370d. Bug: 137881576 Bug: 130388701 Test: libnativeloader_test Test: m libnativeloader_test on full-eng Change-Id: Ib96f7235845b68cde713af278313c5aa751ff738
2019-07-18Revert "add unittests for libnativeloader"Raman Tenneti
This reverts commit 6b6437bab55228c587fab8323a6dafd9f86e1434. Reason for revert: <INSERT REASONING HERE> Change-Id: Ice571bf7379743d516e0185fd9f1f0ffb284240a
2019-07-18add unittests for libnativeloaderJiyong Park
libnativeloader hasn't had a unit test. Now we have it. The unittest mocks calls to libdl, libbridgedloader, and JNI using gmock. Not all tests are added yet. To ease the review, a few tests for core scenarios are added. Bug: 130388701 Test: libnativeloader_test Change-Id: I518512047da66b44bc99cec26e2c34ba4985cca3
2019-05-17Fix nullpointer dereference in libnativeloaderJiyong Park
The `char* path` argument of OpenNativeLibrary() can be nullptr. We are constructing std::string from the path, which is a bug. Fixing it by using char* without converting it to std::string. Test: run-gtests.sh JniCompilerTest.CompileAndRunIntMethodThroughStubNormalCompiler is successful. Change-Id: I91249da7c1a72a2dff9bc77e477b465e0c7ee056
2019-05-16Add README file for libnativeloaderJiyong Park
Bug: 130388701 Test: N/A Change-Id: Idb6ef31d72041759d42b9e8fb504af2103c149e3
2019-05-16Fix style around header inclusionJiyong Park
This change is to be in sync with other libraries in system/core. External headers are included via #include <...> rather than #include "...", which is for headers from the current library. Bug: 130388701 Test: build & pass presubmit tests Change-Id: Ifb87ebaea1b0ff95e2e79352e6a42e3bfd949c52
2019-05-16Hide non-bridged/bridged namespaces behind NativeLoaderNamespace classJiyong Park
NativeLoaderNamespace fully abstracts the non-bridged (so called android-) and bridged namespaces. Bug: 130388701 Test: build & pass presubmit tests Change-Id: I3d5ca7515711e7638f4a5ab4d3a150185c3d17ac
2019-05-10Refactor public_libraries.cpp moreJiyong Park
- *_public_libraries() are now thread-safe - removed some of the duplicated code Bug: 130388701 Test: build & pass presubmit tests Change-Id: I34b5149f75e28bb892cffe8fd9070be886d2f9bd
2019-05-08Refactor public_libraries.*Jiyong Park
- shorten the long const variables - merge {oem|product}_public_libraries into extended_public_libraries Bug: 130388701 Test: build & pass presubmit tests Change-Id: I43be555041466118f2b2d188f5da3ff0d8ed7d8d
2019-05-08Introduce utils.hJiyong Park
Introduce utils.h to have common routines. Bug: 130388701 Test: build & pass presubmit tests Change-Id: Ic40da64fefc1f2216bdea9ea93a15e5abb8f23a4
2019-05-08Move public libraries list to a separate source fileJiyong Park
Functions for reading the public libraries list are moved out of library_namespace.cpp to public_libraries.cpp. In addition, library-local symbols are moved from android namespace to android::nativeloader namespace. Bug: 130388701 Test: build & pass presubmit tests Change-Id: If82419598304d56d29bfec4ef553443c788d0f53
2019-05-04move classes out of native_loader.cppJiyong Park
native_loader.cpp is too crowded. Move the classes NativeLoaderNamespaces and LibraryNamespaces out of native_loader.cpp to their own source files. This change does not alter any functionality. Bug: 130388701 Test: m, presubmit tests Change-Id: Ibc61ec0dc6727af7cac865b1971ebf1befac6855
2019-05-01Reland: Fix libnativeloader to correctly link to the platform namespace.Martin Stjernholm
This relands http://r.android.com/951440: This affected binaries in the Runtime APEX, where the platform namespace is "platform" rather than "default". Also extend ANDROID_ADDITIONAL_PUBLIC_LIBRARIES to create links to both to platform and runtime namespaces, so that it can be used to open up access to internal libraries in the Runtime APEX as well, which is used by ART gtests and run tests. Also update some comments in the ld.config*.txt files to accurately explain why some namespaces need to be visible, and some other minor changes for consistency. There are no semantically significant changes in those files. Test: Flash and boot Test: Run an ART run test with the internal libarttest.so library Test: lunch aosp_cf_x86_phone-eng; atest android.compilation.cts.AdbRootDependentCompilationTest#testCompile_curProfile \ com.android.cts.dexmetadata.InstallDexMetadataHostTest#testProfileSnapshotAfterInstall \ installd_dexopt_test Bug: 130293232 Bug: 121117762 Change-Id: I3d9f2102a03e83843e15bc78b5ad347220c52769
2019-04-30Merge "Revert "Fix libnativeloader to correctly link to the platform ↵Treehugger Robot
namespace.""
2019-04-29Revert "Fix libnativeloader to correctly link to the platform namespace."Martin Stjernholm
This reverts commit 4ca0ca67bf466381e59865137e6811e863002984. Reason for revert: Breaks android.compilation.cts.AdbRootDependentCompilationTest#testCompile_curProfile and others: http://g/art-team/R2nEDA1Ka_s Change-Id: Ia6285648133d21e61040efafc73cac97d702a7c4
2019-04-29Merge "Nativeloader: Restrict anonymous namespace creation"Treehugger Robot
2019-04-29Fix libnativeloader to correctly link to the platform namespace.Martin Stjernholm
This affected binaries in the Runtime APEX, where the platform namespace is "platform" rather than "default". Also extend ANDROID_ADDITIONAL_PUBLIC_LIBRARIES to create links to both to platform and runtime namespaces, so that it can be used to open up access to internal libraries in the Runtime APEX as well, which is used by ART gtests and run tests. Also update some comments in the ld.config*.txt files to accurately explain why some namespaces need to be visible, and some other minor changes for consistency. There are no semantically significant changes in those files. Test: Flash and boot Test: Run an ART run test with the internal libarttest.so library Bug: 130293232 Bug: 121117762 Change-Id: I7ebaf5370dd0f533b1bb5f0e67e7c3c1df48e512
2019-04-26Nativeloader: Restrict anonymous namespace creationAndreas Gampe
Create the anonymous namespace only from a non-empty library path. This is a better heuristic than the current "first-come" one. It allows creating classloaders that are not directly related to an app's "main" classloader, that is, do not have any library path. This is the case, for example, for shared libraries, including preloaded ones. Longer-term, the anonymous namespace creation should be made explicit, so that the framework can have full control. Bug: 130623656 Test: m Test: manual Change-Id: I8251363b372e365d10ae09d23df93d76388ac7f9
2019-03-28Add dependency on libdl_androiddimitry
platform private symbols have been moved to libdl_android.so since they are not intended to be accessible from apps. Test: make Bug: http://b/129387775 Change-Id: I883a6d2ca588a258dd43efa766fad4e07428594e (cherry picked from commit e3d0383d38fbac339a6a2ef02403836e41a11cd3)
2019-03-25Do not fail when there is no vndk namespaceKiyoung Kim
Some of the legacy devices may not have vndk namespace. To make this work, libnativeloader should not fail when it fails to search for vndk namespace. Bug: 129011845 Test: m -j Change-Id: I6f68aeb6ae84a00985cc20561b2fcdb461be9724 Merged-In: Id9147d4aeee9ba2b301b6893dea5884dce9c14fa
2019-03-07Add product apk support from libnativeloaderKiyoung Kim
Currently libnativeloader appends vendor lib path if apk is from vendor partition. Similar to this we should add product lib path if apk if from product partition. Bug: 124705551 Test: m -j && tested from crosshatch with product apps (such as Wallpaper) Change-Id: I8c3473f1f70b1c22dcaed7eb2d5f9c3deee9e1a5 Merged-In: I8690167ca8098015c8ae4bbb4f028404c5e94dc0
2019-02-23Avoid runtime namespace becoming parent for classloader-namespace.Martin Stjernholm
Passing nullptr as parent namespace to android_create_namespace makes it use the namespace of the caller as parent, which typically is the runtime namespace. That in turn causes classloader-namespace to inherit any libraries in the shared group of the runtime namespace, i.e. any libraries that have been loaded in it with RTLD_GLOBAL or DF_1_GLOBAL up to that point. Let's instead pass the platform namespace from the linker config as fallback when a parent namespace cannot be found. That is also what happened before libnativeloader moved into the runtime namespace. Test: Flash and boot Test: atest CtsJniTestCases (on cuttlefish and taimen) Bug: 124501296 Change-Id: If2faee74e2bdcf95d19516faec340fedcdd07e29
2019-02-22Remove dependency on libcutilsOrion Hodson
libnativeloader is in the Runtime Module, libcutils is not. Dependency was on property_get so moving to libbase equivalent. Bug: b/125323247 Test: m -j100 Change-Id: I295ffa14b475a193a851db89dbb3b4c9cc0183d2
2019-02-19Merge changes from topic "dup_icu4c"vichang
* changes: Linker namespace changes for moving ICU4C to APEX Remove the public libs in runtime namespace
2019-02-12shim libraries for libnativeloader and libnativebridgeJiyong Park
libnativeloader_lazy and libnativebridge_lazy are shim libraries for libnativeloader and libnativebridge, respectively. The shim libraries provides the same APIs as their counterparts, but when the APIs are called, the APIs from the real libraries are loaded/linked/and executed using dlopen/dlsym. Bug: 123403798 Bug: 124250621 Test: m Test: device boots to the UI Test: mma under system/core/libnativebridge with aosp_cf_x86 adb sync; execute all tests under /data/nativetest/libnativebridge-lazy-tests All passes except NativeBridgeTest.V2_Signal which is also failing in /data/nativetest/libnativebridge-tests. Change-Id: Ic6484784eaa7872dcdd2decbb30943fb34c1abd7