greylist is needed only for application namepaces. Since we started using
linker-namesapces for vendors and other platform apps linker should not
enable greylist workaround by default.
Bug: http://b/37731053
Bug: https://issuetracker.google.com/38146125
Test: sailfish builds and boots
Test: bionic-unit-tests and linker-unit-tests pass
Change-Id: Iee83db6fb1ae754f5ade18491321d9bca3b5ead4
This library is used by a number of different libraries in the system.
Make it easy for platform libraries to use this library and create
an actual exported include file.
Change the names of the functions to reflect the new name of the library.
Run clang_format on the async_safe_log.cpp file since the formatting is
all over the place.
Bug: 31919199
Test: Compiled for angler/bullhead, and booted.
Test: Ran bionic unit tests.
Test: Ran the malloc debug tests.
Change-Id: I8071bf690c17b0ea3bc8dc5749cdd5b6ad58478a
Make shared namespace inherit namespace links and
search/permitted paths from the parent namespace.
Bug: http://b/37854032
Test: bionic_unit_tests --gtest_filter=dl*:Dl*
Change-Id: I174661d4a1dd0cbe4a378179073719aa955f3592
(cherry picked from commit ec43dd6c36)
Make shared namespace inherit namespace links and
search/permitted paths from the parent namespace.
Bug: http://b/37854032
Test: bionic_unit_tests --gtest_filter=dl*:Dl*
Change-Id: I174661d4a1dd0cbe4a378179073719aa955f3592
Depending on how ld.config.txt is configured, there can be multiple
built-in namespaces created by the linker from the beginning of a
process. android_get_exported_namespace is a platform only API for
getting a handle (android_namespace_t*) to one of the built-in namespaces
with given name. The returned namespace can then be given to
android_dlopen_ext in order to explicitly specify the target namespace
where the library is searched and loaded from.
Note that this function only returns 'exported' namespaces created via
ld.config.txt file. In order to export a namespace, the visible property
should be set to true:
namespace.<name>.visible = true
Namespaces are hidden by default. Hidden namespaces and namespaces
that are created programmatically, notably 'classloader-namespace',
aren't returned by this function.
Bug: 36851137
Test: confirmed that namespaces created with ld.config.txt is retrieved.
Test: linker-unit-tests passes
Merged-in: I714b510fa24f77e42c3dfc4c827b3befa8bb2951
Change-Id: I0d05fa7e0e116009edf8ea362ab46774bc617cbf
(cherry picked from commit d7c4832e6a)
This reverts commit 6d59318d78.
Bug: http://b/37245203
Bug: http://b/37590327
Test: bionic-unit-tests on angler and marlin
Test: boot an angler and make sure mediacodec does not crash
This change adds two tests for dlopen from temporary files.
1. One Uses memfd_create() can be used to load libraries directly
from memory. This requires relaxing namespace accessibility check
in order to make this work in isolated namespaces.
2. Another checks that open with O_TMPFILE works.
Bug: http://b/37245203
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: I3be1d7198ca17e7f1ba022a0d86c64d59a493506
(cherry picked from commit bb8b22a087)
This change adds two tests for dlopen from temporary files.
1. One Uses memfd_create() can be used to load libraries directly
from memory. This requires relaxing namespace accessibility check
in order to make this work in isolated namespaces.
2. Another checks that open with O_TMPFILE works.
Bug: http://b/37245203
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: I3be1d7198ca17e7f1ba022a0d86c64d59a493506
It's been years since we allowed text relocations, but I had a developer
ask me how to fix them at last week's O Developer Day. They'd never seen
our docs, so let's try to fix that for anyone else who's still confused...
Bug: N/A
Test: builds
Change-Id: I9202a7b0a3f024041b646c43c87585f4fab22d09
Depending on how ld.config.txt is configured, there can be multiple
built-in namespaces created by the linker from the beginning of a
process. android_get_exported_namespace is a platform only API for
getting a handle (android_namespace_t*) to one of the built-in namespaces
with given name. The returned namespace can then be given to
android_dlopen_ext in order to explicitly specify the target namespace
where the library is searched and loaded from.
Note that this function only returns 'exported' namespaces created via
ld.config.txt file. In order to export a namespace, the visible property
should be set to true:
namespace.<name>.visible = true
Namespaces are hidden by default. Hidden namespaces and namespaces
that are created programmatically, notably 'classloader-namespace',
aren't returned by this function.
Bug: 36851137
Test: confirmed that namespaces created with ld.config.txt is retrieved.
Test: linker-unit-tests passes
Change-Id: I0d05fa7e0e116009edf8ea362ab46774bc617cbf
Useful for testing whether apps have actually stopped using greylisted
libraries even if they still have references to them in their apk to support
old Android releases but also haven't bumped their targetSdkVersion yet.
Since we already have two expensive __system_property_get calls and this
would add a third, optimize two (but leave the third since it's not
obviously amenable to optimization). None of this matters for user builds,
but I don't want userdebug/eng to have distractingly different performance.
(cherrypick of 7933bec2872aa1c3430149c7649726333c0ac9d8.)
Bug: http://b/36106661
Test: ran "can you escape 5" with and without this property
Change-Id: Id9a804695c1dca9b4be2ebd0e72f01817bb13cba
Useful for testing whether apps have actually stopped using greylisted
libraries even if they still have references to them in their apk to support
old Android releases but also haven't bumped their targetSdkVersion yet.
Since we already have two expensive __system_property_get calls and this
would add a third, optimize two (but leave the third since it's not
obviously amenable to optimization). None of this matters for user builds,
but I don't want userdebug/eng to have distractingly different performance.
Bug: http://b/36106661
Test: ran "can you escape 5" with and without this property
Change-Id: Id9a804695c1dca9b4be2ebd0e72f01817bb13cba
This CL changes the linker to point to the newly refactored location
of ASAN-ified libraries on disk.
This supports changes made by the following CLs -
https://android-review.googlesource.com/#/c/359087/https://android-review.googlesource.com/#/c/359389/
Which refactor the on-disk location as follows:
/data/lib* --> /data/asan/system/lib*
/data/vendor/* --> /data/asan/vendor/*
There are a couple of advantages to this, including better isolation
from other components, and more transparent linker renaming and
SELinux policies.
(cherry picked from commit 4113def4fa)
Bug: 36574794
Bug: 36674745
Test: m -j40 && SANITIZE_TARGET="address" m -j40 and the device
boots. All sanitized libraries are correctly located in /data/asan/*.
Change-Id: Iad8b298a66c38eb0f6327f6b51027f0728aa7a40
This CL changes the linker to point to the newly refactored location
of ASAN-ified libraries on disk.
This supports changes made by the following CLs -
https://android-review.googlesource.com/#/c/359087/https://android-review.googlesource.com/#/c/359389/
Which refactor the on-disk location as follows:
/data/lib* --> /data/asan/system/lib*
/data/vendor/* --> /data/asan/vendor/*
There are a couple of advantages to this, including better isolation
from other components, and more transparent linker renaming and
SELinux policies.
Bug: 36574794
Bug: 36674745
Test: m -j40 && SANITIZE_TARGET="address" m -j40 and the device
boots. All sanitized libraries are correctly located in /data/asan/*.
Change-Id: Iad8b298a66c38eb0f6327f6b51027f0728aa7a40
This addresses outstanding todo for anonymous namespace
and fixes an app compatibility bug.
Bug: http://b/36008422
Test: start app from http://b/36008422 and make sure it runs
Change-Id: Ie148418b944379ee1000e7274f2f6c1eca511d6c
This change allows customization of default namespace
configuration for different executables. It also enables
target_sdk_version setup for binaries (note that this
option should explicitly be enabled in ld.config.txt).
Bug: http://b/30706810
Bug: http://b/30435785
Test: run linker-unit-tests/bionic-unit-tests, boot angler
Change-Id: Ibbe87209acf1538fc9cec04944f3d22a190c38f1
This reverts commit 1daa18e737.
To be replaced with customized linker-namespaces for different kind of binaries.
Bug: http://b/34407260
Change-Id: Ib4e480669bbdf44ee4f59bf05f07d3e082c348c9
Test: m
Specifically, this change would translate /system/lib/hw/foo.so to /data/lib/hw/foo.so.
Bug: 30320104
Test: in SANITIZE_TARGET=address build, /proc/$PID/maps for
system_server show libraries from /data/lib64/hw and not from
/system/lib64/hw.
Change-Id: Ia1fa22fa1ca088fe76e41308762efe037541fc74
Due to b/33681361, libraries are now installed to different paths than
before. In order for linker to load libraries from the new paths, the
default lib paths are updated.
However, this patch is temporary; different paths must be used depending
on whether the process is executing vendor executable or framework
executable. For example, vendor executable should not be able to access
/system/lib/, which is for framework-internal libs. Similarly,
framework executables should not be able to access /vendor/lib.
We have several solutions (linker namespace and DT_RUNPATH) to support
the scenario, but haven't concluded which is better. Furthermore, if we
restrict the search path right now, it will break many parts of Android
that are not yet prepared for the restriction. So, until then, we
temporarily use the single search path for both framework/vendor
executables.
Test: build & run
Change-Id: I806e9b4379bce96653b1dd3354b9f4801abb0411
Anonymous namesapce is zygote-specific workaround and
is not really required for other binaries.
This change allows creating namespaces without initializing
anonymous namespace.
Test: bionic-unit-tests
Change-Id: I62adc39ad69ce56b3760d36f45e3c0487c438598
Do not load second copy of libraries that are supposed to
be provided by linked namespaces. Also do not print
error in the log if caller tries to open shared library
using absolute path for apps targeting N+.
Bug: http://b/35454141
Bug: http://b/26833548
Bug: http://b/35338922
Test: run bionic-unit-tests --gtest_filter=dl*
Change-Id: Icf3aeedff18d287d2ba0b3df3808b100f3ef5f7a
In the case when there are multiple dependencies on
the same library in the local_group the unload may
in some situations (covered now by tests) result
calling d-tors for some libraries prematurely.
In order to have correct call order loader checks if this
is last dependency in local group before adding it to BFS
queue.
Bug: http://b/35201832
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Test: bionic-unit-tests-glibc --gtest_filter=dl*
Change-Id: I4c6955b9032acc7147a51d9f09b61d9e0818700c
This commit updates interface of libdl.c.
1. android_init_namespaces is replaces with android_init_anonymous_namespace
2. added 2 arguments to android_create_namespace to specify linked namespace
and the list of shared libraries sonames.
3. symbol lookup does not get past boundary libraries (added check and test for it).
Bug: http://b/26833548
Bug: http://b/21879602
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: I32921da487a02e5bd0d2fc528904d1228394bfb9
Replace public library list with shared lib sonames
which are property of a link between namespaces
This change does not touch any external interfaces
so from outside it behaves almost as it was before
One significant difference is that there is no longer
need to preload public libraries.
Bug: http://b/26833548
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: I57e44e18a9b4f07dcd6556436346be52f52b79d7
This workaround was introduced in M in order to make sure
that linker loads libraries provided in apk in case a library
with the same name was loaded by the system.
This is no longer a problem starting with Android N because
app is using different namespace and therefore does not see
libraries loaded by the system.
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: I9995258c0f361e8df35420682b84e85a0cb924b4
Add dlsym option to debug.ld.all and debug.ld.app.<appname> which
enables logging of dlsym calls.
Bug: http://b/29458203
Test: flash, set debug.ld.all to dlsym and check
if there are messages in logcat
Change-Id: I9cb815a38b5b98aac9ebe3ac1540bcdedd2e8db0
Do not hijack libdl.so methods but make libdl proxy calls to
loader instead. This will be replaces by calls to libc.so
once loader functionality is migrated.
Also add a lock to dl_unwind_find_exidx function call.
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Bug: http://b/27106625
Change-Id: Ic33a7109a86f4262798d63a35f4c61d15b0068bb
Bionic Loader now resolves real path for a library before running
asan path-translation. This fixes situations for bundled loading
libraries which are effectively symlinks to system library;
for example:
$ adb shell ls -l /system/app/NfcNci/lib/arm64/libnfc_nci_jni.so
/system/app/NfcNci/lib/arm64/libnfc_nci_jni.so -> /system/lib64/libnfc_nci_jni.so
Bug: http://b/33278445
Test: make and boot
Change-Id: If14a12087c92f8ca628504556332ba0cb67c9118
Android N restrict which libraries C/C++ code
can link against at runtime.
If device has a vendor partition
then /system/vendor symlink to /vendor.
Otherwise /vendor symlink to /system/vendor.
But is_system_library() is only checking /vendor/lib.
It will return false for /system/vendor/lib path.
It is need to add a real path to default library path.
Similarily, default ld library path is already checking.
parse_LD_LIBRARY_PATH()->parse_path()->resolve_paths()
Test: build bionic and run bionic-unit-tests
Bug: http://b/31919547
Change-Id: Ie6777e2b02729948ce77a94de32343d40358bf2c
Signed-off-by: Hyangseok Chae <neo.chae@lge.com>
(cherry picked from commit 2589f9de64)
Android N restrict which libraries C/C++ code
can link against at runtime.
If device has a vendor partition
then /system/vendor symlink to /vendor.
Otherwise /vendor symlink to /system/vendor.
But is_system_library() is only checking /vendor/lib.
It will return false for /system/vendor/lib path.
It is need to add a real path to default library path.
Similarily, default ld library path is already checking.
parse_LD_LIBRARY_PATH()->parse_path()->resolve_paths()
Test: build bionic and run bionic-unit-tests
Bug: http://b/31919547
Change-Id: Ie6777e2b02729948ce77a94de32343d40358bf2c
Signed-off-by: Hyangseok Chae <neo.chae@lge.com>
Extract linker executable specific code to linker_main.cpp;
this part of code does not have a place in libdl.a/so.
Bug: http://b/14998480
Bug: http://b/30706810
Test: mm && run bionic-unit-tests
Change-Id: I90f7475e93a919b0f9525da22928089ad35b8f6c
The absolute path to an executable may no longer be valid for
example when the file is unlinked immediately after exec.
Using /proc/self/exe instead of absolute path solves this problem.
Bug: http://b/31084669
Test: Run the app from http://b/31084669 make sure executable starts
Test: by checking ps and /proc/<pid>/exe
Change-Id: I5c819f39ef0fc4fc71b05de71e8af9ede611f04c
(cherry picked from commit 7da4bbbe87)
The absolute path to an executable may no longer be valid for
example when the file is unlinked immediately after exec.
Using /proc/self/exe instead of absolute path solves this problem.
Bug: http://b/31084669
Test: Run the app from http://b/31084669 make sure executable starts
Test: by checking ps and /proc/<pid>/exe
Change-Id: I5c819f39ef0fc4fc71b05de71e8af9ede611f04c
(cherry picked from commit 7da4bbbe87)
The absolute path to an executable may no longer be valid for
example when the file is unlinked immediately after exec.
Using /proc/self/exe instead of absolute path solves this problem.
Bug: http://b/31084669
Test: Run the app from http://b/31084669 make sure executable starts
Test: by checking ps and /proc/<pid>/exe
Change-Id: I5c819f39ef0fc4fc71b05de71e8af9ede611f04c
open(2) can be used to open directories; use stat to
check that the file exists and is a regular file.
Addresses review comments for 5aa67675f8
Bug: http://b/30320104
Change-Id: Ia944db2f2f779a87ea01dd41dcd171e59c9bef01
This patch enables absolute path translation to instrumented library
when linker_asan is in use.
Test: adb shell cat /proc/<rlid pid>/maps | grep libril-qc-qmi-1.so
check that it is mapped from /data/vendor/lib64 and not /vendor/lib64
Bug: http://b/30320104
Change-Id: I3bc24754b192afc0a72d6f3801f7b42141ce715b
(cherry picked from commit 5aa67675f8)
This patch enables absolute path translation to instrumented library
when linker_asan is in use.
Test: adb shell cat /proc/<rlid pid>/maps | grep libril-qc-qmi-1.so
check that it is mapped from /data/vendor/lib64 and not /vendor/lib64
Bug: http://b/30320104
Change-Id: I3bc24754b192afc0a72d6f3801f7b42141ce715b
Move soinfo and globals out of linker.cpp to
separate files.
Breaking up huge linker.cpp into smaller peaces
in order to make it easier to extract part of the
code that belongs to libdl.so and remove parts of
the code that do not belong to linker
(refactoring part 2 of many)
Change-Id: I868417f4b8d2b84d0e8265e354bc7977161497e2
Breaking up huge linker.cpp into smaller peaces
in order to make it easier to extract part of the
code that belongs to libdl.so and remove parts of
the code that do not belong to linker
(refactoring part 1 of many)
Change-Id: I57ac36677a815800dc127c8c45c3ea806c37e247
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
This change includes dlwarning implementation and
the compatibility greylist for apps targeting pre-N.
Change-Id: Ibf02a07cc58cbbb1a5aef4ac34558c5d43e4305f
Test: Run bionic-unit-tests --gtest_filter=dl*:Dl*
The glibc implementation of the loader passes argc/argv/envp
to all elf constructors. This change makes bionic linker
behave in the same way.
Bug: http://b/30145768
Change-Id: I1c65c42aa5305a5b133c64b5748205bbde869e0e
Test: run bionic-unit-tests --gtest_filter=dl*:Dl*
This patch lets developers tune logging of dlopen/dlerror with
setting system property.
Note that for security purposes this option is disabled on user build
for non-debuggable apps.
For starters there are 3 debug options:
dlerror - enables logging of all dlerrors
dlopen - traces dlopen calls
To enable system-wide logging (works only for userdebug/eng builds)
use debug.ld.all property.
To enable logging for particular app use debug.ld.app.<appname> property.
Example: Running "adb shell setprop debug.ld.all dlerror,dlopen" will log all
dlerror message as well as trace all calls to dlopen.
Bug: http://b/29458203
Change-Id: I2392c80a795509e16fe5689d0500d18b99772a64
If a public library is missing, make it clear that there is no
library with that soname that is missing. This can help diagnose
problems if a library exists, but the library doesn't have the right
soname.
Bug: 29400363
(cherry picked from commit 9a84d90c75)
Change-Id: Ie2306a2e28aff779d07441dc8af078256b184f8a
If a public library is missing, make it clear that there is no
library with that soname that is missing. This can help diagnose
problems if a library exists, but the library doesn't have the right
soname.
Bug: 29400363
Change-Id: I6e782c76ef892fb18385d720b531e5177598a2b0
Also add warning about removing access to greylisted libs
in the future Android releases.
Bug: http://b/26427993
Change-Id: I1aaa94e3bde09ab0f6594e9170d479cdb3e77d42
create_namespace resolves caller namespace only
when caller did not explicitly specify parent namespace.
This saves about 25 microseconds for the case when
parent_namepsace is not null (for example when creating
second classloader for the app).
Bug: http://b/28801010
Change-Id: I50ded272c931db701e5a1d8c88ed5ffb13416539
(cherry picked from commit 5240863ed5)
create_namespace resolves caller namespace only
when caller did not explicitly specify parent namespace.
This saves about 25 microseconds for the case when
parent_namepsace is not null (for example when creating
second classloader for the app).
Bug: http://b/28801010
Change-Id: I50ded272c931db701e5a1d8c88ed5ffb13416539
This operation is the most expensive one and since it is
unlikely that the zip-entry name is invalid (given that it
is constructed by the platform) - it can removed.
The worst case scenario is dlopen() of non-existing libraries
taking more time. And this use-case is not on the critical path.
Bug: http://b/28801010
Change-Id: I10a6b0bf342404ab72f0f5102ebf19f6c06ee6bf
(cherry picked from commit a5c1c8e820)
This operation is the most expensive one and since it is
unlikely that the zip-entry name is invalid (given that it
is constructed by the platform) - it can removed.
The worst case scenario is dlopen() of non-existing libraries
taking more time. And this use-case is not on the critical path.
Bug: http://b/28801010
Change-Id: I10a6b0bf342404ab72f0f5102ebf19f6c06ee6bf
This change enables apps to share libraries opened
with RTLD_GLOBAL between different classloader namespaces.
The new parameter to create_namespace allows native_loader
to instruct the linker to share libraries belonging to
global group from a specified namespace instead of
using the caller_ns.
Bug: http://b/28560538
Bug: https://code.google.com/p/android/issues/detail?id=208458
Change-Id: I5d0c62730bbed19cdeb16c7559c74aa262a2475f
(cherry picked from commit fc2da53440)
This CL adds initialization of inode for the main executable
which enables linker to resolve the correct soinfo when
application calls dlopen with absolute path to the
main executable.
Bug: http://b/28420266
Change-Id: I102e07bde454bd44c6e46075e3faeeb5092830d8
(cherry picked from commit 2ba1cf39ae)
This CL adds initialization of inode for the main executable
which enables linker to resolve the correct soinfo when
application calls dlopen with absolute path to the
main executable.
Bug: http://b/28420266
Change-Id: I102e07bde454bd44c6e46075e3faeeb5092830d8
This change enables apps to share libraries opened
with RTLD_GLOBAL between different classloader namespaces.
The new parameter to create_namespace allows native_loader
to instruct the linker to share libraries belonging to
global group from a specified namespace instead of
using the caller_ns.
Bug: http://b/28560538
Bug: https://code.google.com/p/android/issues/detail?id=208458
Change-Id: I5d0c62730bbed19cdeb16c7559c74aa262a2475f
Linker crashed if linking of the main executable fails
instead of aborting with readable error message.
This patch modifies unload to soinfo_unload it all at once
in this particular case. This helps avoid situations when
one of the libraries on the DT_NEEDED list of main executable
has gotten unloaded by previous library unload because it
DT_NEEDED it too.
Example (consider following dependency tree):
main_executable
|-> liba.so
|-> libb.so
|-> libb.so
The list of the libraries need to be unloaded in this case
is [liba.so, libb.so], but if linker does unload one by one
by the time it gets to libb.so - the soinfo for the library
is already unloaded (and the segments were unmapped).
Passing everything as an array helps soinfo_unload to check
if a library was already unloaded by looking into local_unload_list.
Bug: http://b/28565608
Change-Id: I7199290e10a186057dcf3b7b68dbce954af7dba1
(cherry picked from commit 83fcb54208)
Linker crashed if linking of the main executable fails
instead of aborting with readable error message.
This patch modifies unload to soinfo_unload it all at once
in this particular case. This helps avoid situations when
one of the libraries on the DT_NEEDED list of main executable
has gotten unloaded by previous library unload because it
DT_NEEDED it too.
Example (consider following dependency tree):
main_executable
|-> liba.so
|-> libb.so
|-> libb.so
The list of the libraries need to be unloaded in this case
is [liba.so, libb.so], but if linker does unload one by one
by the time it gets to libb.so - the soinfo for the library
is already unloaded (and the segments were unmapped).
Passing everything as an array helps soinfo_unload to check
if a library was already unloaded by looking into local_unload_list.
Bug: http://b/28565608
Change-Id: I7199290e10a186057dcf3b7b68dbce954af7dba1
linker didn't remove link to the soinfo from shared
namespaces on soinfo_unload, because it didn't keep
record of all namespaces the library is added to.
This change adds test for this and also fixes the
problem by introducing list of secondary namespaces
to soinfo, which is used to remove soinfo in
soinfo::remove_all_links().
Bug: http://b/28115950
Change-Id: Ifbf6e54f92fa6e88f86b6a8dd6dc22d4553afd22
(cherry picked from commit aca299ac47)
linker didn't remove link to the soinfo from shared
namespaces on soinfo_unload, because it didn't keep
record of all namespaces the library is added to.
This change adds test for this and also fixes the
problem by introducing list of secondary namespaces
to soinfo, which is used to remove soinfo in
soinfo::remove_all_links().
Bug: http://b/28115950
Change-Id: Ifbf6e54f92fa6e88f86b6a8dd6dc22d4553afd22
linker doesn't call d-tors for RTLD_NODELETE libraries. There is
no need in reseting this flag in call_destructors (which is called
from soinfo_unload).
Change-Id: I3ed03fa7207b7acf598067276fbb8874e29b5e53
Linker was not unloading libraries marked with RTLD_NODELETE
even when there was a error on load. For example when one of
dt_needed libraries was not found.
Bug: http://b/27911891
Change-Id: Ibc0bf110aa41fbfdc9f327ad8c364f2e3600af71
(cherry picked from commit 79abce4214)
Linker was not unloading libraries marked with RTLD_NODELETE
even when there was a error on load. For example when one of
dt_needed libraries was not found.
Bug: http://b/27911891
Change-Id: Ibc0bf110aa41fbfdc9f327ad8c364f2e3600af71
Using single quotes can be more convenient -- because there's no need to
escape -- but the vast majority of existing quoting was done with double
quotes, so move in that direction.
Bug: http://b/27524191
Change-Id: I8f58593120e4c8aeaec45e16fc0178e9c162454d
This patch uses __kernel_vsyscall instead of "int 0x80"
as the syscall entry point. AT_SYSINFO points to
an adapter to mask the arch specific difference and gives a
performance boost on i386 architecture.
Bug: http://b/27533895
Change-ID: Ib340c604d02c6c25714a95793737e3cfdc3fc5d7
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
(cherry picked from commit be91052932)
Handle no longer is a pointer to soinfo of
a corresponding library. This is done to
prevent access to linker internal fields.
Bug: http://b/25593965
Change-Id: I62bff0d0e5b2dc842e6bf0babb30fcc4c000be24
(cherry picked from commit d88e1f3501)
Error messages now include executable name,
also linker doesn't abort if called on itself.
Bug: http://b/27533895
Change-Id: Ia17dd540919544b28062ed71751a1d79ee865206
(cherry picked from commit 9f0a6954c6)
Move gdb support functions and variables to
linker_gdb_support.h/cpp
Bug: http://b/27533895
Change-Id: I96c6592a7055715b18f1137367470fe80987263f
(cherry picked from commit 6b788eeff2)
Use insert_link_map_into_debug_map to insert the main
executable's link_map to r_debug
Bug: http://b/27533895
Change-Id: I0eacb3f030ea3eb16ed50ad2011d604beece2d03
(cherry picked from commit f3064e4bc7)
Remove unnecessary construction of soinfo when
initializing linker link_map for gdb.
Bug: http://b/27533895
Change-Id: Idf32cee56309aa9c9cf260efbd17a9deae9a756b
(cherry picked from commit 8d22dd53fe)
Handle no longer is a pointer to soinfo of
a corresponding library. This is done to
prevent access to linker internal fields.
Bug: http://b/25593965
Change-Id: I62bff0d0e5b2dc842e6bf0babb30fcc4c000be24
This patch uses __kernel_vsyscall instead of "int 0x80"
as the syscall entry point. AT_SYSINFO points to
an adapter to mask the arch specific difference and gives a
performance boost on i386 architecture.
Change-ID: Ib340c604d02c6c25714a95793737e3cfdc3fc5d7
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
Print properties of the namespace on "library is not accessible"
error to better diagnose problems with native library accessiblity
Bug: http://b/27406143
Change-Id: Icf3d6c604f09dfa015de863fdb1267d343930d2a
(cherry picked from commit 350bdad61c)
Print properties of the namespace on "library is not accessible"
error to better diagnose problems with native library accessiblity
Bug: http://b/27406143
Change-Id: Icf3d6c604f09dfa015de863fdb1267d343930d2a
This is temporary method intended to use
for a toast message on preview and beta
releases. Will be removed before the
production release.
Bug: http://b/27365747
Change-Id: I39cc716bb82863ae761b6821bcec77cce6db3781
This field is used only once and only for main executable;
no need to carry it around in soinfo structure.
Change-Id: I7f80c64e0939e28966b6fed858891f9ce2a9e26b
Some apps are explicitly calling System.loadLibrary(.)
for internal platform libraries like cutils.
Bug: http://b/27100558
Change-Id: I765cf3fc542778d3b487069c9955d367840b3c05
Look into "/system/lib" before "/vendor/lib", this way
we can ensure that in case of name conflict /system libraries
take precedence.
Change-Id: Ifacdc9dc7a4e175853f499ed09782b2257f09e5a
Check if needed_by is nullptr in the grey-list warning
also print the name of the library making call to dlopen()
Bug: http://b/26749878
Change-Id: I4e16223a3e3d8d1539f855a0b3f199c5529027e0
The greylisting mechanism had a bug that allowed
loading any library using absolute path from java code.
It mistakenly assumed they are needed by greylisted
system library when in fact it is dlopen() call from
libnativeloader.
This patch fixes this problem by checking that the library is in
fact dt_needed and it is not a dlopen call.
Bug: http://b/26394120
Bug: http://b/22548808
Change-Id: Ia3d4c19e77b04d09a6c3047d684d0c04bd5c785e
dlclose used to unmap the part of the reserved region
for ANDROID_DLEXT_RESERVED_ADDRESS that was neccessary
to map PT_LOAD segments. With this change dlclose
replaces mapped PT_LOAD segments with a PROT_NONE,
MAP_ANONYMOUS | MAP_NORESERVE.
Previously caller was unmapping the reserved region after
the failed dlclose which led to race condition when someone
else reused the region freed by dlclose but before the unmap
by the chromium code.
Bug: http://code.google.com/p/chromium/issues/detail?id=568880
Change-Id: I0f5eaa2bf6641f83dde469b631c518482acc59a2
This change is workaround for the http://b/26394120
greylisting the libraries used by some popular apps
to keep them working on dogfood builds. It will
be removed before the release.
Bug: http://b/26394120
Change-Id: I4e588b81da59f6f667aa9d2ef7e715d6607b9a36
Exactly which functions get a stack protector is up to the compiler, so
let's separate the code that sets up the environment stack protection
requires and explicitly build it with -fno-stack-protector.
Bug: http://b/26276517
Change-Id: I8719e23ead1f1e81715c32c1335da868f68369b5
Also, we're not a debugger.
Also include LD_LIBRARY_PATH and LD_PRELOAD because they would have helped
diagnose a recent issue.
Change-Id: I7237a7236b7140ab49483c02efa705317d07bd3f
Shared namespaces clone the list of loaded native
libraries from the caller namespace. This allows
classloaders for bundled apps to share already loaded
libraries with default namespace.
Bug: http://b/22548808
Bug: http://b/26165097
Change-Id: I8949d45937fdb38e1f586ff0679003adac0d9dad
(cherry picked from commit e78deef364)
The permitted_when_isolated_path is a way to white-list
directories not present in search-path. It is ignored for
not isolated namespaces.
Bug: http://b/25853516
Bug: http://b/22548808
Change-Id: Ib1538037268eea69323ea49968a34a4a1d1938a5