platform_bionic/tests/libs
dimitry 965d06da1e Fix logic in loading dependencies crossing namespace boundaries
This change addresses multiple problems introduced by
02586a2a34

1. In the case of unsuccessful dlopen the failure guard is triggered
for two namespaces which leads to double unload.

2. In the case where load_tasks includes libraries from 3 and more
namespaces it results in incorrect linking of libraries shared between
second and third/forth and so on namespaces.

The root cause of these problems was recursive call to find_libraries.
It does not do what it is expected to do. It does not form new load_tasks
list and immediately jumps to linking local_group. Not only this skips
reference counting it also will include unlinked but accessible library
from third (and fourth and fifth) namespaces in invalid local group. The
best case scenario here is that for 3 or more namesapces this will
fail to link. The worse case scenario it will link the library
incorrectly with will lead to very hard to catch bugs.

This change removes recursive call and replaces it with explicit list of
local_groups which should be linked. It also revisits the way we do
reference counting - with this change the reference counts are updated after
after libraries are successfully loaded.

Also update soinfo_free to abort in case when linker tries to free same
soinfo for the second time - this makes linker behavior less undefined.

Test: bionic-unit-tests
Bug: http://b/69787209
Change-Id: Iea25ced181a98c6503cce6e2b832c91d697342d5
2017-12-10 22:04:55 +01:00
..
Android.bp Fix logic in loading dependencies crossing namespace boundaries 2017-12-10 22:04:55 +01:00
Android.build.dlext_testzip.mk Move libdlext_... to NATIVE_TESTS instead of ETC 2017-05-22 17:36:16 -07:00
Android.build.dlopen_2_parents_reloc.mk Count references for groups instead of instances 2014-12-02 10:54:26 -08:00
Android.build.dlopen_check_order_dlsym.mk Fix relocation to look for symbols in local group 2014-10-23 12:13:54 -07:00
Android.build.dlopen_check_order_reloc_main_executable.mk Fix relocation to look for symbols in local group 2014-10-23 12:13:54 -07:00
Android.build.dlopen_check_order_reloc_siblings.mk Yet another relocation test 2014-11-19 10:39:05 -08:00
Android.build.dt_runpath.mk bionic-unit-tests: Build host testlibs in bionic-loader-test-libs 2016-12-09 17:26:11 +00:00
Android.build.linker_namespaces.mk Fix logic in loading dependencies crossing namespace boundaries 2017-12-10 22:04:55 +01:00
Android.build.pthread_atfork.mk Unregister pthread_atfork handlers on dlclose() 2015-04-24 17:57:37 -07:00
Android.build.testlib.host.mk bionic-unit-tests: Build host testlibs in bionic-loader-test-libs 2016-12-09 17:26:11 +00:00
Android.build.testlib.internal.mk bionic-unit-tests: Build host testlibs in bionic-loader-test-libs 2016-12-09 17:26:11 +00:00
Android.build.testlib.mk bionic-unit-tests: Build host testlibs in bionic-loader-test-libs 2016-12-09 17:26:11 +00:00
Android.build.testlib.target.mk bionic-unit-tests: Build host testlibs in bionic-loader-test-libs 2016-12-09 17:26:11 +00:00
Android.build.versioned_lib.mk Support symbol versioning 2015-04-16 17:57:30 -07:00
Android.mk Use -Werror in bionic/tests 2017-11-16 13:51:17 -08:00
atexit_testlib.cpp Add atexit test for attributed c-tor/d-tor 2014-08-15 14:22:07 -07:00
bionic_tests_zipalign.cpp Fix test compile errors after LLVM rebase 2017-05-02 21:14:42 +00:00
cfi_test_bad_lib.cpp Runtime support for CFI 2017-01-18 13:13:52 -08:00
cfi_test_helper.cpp Fix CFI initialization crash on x86. 2017-02-02 14:44:46 -08:00
cfi_test_helper2.cpp Fix CFI initialization crash on x86. 2017-02-02 14:44:46 -08:00
cfi_test_lib.cpp Extend cfi test to verify a range of target pointers. 2017-09-19 13:59:34 -07:00
check_rtld_next_from_library.cpp Fix for dlfcn.rtld_next_from_library. 2017-11-03 15:00:09 -07:00
dl_df_1_global.cpp Fix symbol lookup order during relocation 2014-10-31 11:39:51 -07:00
dl_df_1_global_dummy.cpp Fix: linker segfault on dlopen of a DF_1_GLOBAL so 2017-10-19 15:13:54 +09:00
dl_df_1_use_global.cpp Fix symbol lookup order during relocation 2014-10-31 11:39:51 -07:00
dl_preempt_library_1.cpp Fix symbol lookup order during relocation 2014-10-31 11:39:51 -07:00
dl_preempt_library_2.cpp Fix symbol lookup order during relocation 2014-10-31 11:39:51 -07:00
dlext_test_library.cpp Move libraries for unit-tests to separate folder 2014-06-17 15:08:53 -07:00
dlopen_2_parents_reloc_answer.cpp Count references for groups instead of instances 2014-12-02 10:54:26 -08:00
dlopen_b.cpp Make dt_runpath work for libraries opened from apk 2015-10-07 11:44:53 -07:00
dlopen_check_init_fini_child.cpp Add test checking init/fini call order 2017-02-09 14:07:05 -08:00
dlopen_check_init_fini_grand_child.cpp Add test checking init/fini call order 2017-02-09 14:07:05 -08:00
dlopen_check_init_fini_root.cpp Add test checking init/fini call order 2017-02-09 14:07:05 -08:00
dlopen_check_order_dlsym_answer.cpp Fix relocation to look for symbols in local group 2014-10-23 12:13:54 -07:00
dlopen_check_order_reloc_answer.cpp Fix relocation to look for symbols in local group 2014-10-23 12:13:54 -07:00
dlopen_check_order_reloc_answer_impl.cpp Fix relocation to look for symbols in local group 2014-10-23 12:13:54 -07:00
dlopen_check_order_reloc_grandchild_answer.cpp Yet another relocation test 2014-11-19 10:39:05 -08:00
dlopen_check_order_reloc_grandchild_answer_impl.cpp Yet another relocation test 2014-11-19 10:39:05 -08:00
dlopen_check_order_reloc_nephew_answer.cpp Fix jump to unmapped memory on atexit 2014-11-18 13:16:27 -08:00
dlopen_check_order_reloc_root_answer.cpp Fix relocation to look for symbols in local group 2014-10-23 12:13:54 -07:00
dlopen_check_order_reloc_root_answer_impl.cpp Fix relocation to look for symbols in local group 2014-10-23 12:13:54 -07:00
dlopen_nodelete_1.cpp Add RTLD_NODELETE flag support 2014-10-01 11:09:37 -07:00
dlopen_nodelete_2.cpp Add RTLD_NODELETE flag support 2014-10-01 11:09:37 -07:00
dlopen_nodelete_dt_flags_1.cpp Add RTLD_NODELETE flag support 2014-10-01 11:09:37 -07:00
dlopen_testlib_dlopen_from_ctor.cpp Minimize calls to mprotect 2015-01-23 16:30:34 -08:00
dlopen_testlib_ifunc.cpp Add ifunc for variable test-case 2017-05-02 16:35:20 -07:00
dlopen_testlib_ifunc_variable.cpp Add ifunc for variable test-case 2017-05-02 16:35:20 -07:00
dlopen_testlib_ifunc_variable_impl.cpp Add ifunc for variable test-case 2017-05-02 16:35:20 -07:00
dlopen_testlib_loopy_a.cpp Count references for groups instead of instances 2014-12-02 10:54:26 -08:00
dlopen_testlib_loopy_b.cpp Count references for groups instead of instances 2014-12-02 10:54:26 -08:00
dlopen_testlib_loopy_c.cpp Count references for groups instead of instances 2014-12-02 10:54:26 -08:00
dlopen_testlib_loopy_invalid.cpp Count references for groups instead of instances 2014-12-02 10:54:26 -08:00
dlopen_testlib_loopy_root.cpp Count references for groups instead of instances 2014-12-02 10:54:26 -08:00
dlopen_testlib_missing_symbol.cpp Fix logic in loading dependencies crossing namespace boundaries 2017-12-10 22:04:55 +01:00
dlopen_testlib_relo_check_dt_needed_order.cpp Fix order of soinfo links (repairs libcxx tests). 2014-09-05 16:01:47 -07:00
dlopen_testlib_relo_check_dt_needed_order_1.cpp Fix order of soinfo links (repairs libcxx tests). 2014-09-05 16:01:47 -07:00
dlopen_testlib_relo_check_dt_needed_order_2.cpp Fix order of soinfo links (repairs libcxx tests). 2014-09-05 16:01:47 -07:00
dlopen_testlib_simple.cpp Fix dlsym() to take into account RTLD_GLOBAL/LOCAL 2014-09-15 17:39:48 -07:00
dlopen_weak_undefined.cpp Add another test for weak-reference 2014-12-16 19:46:45 +00:00
dlsym_from_this_functions.cpp Improved dlsym tests and fixes to linker 2015-05-12 13:46:40 -07:00
dlsym_from_this_symbol.cpp Improved dlsym tests and fixes to linker 2015-05-12 13:46:40 -07:00
dlsym_from_this_symbol2.cpp Improved dlsym tests and fixes to linker 2015-05-12 13:46:40 -07:00
dlsym_weak_function.cpp Fix weak function lookups 2014-06-17 16:18:18 -07:00
empty.cpp Move libraries for unit-tests to separate folder 2014-06-17 15:08:53 -07:00
ld_config_test_helper.cpp linker: the global group is added to all built-in namespaces 2017-08-03 01:02:07 +09:00
ld_config_test_helper_lib1.cpp linker: the global group is added to all built-in namespaces 2017-08-03 01:02:07 +09:00
ld_config_test_helper_lib2.cpp linker: the global group is added to all built-in namespaces 2017-08-03 01:02:07 +09:00
ld_config_test_helper_lib3.cpp linker: the global group is added to all built-in namespaces 2017-08-03 01:02:07 +09:00
ld_preload_test_helper.cpp linker: the global group is added to all built-in namespaces 2017-08-03 01:02:07 +09:00
ld_preload_test_helper_lib1.cpp linker: the global group is added to all built-in namespaces 2017-08-03 01:02:07 +09:00
ld_preload_test_helper_lib2.cpp linker: the global group is added to all built-in namespaces 2017-08-03 01:02:07 +09:00
libs_utils.h Fix x86 system calls made from ELF preinit. 2017-03-29 13:48:02 -07:00
namespaces_dlopened.cpp Introducing linker namespaces 2015-11-15 12:09:16 -08:00
namespaces_private.cpp Introducing linker namespaces 2015-11-15 12:09:16 -08:00
namespaces_public.cpp Introducing linker namespaces 2015-11-15 12:09:16 -08:00
namespaces_public_internal.cpp Replace public library list with shared lib sonames (part 2/2) 2017-02-09 23:26:44 -08:00
namespaces_root.cpp Replace public library list with shared lib sonames (part 2/2) 2017-02-09 23:26:44 -08:00
preinit_getauxval_test_helper.cpp Fix x86 system calls made from ELF preinit. 2017-03-29 13:48:02 -07:00
preinit_syscall_test_helper.cpp Fix x86 system calls made from ELF preinit. 2017-03-29 13:48:02 -07:00
pthread_atfork.cpp Unregister pthread_atfork handlers on dlclose() 2015-04-24 17:57:37 -07:00
versioned_lib_other.cpp Support symbol versioning 2015-04-16 17:57:30 -07:00
versioned_lib_other.map Support symbol versioning 2015-04-16 17:57:30 -07:00
versioned_lib_v1.cpp Support symbol versioning 2015-04-16 17:57:30 -07:00
versioned_lib_v1.map Support symbol versioning 2015-04-16 17:57:30 -07:00
versioned_lib_v2.cpp Support symbol versioning 2015-04-16 17:57:30 -07:00
versioned_lib_v2.map Support symbol versioning 2015-04-16 17:57:30 -07:00
versioned_lib_v3.cpp Support symbol versioning 2015-04-16 17:57:30 -07:00
versioned_lib_v3.map Support symbol versioning 2015-04-16 17:57:30 -07:00
versioned_uselib.cpp Support symbol versioning 2015-04-16 17:57:30 -07:00
versioned_uselib.map Support symbol versioning 2015-04-16 17:57:30 -07:00