summaryrefslogtreecommitdiff
path: root/linker/linker.cpp
AgeCommit message (Collapse)Author
2015-10-13Replace auto -> const auto&/auto&&Dmitriy Ivanov
Change-Id: Ie484e5a296b5dd222a9545d8539d40d97a6c158c
2015-10-13Correctly resolve realpath for absolute pathsLazar Trsic
Introduced by: https://android-review.googlesource.com/174475 Change-Id: I44e00040b28be167d5141454f919340afec6084e
2015-10-09Move VDSO pointers to a shared globals struct.Josh Gao
Change-Id: I01cbc9cf0917dc1fac52d9205bda2c68529d12ef
2015-10-09Remove textrels support for platform libsDmitriy Ivanov
Bug: http://b/20013628 Change-Id: Ia9382c7113e09bb6aed65072543e4ebe33026cf8
2015-10-07Make dt_runpath work for libraries opened from apkDmitriy Ivanov
This patch also fixes realpath for libraries opened directly from apks. Bug: http://b/21960914 Bug: http://b/21961857 Change-Id: I35ade661c87f1d448191f385811f6e9fd3cacf11
2015-10-01Fix the commentDmitriy Ivanov
Change-Id: Ic8126cf92d12851cccaa3e2e781f075c9f6c283a
2015-09-30Optimize dlopen from a zip fileDmitriy Ivanov
This change makes dynamic linker reuse ZipArchiveHandles in ld_library_path on dlopen to optimize the lookup of dt_needed libraries. Bug: http://b/21960534 Change-Id: I65f897910d46dd2ffabdcb0b7842db2f127eee30
2015-09-28Fix bug number for linker related workaroundsDmitriy Ivanov
Bug: 24425865 Change-Id: I2021674a9df0e768f312ca024d906302db1c494f
2015-09-02linker: don't pass dlextinfo to dependent loadsDmitriy Ivanov
Don't pass the parent load's dlextinfo to dependent loads, since this causes the linker to try to load the dependencies using the same addresses/relro/fds/etc as the main library, which is never going to work. This was how it worked before ae69a95 which broke this. Bug: http://b/23742664 Bug: http://b/20948231 Bug: http://b/20841817 Change-Id: I340ebae1127666d5c6c6f9c6521b89fb93f15bdd
2015-07-29Prevent buffer over-read in linker.cpp's parse_path.tony.ys_liu
Also, the old behavior of skipping empty entries doesn't match glibc. Change-Id: I497774377113ab6c5d962e0f20066e2192748f06
2015-07-26Restore protection flags for ifunc during relocs.Dmitriy Ivanov
IFUNC relocations require executable flag for the load segment containing .text. When dso has text relocs linker removes exec which causes crash during ifunc relocations. This patch fixes this problem by restoring segments protection for ifunc relocs. Bug: http://b/22611399 Change-Id: Icbf3be0fec0e42bf805bcad7533e2032a2e11b9c (cherry picked from commit de0fb393ae8136a5958fe17eee0c6285e2f7f91a)
2015-07-21Use a less misleading name for the code that sets up the main thread.Elliott Hughes
Change-Id: I50c1b0a3b633cf8bc40a6bd86f12adb6b91e2888
2015-07-16Add constant for zip separatorDmitriy Ivanov
Change-Id: I1dcbb15ac612fc28e922eb3de8148fcaebbc0820
2015-07-14A special linker for ASan executables.Evgenii Stepanov
Setup a /system/bin/linker_asan as a symlink to "linker". Read the linker name from PT_INTERP, and if it is linker_asan, switch default library lookup paths to the ASan set, which starts with the path to the instrumented libraries (/data/lib), followed by /system/lib as a fallback. This ensures that ASan binaries prefer ASan libraries, when available. This approach is way better then RPATH/RUNPATH and even better than LD_LIBRARY_PATH: - RUNPATH is per-DSO, while default paths are global. - LD_LIBRARY_PATH is overwritten by android_update_LD_LIBRARY_PATH. - neither RUNPATH nor LD_LIBRARY_PATH appear in android_get_LD_LIBRARY_PATH which is used to build java.lang.path. Having ASan libraries in java.lang.path is a good thing. Bug: 22355945 Change-Id: I1d2791fbf5740618f18f71a3ae3d873714669d3f
2015-07-08Fix memory-leak on soinfo_free()Dmitriy Ivanov
Bug: http://b/22290728 Change-Id: I00747056db2cd3ff8b33936278464daed7236536
2015-07-08Merge "Respect caller DT_RUNPATH in dlopen()."Evgenii Stepanov
2015-07-07Respect caller DT_RUNPATH in dlopen().Evgenii Stepanov
When dlopen-ing a library, add the caller's DT_RUNPATH to the directory search list. This fixes dlfcn.dt_runpath in bionic-unit-tests-glibc(32|64). Bug: 21899363 Change-Id: Ife6a7e192939292cf4dc291b7e6b95945761cde3
2015-06-30Improve personality initializationDmitriy Ivanov
1. Personality parameter should be unsigned int (not long) 2. Do not reset bits outside of PER_MASK when setting personality value. 3. Set personality for static executables. Bug: http://b/21900686 Change-Id: I4c7e34079cbd59b818ce221eed325c05b9bb2303 (cherry picked from commit f643eb38c36eb63f612e20dea09fd43ac6a6b360)
2015-06-29Lock on dl_interate_phdrDmitriy Ivanov
There is possibility of someone dlclosing a library while dl_iterate_phdr in progress which can lead to dl_iterate_phdr calling callback with invalid address if it was unmapped by dlclose. Bug: http://b/22047255 Change-Id: I3fc0d9fd2c51fb36fd34cb035f37271fa893a7be (cherry picked from commit f7d5bf334dc4bc5b7399d4c8268e1b0bf676548f)
2015-06-29Merge "Rename ZipEntryName to ZipString"Yusuke Sato
2015-06-25Fix crash when trying to load invalid ELF file.Dmitriy Ivanov
Bug: http://b/22047255 Bug: http://b/22091640 Change-Id: I6c51cff43287a6ac4b25fa9ce6a6fc3d232fd047 (cherry picked from commit 06700b2b5e92a365505b15d0d05e2d5b0706c511)
2015-06-25Rename ZipEntryName to ZipStringYusuke Sato
This is for https://android-review.googlesource.com/#/c/156771/. Bug: 21957428 Change-Id: Ida30c28c0fff0b2dadddbdb1aa1999ae3250610b
2015-06-24[MIPS] Support FR=0 emulation on FR=1 64-bit FP registersDuane Sand
Enables running of older MIPS NDK-built apps on mips64r6. Works with kernel supporting FRE emulation, and old kernels. Change-Id: If5e392ed89e9910cd1ccd30e0fd5c4a5acea2c7d
2015-06-24Merge "Revert "[MIPS] Support FR=0 emulation on FR=1 64-bit FP registers""Dimitry Ivanov
2015-06-24Revert "[MIPS] Support FR=0 emulation on FR=1 64-bit FP registers"Dimitry Ivanov
This reverts commit d02ec08427b006e80191ce60690ce48a788fb832. Bug: http://b/22045439 Change-Id: Iaf10ff1e2948083cce0098f29d5b87b32bfae1b7
2015-06-22Remove text-relocs support for apps targeting M+Dmitriy Ivanov
Remove support of text-relocations for apps targeting sdk version > 22 Bug: http://b/20013628 Change-Id: I2127739544480c747315e32df15dfbd1b79de4f5 (cherry picked from commit 3e6f7807541bab8157f9c26e55829fd193683349)
2015-06-21[MIPS] Support FR=0 emulation on FR=1 64-bit FP registersDuane Sand
Enables running of older MIPS NDK-built apps on mips64r6. Works with kernel supporting FRE emulation, and old kernels. Change-Id: I13923fe62cd83ad1d337f13a50f2eda2dfdd906f
2015-06-17Improve library lookup logicDmitriy Ivanov
Linker tries to open a library even if it can be found by soname. This only happens if the library was previously opened under different target sdk version. Bug: http://b/21876587 Bug: http://b/21153477 Bug: http://b/21171302 Bug: https://code.google.com/p/android/issues/detail?id=160921 Change-Id: I7dbbcc3b49933bffd89ca0af55371e1a1f2bf4c2 (cherry picked from commit 28154f5c56dc4a64270cae2374b47a168d1bd7fa)
2015-06-17Revert "Improve library lookup logic"Dimitry Ivanov
This reverts commit 455c145e3c451b2b6dc00663e4040d79acefd496. Bug: http://b/21876587 Bug: http://b/21153477 Bug: http://b/21171302 Bug: https://code.google.com/p/android/issues/detail?id=160921 Change-Id: Iad21ddfc1ac749d12bcb52384a8d937b307dd03b
2015-06-17Improve library lookup logicDmitriy Ivanov
Linker tries to open a library even if it can be found by soname. This only happens if the library was previously opened under different target sdk version. Bug: http://b/21876587 Bug: http://b/21153477 Bug: http://b/21171302 Bug: https://code.google.com/p/android/issues/detail?id=160921 Change-Id: I769a04b6b1368a107d43f399297be14050338bbc (cherry picked from commit ea4ef52fa46602a5853df0e5b1ddd71b194d54ce)
2015-06-11Make path to apk compliant with jar url formatDmitriy Ivanov
Bug: http://b/21726698 Bug: http://b/8076853 Change-Id: I8c1942a98fe3119746b4dc9f60a7ff215ea7009c (cherry picked from commit 524f1f1efe0cb32714c61e26f21701ac952b9e42)
2015-06-10Fix l_addr for the linkerDmitriy Ivanov
Bug: http://b/21765603 Change-Id: I97710ef2436eac2160e29ba3e4521f6e63a1907c
2015-06-10Merge "Support DT_RUNPATH in the linker."Evgenii Stepanov
2015-06-10Support DT_RUNPATH in the linker.Evgenii Stepanov
Only $ORIGIN substitution is supported, but not linux-specific $LIB or $PLATFORM. Change-Id: I5814a016c7c91afba080230a547a863686e7c2b9
2015-06-10Merge "Statically linked executables should honor AT_SECURE."Elliott Hughes
2015-06-09Statically linked executables should honor AT_SECURE.Elliott Hughes
Bug: http://b/19647373 Change-Id: I10e7682d9cec26a523f1a3597ca5326c3ca42ebe
2015-06-08Check if strtab exists before using itDmitriy Ivanov
Bug: http://b/21696087 Change-Id: I1e22d5fd6fe2faead332249493123c9a085081e9
2015-06-02Backward compatibility for dlsym(RTLD_DEFAULT, ...)Dmitriy Ivanov
Do not skip RTLD_LOCAL libraries in dlsym(RTLD_DEFAULT, ...) if the library is opened by application with target api level <= 22 Bug: http://b/21565766 Bug: http://b/17512583 Change-Id: Ic45ed1e4f53e84cba9d74cab6b0049c0c7aa8423 (cherry picked from commit 04f7e3e955ba7de5f449c995e667659319dc1cce)
2015-06-02Merge "Work around for libraries without dt_soname"Dmitriy Ivanov
2015-06-02Work around for libraries without dt_sonameDmitriy Ivanov
Applies only for apps targeting sdk version <= 22 Bug: http://b/21565766 Change-Id: If0bf2229dc1341e9ca09f9a05d0890515273d5a2 (cherry picked from commit 38c37d6705f420ecac4146c11d79bee6e0ca8a03)
2015-06-01Fix dlsym(handle_of_main_executable, ...)Dmitriy Ivanov
According to man dlopen(3) and posix docs in the case when si is handle of the main executable we need to search not only in the executable and its dependencies but also in all libraries loaded with RTLD_GLOBAL. see also: http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlopen.html Bug: http://b/21528224 Bug: http://b/17512583 Bug: https://code.google.com/p/android/issues/detail?id=173822 Change-Id: Ib2801367ba48b6f3704da89a6d9f5e6911430013
2015-05-28Merge "Improve some of error/warning messages"Dmitriy Ivanov
2015-05-28Work around incorrect dt_needed entriesDmitriy Ivanov
This applies for apps targeting sdk<=22 and only for lp32 platforms. Bug: http://b/21364029 Change-Id: I903e81c9ccda2a8beaba1d132d68c77d30a4cdb2
2015-05-28Improve some of error/warning messagesDmitriy Ivanov
Bug: http://b/20464031 Change-Id: I948141c46f9e054fc45f5934153dee56ce3cd558
2015-05-22Fix RTLD_NEXT lookup for the local_groupDmitriy Ivanov
Linker used to skip RTLD_NEXT within local_group when caller->next is nullptr (which represents load order but not the order within local_group dependency tree) Bug: http://b/21380474 Change-Id: I178fc4657b19bceb871635b177c1df67855b1708
2015-05-16Merge "Apply work around b/19059885 to x86"Dmitriy Ivanov
2015-05-15Apply work around b/19059885 to x86Dmitriy Ivanov
Bug: http://b/19059885 Bug: http://b/21203348 Change-Id: Ic375e9f877d68de8f866d17362879a7dde638465 (cherry picked from commit 69a5fb951d69689dedd83cb033ae3dcd0ef05b65)
2015-05-15Don't use TEMP_FAILURE_RETRY on close in bionic.Elliott Hughes
Bug: http://b/20501816 Change-Id: Id64b5109cc2b165fa0351b6edbb865a5e5058008
2015-05-13ScopedFd: Don't use TEMP_FAILURE_RETRY() with close()Spencer Low
According to the comments in Posix_close(), TEMP_FAILURE_RETRY() should not be used with close(): https://android.googlesource.com/platform/libcore/+/462bdac45c10f43d88d8f07f6994e272a27c14a2%5E%21/#F12 Kill ScopedFd by simplifying the single caller. Change-Id: I248c40b8c2fc95f1938a6edfc245c81847fc44af Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-05-12Improved dlsym tests and fixes to linkerDmitriy Ivanov
Answers the question: what if dependent library was preloaded with RTLD_LOCAL flag. Also add test for RTLD_NEXT within local_group. Bug: http://b/17512583 Change-Id: I79e081e68b3a8c0ed8980d4275a06515fea94ec9