Commit Graph

87 Commits

Author SHA1 Message Date
Mark Salyzyn 30f991f251 liblog: use log/log.h when utilizing ALOG macros
Test: compile
Bug: 30465923
Change-Id: Id6d76510819ebd88c3f5003d00d73a0dbe85e943
2017-01-11 09:31:15 -08:00
Jaekyun Seok 86e80b9be0 Use shared lib of libutils, libz and libbase.
libutils, libz and libbase are being used as shared lib by many other
modules.
So using their shared lib will reduce total image size.

Size diffs on angler build image are as follows.

libziparchive.so  : 103844 -> 41680 (-62164)
libnativeloader.so:  50824 -> 25104 (-25720)
total             : (-87884)

Test: building succeeded, and the image was tested on angler.
Bug: 33056637
Change-Id: I015afe5b8f4d87d495b706e2e78d60f44a910e87
2016-12-22 07:03:26 +09:00
Dimitry Ivanov d836ab005a Allow different namespace types for different classloaders
An app should be able to make cross-arch calls to different apps
via other app's Context.getClassLoader()

Bug: 32542970
Test: Boot fugu. Check that there are no linker-namespace
      related errors in the log.

Change-Id: I1593f4688bcde0121a5e24a707441a4935fa7dc4
2016-11-04 15:21:13 -07:00
Dimitry Ivanov 800083d229 Return nullptr from FindNamespaceByClassLoader for NB-enabled apps.
This function is always called by the frameworks in order to
initialize vulkan layer path. For NB apps returning nullptr
disables vulkan layer library lookup as expected.

Bug: http://b/32542970
Test: mm
Change-Id: I426b2b9f5ea7227b00f063ed6040f37bb2b4f21f
2016-11-01 14:48:45 -07:00
Zhenhua WANG f2804e5985 Upgrade native bridge to version 3 to support namespace
Native bridge implements namespace related interfaces in version 3.
The namespace semantic here is same as Android dynamic linker's.
Native loader wraps library loading functions of dynamic linker and
native bridge. Thus, Android runtime is able to load native library
of different ISA on one device by calling native loader directly.

Bug: http://b/28242460
Test: mm && make test-art-host -j48
Change-Id: Idde2b9d99fb6ebe547407c716b5478a231f745a7
Signed-off-by: Zhenhua WANG <zhenhua.wang@intel.com>
2016-10-25 11:11:38 -07:00
Elliott Hughes 36e0d390a2 Rely on the platform -std default.
Bug: http://b/32019064
Test: builds
Change-Id: I18a1d816d63b64601485045070851f32d44e85eb
2016-10-10 14:31:12 -07:00
Mark Salyzyn ff2dcd9af9 system/core Replace log/log.h with android/log.h
Should use android/log.h instead of log/log.h as a good example
to all others.  Adjust header order to comply with Android Coding
standards.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I33a8fb4e754d2dc4754d335660c450e0a67190fc
2016-09-30 12:47:05 -07:00
Colin Cross 627112a87e Merge \"libnativeloader: convert Android.mk to Android.bp\"
am: 5783dea065

Change-Id: I347c0822bbfcc351a36154391c4cd1bcaa3fc7c2
2016-07-28 10:53:40 +00:00
Colin Cross d4ce20aa84 libnativeloader: convert Android.mk to Android.bp
Change-Id: I94d7cde3138f28bbd158d62b657af8448b4175fd
2016-07-27 10:36:36 -07:00
Christopher Ferris 1b4f54e878 Merge \"Add support to indicate bitness of public library.\"
am: 3fb358478f

Change-Id: Ia5a7580cb26dbafa5863ae5d85aaaccb62936921
2016-06-22 19:37:31 +00:00
Christopher Ferris 39da84b06c 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
(cherry picked from commit 6664a805ca)

Change-Id: Id52c8b61d5c802ce62edda7e25f2755f6f93d6b7
2016-06-22 11:21:21 -07:00
Dan Willemsen 823d5bbc20 Merge "Remove invalid uses of -l and -I" am: 5d6193c658
am: 9ae3c079dc

* commit '9ae3c079dca647869dcbc5a5075609f0895e4f4c':
  Remove invalid uses of -l and -I

Change-Id: Id0ddd34cee10579684cdde36f3c095658a50784b
2016-06-01 21:57:27 +00:00
Dan Willemsen ee2da03e26 Remove invalid uses of -l and -I
LOCAL_LDLIBS should only be used with -l flags for NDK and some host
libraries. Other uses should use LOCAL_SHARED_LIBRARIES.

LOCAL_LDFLAGS should not contain -l entries, they should be in
LOCAL_LDLIBS instead.

