Commit graph

747 commits

Author SHA1 Message Date
Lazar Trsic
83b44a9e73 Rename DT_MIPS_RLD_MAP2 flag to DT_MIPS_RLD_MAP_REL
Change-Id: I2c0972f5ce3586c3f4f130034f7063f97557ab4e
2016-04-06 17:52:16 +00:00
Dimitry Ivanov
fa4aeed2c6 linker: Add unit-test for sleb128_decoder
Add missing test for sleb128_decoder. Also remove
dependency to static library because it exposes malloc/free
which interfere with libc.so malloc/free causing test to crash.

Change-Id: Iedd3268011df9f67ed58c0b58c71f34e30370b23
2016-04-05 16:42:17 -07:00
Dimitry Ivanov
d15837a3b2 Merge "Revert "[MIPS] Link .dex or .oat code lacking .MIPS.abiflags segment"" 2016-04-04 16:49:21 +00:00
Dimitry Ivanov
d88e1f3501 linker: hide the pointer to soinfo
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
2016-03-28 13:15:40 -07:00
Mingwei Shi
be91052932 libc: implement kernel vdso syscalls for i386
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>
2016-03-25 14:10:05 -07:00
Yabin Cui
722072d65a CloseArchive() to free memory when OpenArchive fails.
Bug: 26962895
Change-Id: I42418eee320ddae857b42572690316c53f638e85
2016-03-22 16:43:24 -07:00
Goran Jakovljevic
2ee4588308 Revert "[MIPS] Link .dex or .oat code lacking .MIPS.abiflags segment"
This reverts commit 0acb15ead6.

This workaround is not needed any more. Now ART generates
.MIPS.abiflags segments in its files. This is done in
Ie06a3c4e384a23a77db7d04a2508edbf3a6d3933.

Change-Id: I746289eed443a0fdbe8fd0b1199bcc5cd4d024e1
2016-03-11 17:33:09 +01:00
Josh Gao
61cf3f3e03 debuggerd: rethrow the full signal we receive, always.
The previous code assumed that returning would be sufficient to rethrow
signals like SIGSEGV. This is not true, for example,  in the case where a
SIGSEGV is sent via kill(2). We were previously only sending the signal
to ourselves in some cases, because using kill(2) would lose information
in the siginfo_t argument. Use rt_tgsigqueueinfo(2) instead to preserve
its contents.

Bug: http://b/27367422
Change-Id: I1be822818d5905461979c7e12dc4e9c25049273b
2016-03-09 14:56:37 -08:00
Dimitry Ivanov
e97d8ed70e Do not add linker the _r_debug.r_map on link_image
Change-Id: Idd0fb06a5d9f400c0608ae532cc4c575211810fa
2016-03-02 11:09:18 -08:00
Dimitry Ivanov
d17a377c49 linker: print "not accessible" error message to the log
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)
2016-03-01 15:28:43 -08:00
Dimitry Ivanov
9f0a6954c6 Improvements to dynamic linker messages
Error messages now include executable name,
also linker doesn't abort if called on itself.

Change-Id: Ia17dd540919544b28062ed71751a1d79ee865206
2016-02-18 18:28:08 -08:00
Dimitry Ivanov
6b788eeff2 Move gdb support functions to a separate file
Move gdb support functions and variables to
linker_gdb_support.h/cpp

Change-Id: I96c6592a7055715b18f1137367470fe80987263f
2016-02-18 12:32:56 -08:00
Nicolas Geoffray
0fa5410b0f Revert "Move gdb support functions to a separate file"
Was reverted on internal master already.

This reverts commit f8d051c81b.

Change-Id: Ia432f83bcce91366fb23f1bb87603a093b7f074d
2016-02-18 09:31:24 +00:00
Dimitry Ivanov
f8d051c81b Move gdb support functions to a separate file
Move gdb support functions and variables to
linker_gdb_support.h/cpp

