android_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
Android.build.dlopen_check_order_dlsym.mk
Android.build.dlopen_check_order_reloc_main_executable.mk
Android.build.dlopen_check_order_reloc_siblings.mk
Android.build.dt_runpath.mk
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
Android.build.testlib.host.mk
Android.build.testlib.internal.mk
Android.build.testlib.mk
Android.build.testlib.target.mk
Android.build.versioned_lib.mk
Android.mk Use -Werror in bionic/tests 2017-11-16 13:51:17 -08:00
atexit_testlib.cpp
bionic_tests_zipalign.cpp Fix test compile errors after LLVM rebase 2017-05-02 21:14:42 +00:00
cfi_test_bad_lib.cpp
cfi_test_helper.cpp
cfi_test_helper2.cpp
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
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
dl_preempt_library_1.cpp
dl_preempt_library_2.cpp
dlext_test_library.cpp
dlopen_2_parents_reloc_answer.cpp
dlopen_b.cpp
dlopen_check_init_fini_child.cpp
dlopen_check_init_fini_grand_child.cpp
dlopen_check_init_fini_root.cpp
dlopen_check_order_dlsym_answer.cpp
dlopen_check_order_reloc_answer.cpp
dlopen_check_order_reloc_answer_impl.cpp
dlopen_check_order_reloc_grandchild_answer.cpp
dlopen_check_order_reloc_grandchild_answer_impl.cpp
dlopen_check_order_reloc_nephew_answer.cpp
dlopen_check_order_reloc_root_answer.cpp
dlopen_check_order_reloc_root_answer_impl.cpp
dlopen_nodelete_1.cpp
dlopen_nodelete_2.cpp
dlopen_nodelete_dt_flags_1.cpp
dlopen_testlib_dlopen_from_ctor.cpp
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
dlopen_testlib_loopy_b.cpp
dlopen_testlib_loopy_c.cpp
dlopen_testlib_loopy_invalid.cpp
dlopen_testlib_loopy_root.cpp
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
dlopen_testlib_relo_check_dt_needed_order_1.cpp
dlopen_testlib_relo_check_dt_needed_order_2.cpp
dlopen_testlib_simple.cpp
dlopen_weak_undefined.cpp
dlsym_from_this_functions.cpp
dlsym_from_this_symbol.cpp
dlsym_from_this_symbol2.cpp
dlsym_weak_function.cpp
empty.cpp
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
namespaces_private.cpp
namespaces_public.cpp
namespaces_public_internal.cpp
namespaces_root.cpp
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
versioned_lib_other.cpp
versioned_lib_other.map
versioned_lib_v1.cpp
versioned_lib_v1.map
versioned_lib_v2.cpp
versioned_lib_v2.map
versioned_lib_v3.cpp
versioned_lib_v3.map
versioned_uselib.cpp
versioned_uselib.map