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
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 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
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)
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)
This field is used only once and only for main executable;
no need to carry it around in soinfo structure.
Change-Id: I7f80c64e0939e28966b6fed858891f9ce2a9e26b
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
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
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
dlopen on isolated namespaces should be able to open
public libraries using absolute path not only soname.
Bug: http://b/25853820
Change-Id: If574a67853dc51226f0f376e9e2d108316002f84
The anonymous namespace is introduced to
handle cases when linker can not find the
caller. This usually happens when caller
code was not loaded by dynamic linker;
for example mono-generated code.
Bug: http://b/25844435
Bug: http://b/22548808
Change-Id: I9e5b1d23c1c75bc78548d68e79216a6a943a33cf