Change-Id: Id6e608617016383b68283760361c567e58e574bc
2016-02-17 16:09:35 -08:00
Dimitry Ivanov
f3064e4bc7 Use insert_link_map_into_debug_map for executable
Use insert_link_map_into_debug_map to insert the main
executable's link_map to r_debug

Change-Id: I0eacb3f030ea3eb16ed50ad2011d604beece2d03
2016-02-17 15:25:25 -08:00
Dimitry Ivanov
c347a10760 Merge "Update a comment for init_linker_info_for_gdb" 2016-02-17 22:20:22 +00:00
Dimitry Ivanov
6400129628 Update a comment for init_linker_info_for_gdb
Change-Id: I8e2895ecfcc6f77a180c3735342afc93be5923d3
2016-02-17 14:13:06 -08:00
Dimitry Ivanov
2de48bc809 Merge "Initialize linker link_map for gdb directly" 2016-02-17 00:00:30 +00:00
Dimitry Ivanov
acedcba331 Merge "Revert "Revert "Split out liblinker_malloc static library""" 2016-02-16 23:51:37 +00:00
Dimitry Ivanov
aa9cb26ead Revert "Revert "Split out liblinker_malloc static library""
This reverts commit 3bbeca7a1a.

Change-Id: I5a757fcd52a14442c2eb7ca53f7d1f1923a4efe9
2016-02-16 14:43:12 -08:00
Dimitry Ivanov
8d22dd53fe Initialize linker link_map for gdb directly
Remove unnecessary construction of soinfo when
initializing linker link_map for gdb.

Change-Id: Idf32cee56309aa9c9cf260efbd17a9deae9a756b
2016-02-16 14:39:15 -08:00
Dimitry Ivanov
e687d067c6 linker: remove soinfo::entry
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-16 13:25:29 -08:00
Dimitry Ivanov
3bbeca7a1a Revert "Split out liblinker_malloc static library"
This reverts commit a80564318a.

Change-Id: I63f16739a38f40ad930692176a4297ad1ce89570
2016-02-15 19:19:35 +00:00
Dimitry Ivanov
a80564318a Split out liblinker_malloc static library
Bug: http://b/14998480
Bug: http://b/25716705
Change-Id: I8c7ba3971d1b17dbfc1a2ab5553aa04fe5da6677
2016-02-11 13:48:49 -08:00
Christopher Ferris
05d08e9716 Updated to v4.4.1 kernel headers.
Small modifications needed to allow compilation with the new headers:

- Manually modify bionic/libc/kernel/uapi/asm-mips/asm/siginfo.h to
  remove the uapi from the include.
- PR_XXX defines are now available for mips, so remove the definition
  from linker_mips.cpp.

Bug: 23789423
Change-Id: I6dc8a03b012426d3a937db15cb24d3a50fab5a8c
2016-02-05 16:03:55 -08:00
Dimitry Ivanov
88f5111123 linker: Change the library search order
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-01 23:00:55 -08:00
Dimitry Ivanov
1b84afcfb1 linker: mark library .bss pages with anon:.bss
Bug: http://b/26778774
Change-Id: Ie2cdd841b7238de50ef389a897d79f915229616b
2016-01-27 18:12:03 -08:00
Dimitry Ivanov
d9d6a84c01 Unify names for pages allocated for small objects
Bug: http://b/26776399
Change-Id: Id5b6f143a526cecca56de18ddad8857dfa1dd165
2016-01-26 17:54:13 -08:00
Dimitry Ivanov
3edc5c41bb linker: align allocated blocks to 16 bytes
C/C++ requires the result of malloc/new to be
aligned for any primitive type.

