summaryrefslogtreecommitdiff
path: root/linker/linker.cpp
AgeCommit message (Collapse)Author
2016-02-17Merge "Update a comment for init_linker_info_for_gdb"Dimitry Ivanov
2016-02-17Update a comment for init_linker_info_for_gdbDimitry Ivanov
Change-Id: I8e2895ecfcc6f77a180c3735342afc93be5923d3
2016-02-16Initialize linker link_map for gdb directlyDimitry Ivanov
Remove unnecessary construction of soinfo when initializing linker link_map for gdb. Change-Id: Idf32cee56309aa9c9cf260efbd17a9deae9a756b
2016-02-16linker: remove soinfo::entryDimitry Ivanov
This field is used only once and only for main executable; no need to carry it around in soinfo structure. Change-Id: I7f80c64e0939e28966b6fed858891f9ce2a9e26b
2016-02-12Fix is_greylisted check in case of an absolute pathDimitry Ivanov
Some apps are explicitly calling System.loadLibrary(.) for internal platform libraries like cutils. Bug: http://b/27100558 Change-Id: I765cf3fc542778d3b487069c9955d367840b3c05
2016-02-03Merge "linker: Change the library search order" am: c92ffa95fcDimitry Ivanov
am: 10e4fd56b5 * commit '10e4fd56b5e86ca1a9a6bbcb4b62f6f4592bf508': linker: Change the library search order
2016-02-01linker: Change the library search orderDimitry Ivanov
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
2016-02-01linker: check if needed_by is nullptrDimitry Ivanov
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
2016-01-28Do not allow System.load() of external librariesDimitry Ivanov
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
2016-01-25Add libskia.so to the grey-list.Dimitry Ivanov
Bug: http://b/26768182 Change-Id: I3a624861f38a3b40902f44ab728d5e9e64a74f7e
2016-01-21Merge "Do not unmap reserved region on dlclose" am: 3e3b992469Dimitry Ivanov
am: 7a55637013 * commit '7a55637013741f53f12a6ce81b80662d0a9c8a68': Do not unmap reserved region on dlclose
2016-01-20Do not unmap reserved region on dlcloseDimitry Ivanov
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
2016-01-12Greylist libui.soDimitry Ivanov
Bug: http://b/26494034 Bug: http://b/26394120 Change-Id: Ie857b753061ff31aee1fafc4919cc8faed5e3f5d
2016-01-12Add the name of needed_by library to the warningDimitry Ivanov
Bug: http://b/26394120 Change-Id: I8dbf1d0d879e967563ad3158ee3c0e4284dfa533
2016-01-11Limit greylisting to apps targeting sdk version<=23Dimitry Ivanov
Bug: http://b/26394120 Change-Id: Ida7afd944cebca7170591e4181a9d5941ea2e422
2016-01-08Merge "Defend against -fstack-protector in libc startup." am: 195b85a80fElliott Hughes
am: 6e499bc37d * commit '6e499bc37d9caa8c914a8f83345bc2b2d8ae8132': Defend against -fstack-protector in libc startup.
2016-01-07Refine greylist to exclude transitively DT_NEEDED librariesDimitry Ivanov
Bug: http://b/26394120 Change-Id: I6d63ed3ea11811c08846c19d7ca74e80e3848f3e
2016-01-07Greylist some of internal native librariesDimitry Ivanov
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
2016-01-06Defend against -fstack-protector in libc startup.Elliott Hughes
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
2016-01-05Clarify which linker we are.Elliott Hughes
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
2015-12-19linker: implement shared namespacesDimitry Ivanov
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 e78deef364d952dd1141a2f3067a12060aaf11e6)
2015-12-16linker: add dlvsym(3)Dimitry Ivanov
This changes implements dlvsym - dlsym for versioned symbols. Bug: http://b/22865643 Change-Id: Ic90a60d512104261a1416c43f9100f0d88e3b46f
2015-12-11Merge "Move dlsym and dladdr implementation to linker.cpp"Dimitry Ivanov
2015-12-10Move dlsym and dladdr implementation to linker.cppDimitry Ivanov
Bug: http://b/25716705 Bug: http://b/22865643 Change-Id: If22fc1eda219f676b5fcc06490f7901d21d1749c
2015-12-10Merge "Revert "Add /odm/lib to shared lib search path""Dimitry Ivanov
2015-12-10Merge "Add permitted_when_isolated_path to linker namespaces"Dimitry Ivanov
2015-12-09Add permitted_when_isolated_path to linker namespacesDimitry Ivanov
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
2015-12-09Merge "Revert "Ensure that readlink has access to /proc/self/fd""Dimitry Ivanov
2015-12-09Revert "Ensure that readlink has access to /proc/self/fd"Dimitry Ivanov
This reverts commit 4e50d0247b9ace095e371865fad08b1a59672e3a. Bug: http://b/24912743 Change-Id: I5d32c670f0e16aec9c74add143158e919a301673
2015-12-09Revert "Add /odm/lib to shared lib search path"Dimitry Ivanov
This reverts commit f74b041cce75091b922151d4fa57e63c8a6caf4b. Bug: 25654402 Change-Id: I77386ea3655868d7cd1a8130afbc95e70549389e
2015-12-05Merge "Allow dlopening public libs using absolute path"Dimitry Ivanov
2015-12-04Allow dlopening public libs using absolute pathDimitry Ivanov
dlopen on isolated namespaces should be able to open public libraries using absolute path not only soname. Bug: http://b/25853820 Change-Id: If574a67853dc51226f0f376e9e2d108316002f84
2015-12-04Track rename from base/ to android-base/.Elliott Hughes
Change-Id: I0a4592945400b1fa6892bf7c1fa8659fd711efa3
2015-11-23Introduce anonymous namespaceDmitriy Ivanov
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
2015-11-19Merge "Add /odm/lib to shared lib search path"Hung-ying Tyan
2015-11-19Merge "Do not depend on host bits to get the right size to write."Junichi Uekawa
2015-11-19Do not depend on host bits to get the right size to write.Junichi Uekawa
x86_64 32-bit or 64-bit relocations do not depend on ELF bit size, they are 32-bit or 64-bit respectively. Known compiler that emits such code is nacl-clang which emits R_X86_64_PC32 which should write 32 bits but ended up writing 64 bits. Change-Id: Ibb6b484c0fea6a7e291362148e8ac749d6674529
2015-11-18Add /odm/lib to shared lib search pathHung-ying Tyan
ODM's shared libs should live in /odm/lib on the ODM partition. BUG: 25654402 Change-Id: I3f5c26f208af87ff2817e490e51d0b4f5b8ec98e
2015-11-17Ignore target sdk version for the public namespaceDmitriy Ivanov
This fixes the bug with using the libraries loaded prior to android_set_target_sdk_version call. Bug: http://b/22548808 Change-Id: I3ca2d367b0fa930a437bbb65f780834803d2ef0a
2015-11-16Remove the warning about empty LD_LIBRARY_PATHDmitriy Ivanov
Change-Id: I3eca11512d8055ab94dd0a6badcd83ce6440d675
2015-11-16Fix arm64 and x86 buildsDmitriy Ivanov
Change-Id: Ic3746b2f200f42218b6ac857c1631e873c767c17
2015-11-15Introducing linker namespacesDmitriy Ivanov
Bug: http://b/22548808 Change-Id: Ia3af3c0a167f1d16447a3d83bb045d143319b1e1
2015-11-06linker: cleanup solist after unsuccessful readDmitriy Ivanov
Bug: http://b/25560017 Change-Id: I03c5a1d7aed34c480d341aacfb3b1afdfa037b99
2015-10-27Implement load at fixed address featureDmitriy Ivanov
Bug: http://b/24683631 Change-Id: I3a39ab526c8f9e213339b60e135e5459d0f41381
2015-10-22Implement Library Load Order RandomizationDmitriy Ivanov
Bug: http://b/24047022 Change-Id: I36e05b403bfbaae8542a95147f9114a8b9c8ac0e
2015-10-16Merge "Replace auto -> const auto&/auto&&"Dimitry Ivanov
2015-10-16Merge "Fix R_AARCH64_ABS/PREL relocations"Dimitry Ivanov
2015-10-16Fix R_AARCH64_ABS/PREL relocationsDmitriy Ivanov
According to specification arm64 relocations should not use *reloc value. See http://infocenter.arm.com/help/topic/com.arm.doc.ihi0056b/IHI0056B_aaelf64.pdf section 4.6.5 Bug: http://b/24977219 Bug: http://b/24527155 Change-Id: I3813255771f408ba957963c6ad56ed08e5110d83
2015-10-14Ensure that readlink has access to /proc/self/fdDmitriy Ivanov
/proc/self/fd is not available when PR_DUMPABLE is set to 0 which is default for the user builds. It leads to permission denials on readlink. This change fixes the problem by setting PR_DUMPABLE flag to 1 for readlink and restoring it's previous value after the call. Bug: http://b/24912743 Change-Id: I3fd179c5c6b56af96d6a15ee597024ccb15e1a13 (cherry picked from commit cf92738fa5dee24050028a1235f815f2a0fd33b5)
2015-10-13Log dlopen failures caused by text relocationsDmitriy Ivanov
Some apps will fail to load native libraries with text relocations when switching target sdk version to M. It could be hard to diagnose because some of them suppress dlerror and/or UnsatisfiedLinkError. This change unconditionally logs the error message making the cause of the failure more visible to developers. Bug: http://b/24876001 Change-Id: I0477a0d1307d0879000f3a3a43b974b4cf34bdb2 (cherry picked from commit f32b689d3dbe7a1317bce58d1d9bef9bba173c66)