LOCAL_CFLAGS should not contain -I entries, those should use
LOCAL_C_INCLUDES instead.

Change-Id: Ic901aa14651572ac682166becd4f0cd86baecc34
2016-06-01 13:41:23 -07:00
Dimitry Ivanov fcd4ee48a4 Merge "Remove target_sdk_version parameter" into nyc-dev
am: 07f46c84e6

* commit '07f46c84e614e2635e8072403dce8f17cc9285ba':
  Remove target_sdk_version parameter

Change-Id: Idf4bca526e7a40064518ad0e5ccc5aa1f63dbe75
2016-05-24 17:15:12 +00: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 e17c2efc4c Merge "Set parent namespace for linker-namespaces" am: ac50d0cc57
am: 3457aba394

* commit '3457aba39480e85d582dd6890c4c72e418958782':
  Set parent namespace for linker-namespaces

Change-Id: I20ea9239e95377894f477c33cf65bc7da7ad1e5a
2016-05-17 23:06:21 +00: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 d98683f415 Pass permitted_path to the linker as is.
am: 25df4bff44

* commit '25df4bff44a0d1a342dc45521bf7e860b3fef947':
  Pass permitted_path to the linker as is.

Change-Id: Idf8459267f8e1cc7bebc9a55b1272871b3d8119a
2016-05-17 04:06:05 +00:00
Dimitry Ivanov 24db75c1ce 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
2016-05-16 18:13:49 -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 b31caa95ec 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
2016-05-16 17:08:06 -07:00
Dimitry Ivanov 17decbd637 Merge "Move linker-namespace functions declarations" am: 37ed923d1c
am: 3f0a12622b

* commit '3f0a12622b8d35f1223945498a086e19c791bf24':
  Move linker-namespace functions declarations

Change-Id: I6f3e8b5ef608e3b930510b5c483ec6e7963eb4f7
2016-05-11 21:29:15 +00: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 37ed923d1c Merge "Move linker-namespace functions declarations" 2016-05-11 21:14:41 +00:00
Dimitry Ivanov d7cbb6f053 Merge "nativeloader: Ignore empty java_permitted_path" into nyc-dev
am: 6edd0c3a68

* commit '6edd0c3a68f60541c31fd65080e52939f2be3bc2':
  nativeloader: Ignore empty java_permitted_path

Change-Id: I1777b3a05d2e233000815172cfa1e56326be634b
2016-05-11 05:03:07 +00:00
Dimitry Ivanov 72ca40f738 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
(cherry picked from commit d0b1531929)
2016-05-10 22:02:05 -07:00
Dimitry Ivanov ddc6a4a0a6 Merge "Check if public namespace has already been initialized" am: 0756fae4f1
am: 5cd1e6822a

* commit '5cd1e6822abd016e5ee6e642528b39acaf15ae55':
  Check if public namespace has already been initialized

Change-Id: I13740764783765256af2fb1672fbfc5592147760
2016-05-11 01:30:32 +00:00
Dimitry Ivanov 0756fae4f1 Merge "Check if public namespace has already been initialized" 2016-05-11 01:23:20 +00: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 637da4eeeb 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
(cherry picked from commit f334cbf0e1)
2016-05-10 15:31:18 -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 80ddb8f551 Check if public namespace has already been initialized
There is no point in reading/loading the list of public
libraries once public namespace is already initialized.

Change-Id: I5a53c46bb57b8de241ba521a6321c12e94a76476
2016-05-09 18:12:00 -07:00
Dimitry Ivanov 6796522256 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
2016-05-09 18:09:06 -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 8a0425b86a 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
2016-05-09 10:55:50 -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 4ddabd01bf 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
2016-05-06 11:39:47 -07:00
Treehugger Robot ad717d6566 Merge "nativeloader: Add CloseNativeLibrary() method" 2016-05-04 23:38:55 +00:00
Dimitry Ivanov 7a1f9518f7 nativeloader: Add CloseNativeLibrary() method
This method is called by art on UnloadNativeLibraries()

Bug: http://b/28406866
Change-Id: Ibccff93c83d6ccd3d0a1c0294a64b09281b4e05e
(cherry picked from commit 09a516bf16)
2016-05-04 15:26:33 -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 911472da85 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
(cherry picked from commit be4ca3afc0)
2016-05-02 13:35:32 -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
Dimitry Ivanov 7e8cee8fb2 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
2016-04-21 16:42:48 -07:00
Dimitry Ivanov 213676b880 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
2016-04-21 11:35:57 -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 617f495cf7 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
2016-04-06 18:24:08 -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