Change-Id: I715b7679e738f34b3b409993fb3ef242e1321b7f
2016-01-21 14:28:33 -08:00
Dimitry Ivanov
f45b0e9ede Do not unmap reserved region on dlclose
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-20 20:57:47 -08:00
Elliott Hughes
42d949ff9d Defend against -fstack-protector in libc startup.
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-06 20:06:08 -08:00
Elliott Hughes
116b5698d4 Clarify which linker we are.
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
2016-01-05 11:06:50 -08:00
Dimitry Ivanov
7331fe18d7 linker: implement shared namespaces
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)
2015-12-19 23:38:27 -08:00
Dimitry Ivanov
9cf99cbad8 linker: add dlvsym(3)
This changes implements dlvsym - dlsym for versioned symbols.

Bug: http://b/22865643
Change-Id: Ic90a60d512104261a1416c43f9100f0d88e3b46f
2015-12-16 15:24:13 -08:00
Dimitry Ivanov
0bc3977537 Merge "Move dlsym and dladdr implementation to linker.cpp" 2015-12-11 01:26:17 +00:00
Dimitry Ivanov
4a2c5aa30c Move dlsym and dladdr implementation to linker.cpp
Bug: http://b/25716705
Bug: http://b/22865643
Change-Id: If22fc1eda219f676b5fcc06490f7901d21d1749c
2015-12-10 16:24:57 -08:00
Dimitry Ivanov
cb025e55f7 Merge "Revert "Add /odm/lib to shared lib search path"" 2015-12-10 20:17:02 +00:00
Dimitry Ivanov
39801757c3 Merge "Add permitted_when_isolated_path to linker namespaces" 2015-12-10 04:34:38 +00:00
Dimitry Ivanov
284ae3559e Add permitted_when_isolated_path to linker namespaces
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-09 13:54:01 -08:00
Dimitry Ivanov
5a3ab3422d Merge "Revert "Ensure that readlink has access to /proc/self/fd"" 2015-12-09 21:50:54 +00:00
Dimitry Ivanov
db43526581 Revert "Ensure that readlink has access to /proc/self/fd"
This reverts commit 4e50d0247b.

Bug: http://b/24912743
Change-Id: I5d32c670f0e16aec9c74add143158e919a301673
2015-12-09 19:36:47 +00:00
Dimitry Ivanov
40728bccbc Revert "Add /odm/lib to shared lib search path"
This reverts commit f74b041cce.

Bug: 25654402
Change-Id: I77386ea3655868d7cd1a8130afbc95e70549389e
2015-12-09 19:35:02 +00:00
Dimitry Ivanov
e371ae68ac Merge "Allow dlopening public libs using absolute path" 2015-12-05 05:25:57 +00:00
Dimitry Ivanov
22840aab47 Allow dlopening public libs using absolute path
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-04 21:21:35 -08:00
Elliott Hughes
939a7e0119 Track rename from base/ to android-base/.
Change-Id: I0a4592945400b1fa6892bf7c1fa8659fd711efa3
2015-12-04 15:27:46 -08:00
Dmitriy Ivanov
1ffec1cc4d Introduce anonymous namespace
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-23 16:13:10 -08:00
Dmitriy Ivanov
3c5248182e Handling invalid section headers
The linker crashes if native library has invalid section
headers. This change adds boundary checks on target offsets
and generates dlerror instead of crash.

Bug: http://b/25800330
Change-Id: Ibe282029997302b9b557637c3aad064d7d0febc5
2015-11-22 23:25:06 -08:00
Dmitriy Ivanov
84bab5a955 Move some utility functions to linker_utils
Also adds unit-tests for page_start, page_offset, and safe_add

Change-Id: Ia1325b4682d367328a01599a19848e4ffcd2c0ea
2015-11-20 21:37:51 +00:00
Dmitriy Ivanov
b76123fed8 Improve error message for files with no sections
Bug: http://b/25801618
Change-Id: I4f4f368e727ff48c84781279e3d17d4ac2d1b6b0
2015-11-20 10:49:12 -08:00
Hung-ying Tyan
0ebe2f07c3 Merge "Add /odm/lib to shared lib search path" 2015-11-19 16:38:51 +00:00