Commit graph

45 commits

Author SHA1 Message Date
Christopher Ferris
6664a805ca Add support to indicate bitness of public library.
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
Change-Id: I26b14893d104a9e1f62914663d8c972cd4d55e1e
2016-06-21 16:11:23 -07:00
Dimitry Ivanov
94ee4e690d Remove target_sdk_version parameter
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-24 08:40:38 -07:00
Dimitry Ivanov
ade364b456 Set parent namespace for linker-namespaces
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 24db75c1ce)
2016-05-17 15:58:56 -07:00
Dimitry Ivanov
25df4bff44 Pass permitted_path to the linker as is.
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 b31caa95ec)
2016-05-16 18:09:15 -07:00
Dimitry Ivanov
c337cae9ad Move linker-namespace functions declarations
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 6796522256)
2016-05-11 14:20:12 -07:00
Dimitry Ivanov
d0b1531929 nativeloader: Ignore empty java_permitted_path
Passing empty permitted path should result in no-op.
This addresses review comment on CL with commit
f334cbf0e1

Bug: http://b/28639227
Change-Id: I4a4540e522e90a145a374939921932c86f35e88d
2016-05-10 17:32:38 -07:00
Dimitry Ivanov
f334cbf0e1 Extend white-listed directories to include /mnt/expand
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-10 10:39:48 -07:00
Dimitry Ivanov
cf9892b6d1 nativeloader: Fix the case of search_path == null
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 8a0425b86a)
2016-05-09 12:21:55 -07:00
Dimitry Ivanov
7d02829636 Add public libs from an environment variable
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 4ddabd01bf)
2016-05-06 13:16:45 -07:00
Dimitry Ivanov
09a516bf16 nativeloader: Add CloseNativeLibrary() method
This method is called by art on UnloadNativeLibraries()

Bug: http://b/28406866
Change-Id: Ibccff93c83d6ccd3d0a1c0294a64b09281b4e05e
2016-05-03 14:55:25 -07:00
Dimitry Ivanov
be4ca3afc0 nativeloader: Add Reset capabilities
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-05-02 10:43:16 -07:00
Dimitry Ivanov
0b5651e158 native_loader: Use ANDROID_ROOT environment variable
Replace "/system" with ANDROID_ROOT environment variable.

Bug: http://b/28320913
Bug: http://b/28082914
Change-Id: Ib039722cb059bae1635b45f6af20ef0180e83ba9
(cherry picked from commit 7e8cee8fb2)
2016-04-27 13:43:33 -07:00
Dimitry Ivanov
5539db0b4f Enable namespaces for all target sdk versions
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 213676b880)
2016-04-27 11:44:42 -07:00
Alex Light
3150fa2514 Remove workaround for libart greylist.
Bug: 27775991

Change-Id: I77f03b95f70957df58e666b011a07cfc2a33b480
2016-04-15 12:42:44 -07:00
Dimitry Ivanov
b614045894 Allow vendors to extend the list of public libs
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 617f495cf7)
2016-04-11 13:13:18 -07:00
Dimitry Ivanov
4f8bb2577a Adjust check for target_sdk_version for workarounds
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-29 16:12:40 -07:00
Dimitry Ivanov
7f9a1aaf05 A workaround for apps using custom classloaders
Allow custom classloaders to load native libraries
from anywhere under /data

Bug: http://b/27588281
Change-Id: Idb87b33361903f52b734ddd0ceaabe1ff9c281eb
2016-03-29 11:12:18 -07:00
Dimitry Ivanov
4b0e963872 Move list of public libraries to a config file
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-17 09:45:52 -07:00
Dimitry Ivanov
9c0a202977 Revert "libnativeloader: Make webviewchromium so file optional"
This reverts commit 75dda7551f.

Bug: http://b/27546414
2016-03-16 13:54:33 -07:00
Prashant Malani
75dda7551f libnativeloader: Make webviewchromium so file optional
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-16 13:03:12 -07:00
Dimitry Ivanov
5f28b8460d Handle the case when libart.so is not in use
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-03-04 15:02:16 -08:00
Dimitry Ivanov
34d5a20c8b Fix locking of libnativeloader
This commit fixes race condition introduced in
d047c925af

Bug: http://b/27189432
Bug: http://b/22548808
Change-Id: I5d94f130937f18d3443878b3521715a8f87427e0
2016-02-29 13:21:43 -08:00
Dimitry Ivanov
d047c925af Added function to explicitly initialize a namespace
This change replaces lazy get-or-create logic for
linker namespaces with the explicit one.

ApplicationLoaders.getClassLoader(..) is now resposible for
the namespace initialization for PathClassLoaders.

Bug: http://b/27189432
Bug: http://b/22548808
Change-Id: Ife987c3ca1db33a47c20f363a5ed61512be8b5a7
2016-02-25 11:33:32 -08:00
Dimitry Ivanov
426799d770 Add PreloadPublicNativeLibraries function
Shift responsibility of preloading native libraries to the user
of the library. This lets applications that do not use jni but
depend on libnative_loader.so to avoid unnecessary preloads of
public libraries which could be expensive.

Bug: http://b/27245894
Change-Id: I12a8100de5da639c068769bca21ecebff2b2d538
2016-02-24 23:30:27 +00:00
Jesse Hall
2f9cd05c47 Merge "native_loader: add libvulkan.so to public native library list" into nyc-dev 2016-02-24 00:50:10 +00:00
Jesse Hall
dee3d96c01 native_loader: add libvulkan.so to public native library list
Change-Id: I2228af5ec4b815631a9c5ca745718807d58028a3
2016-02-23 16:16:47 -08:00
Dimitry Ivanov
f44ecde588 nativeloader: Export FindNamespaceByClassLoader
Bug: http://b/27189432
Change-Id: Ib80dcce949276ee620f601c47b20f783708e8e85
(cherry picked from commit 0cd10d83e4)
2016-02-23 11:50:44 -08:00
Dimitry Ivanov
c914ebd484 nativeloader: refactor FindNamespaceByClassLoader method
FindNamespaceByClassLoader returns android_namespace_t* to make
it suitable for exporting this functionality.

Bug: http://b/27189432
Change-Id: Ifef3de753192178e0184fb114596fe956fde2826
(cherry picked from commit 34fa704df4)
2016-02-23 11:50:28 -08:00
Elliott Hughes
2a7f7e0090 Move libnativeloader headers into libnativeloader.
Change-Id: I227676276da1b08a84486f29fb0e1502c8dbdf4a
(cherry picked from commit e2b4e1e00c)
2016-02-22 15:23:22 -08:00
Dimitry Ivanov
dab56737ca Limit libart.so visibility to apps targeting <= M
Add libart.so to the list of public libraries only for
apps targeting android M and below.

Bug: http://b/27210062
Bug: http://b/26436837
Change-Id: I1ed3b0335a343044a76273741ea8770dcce12ebe
2016-02-17 17:22:20 -08:00
Dimitry Ivanov
d68c8e9f84 Preload public native libraries
Preload libraries needed by the public namespace
at the earlier stage. This saves time on
InitPublicNamespace and saves memory because
the libraries are linked before zygote fork.

Bug: http://b/26409579
Change-Id: I59153a4180b930f31b542d8d2cb17b5d63c36774
2016-02-11 10:22:38 -08:00
Dimitry Ivanov
4e9bda3873 Merge "Include icu4c libraries to the list of public libs" am: 17e33647f0
am: 819da66bec

* commit '819da66bec28c31d564ba695d4d32f1a4727cad1':
  Include icu4c libraries to the list of public libs
2016-02-02 20:10:12 +00:00
Dimitry Ivanov
c24ca894f5 Include icu4c libraries to the list of public libs
Note that with this change the linker will ignore
icu libraries provided by an app because public
libraries are always provided by system. At this point
it does not affect any apps because before Marshmallow
all of them were getting platform version of icu4c
libs anyways (they will be getting their own copy of the
library only in Marshmallow release).

Bug: http://b/26217329
Bug: http://b/26929349
Change-Id: I681cab43c9f28ec22319d9f0424bd3df00743a5f
2016-02-02 11:06:31 -08:00
Dimitry Ivanov
73d2bc07b2 Add libcamera2ndk.so to the list of public libraries
Bug: http://b/23012001
Change-Id: If5bfd9ea15fcfe508aee4731d7f84fe517bfb43e
2016-01-26 10:49:24 -08:00
Dimitry Ivanov
e803dd8aec Merge "Add libRS.so to the list of public libraries" am: ebe04a9b89
am: 108eaa1429

* commit '108eaa1429ec7cffd5aa38a97674fb3565ad581e':
  Add libRS.so to the list of public libraries
2016-01-14 02:08:33 +00:00
Dimitry Ivanov
cdb6fee17c Add libRS.so to the list of public libraries
Bug: http://b/26509995
Change-Id: I8c0ae3629928171d229a901cfc997780665e3ae8
2016-01-13 15:19:35 -08:00
Dimitry Ivanov
6082622b18 Merge "Make libwebviewchromium_plat_support.so public" am: cd60e4bdd6
am: ce292ad06c

* commit 'ce292ad06ccd38beaa2d7bf8add13dbdf01f91e5':
  Make libwebviewchromium_plat_support.so public
2016-01-12 04:52:47 +00:00
Dimitry Ivanov
3d5a43449f Add libart.so to the list of public libraries
This is a temporary workaround for apps relying
on libart internal state.

Bug: http://b/26436837
Change-Id: Ibd6a766c3c8edebe885d897565a72a7a407828c3
2016-01-11 14:53:59 -08:00
Dimitry Ivanov
90bf68e8d1 Make libwebviewchromium_plat_support.so public
Add libwebviewchromium_plat_support.so to the list
of public libraries.

Bug: http://b/26461431
Change-Id: I958a1182198bf59d9b6fc818953212ce505d6bdd
2016-01-08 12:35:38 -08:00
Dimitry Ivanov
619ffb4f5b Revert "Temporary disable linker-namespaces"
This reverts commit c18ac7cd2b.
2015-12-31 14:11:34 -08:00
Dimitry Ivanov
d2a6220001 Add parameter for shared namespaces
Shared namespaces are used for bundled app classloaders.

Bug: http://b/22548808
Bug: http://b/26165097
Change-Id: I163033f70c50ef9ddb4164676c033ab30748964e
(cherry picked from commit ef4639c1a5)
2015-12-19 23:38:28 -08:00
Dimitry Ivanov
c18ac7cd2b Temporary disable linker-namespaces
Bug: http://b/26164393
Change-Id: If6277407a6a5a4da9e3ad01dc45f57a7fc9954e4
2015-12-11 18:15:41 -08:00
Dimitry Ivanov
0d6e59407d Apply permitted path to the classloader-namespace
Bug: http://b/25853516
Bug: http://b/22548808
Change-Id: I283e6ee8d743bc3ab41aab9f36af0abbe729943f
2015-12-09 15:39:36 -08:00
Elliott Hughes
8b0471462e Track rename of base/ to android-base/.
Change-Id: I974d67b6568e913bfb7700d952be55b4073388ee
2015-12-08 10:38:59 -08:00
Dimitry Ivanov
ac1b1919f8 Native loader as a separate library
Extracted native loader to separate library in order to
be able to reuse it for NativeActivities related native code
in libandroid_runtime.so

Bug: http://b/22548808
Change-Id: Ibcf5ddcdc5aba22e32e4b72887840e9c171c1986
2015-12-07 12:59:02 -08:00