058eb8fa4e
During "step 1" of find_libraries, the linker finds the transitive closure of dependencies, in BFS order. As it finds each library, it adds the library to its primary namespace (so that, if some other library also depends on it, find_loaded_library_by_soname can find the library in the process of being loaded). LD_PRELOAD libraries are automatically marked DF_1_GLOBAL, and any DF_1_GLOBAL library is added to every linker namespace. Previously, this secondary namespace registration happened after step 1. The result is that across different namespaces, the order of libraries could vary. In general, a namespace's primary members will all appear before secondary members. This is undesirable for libsigchain.so, which we want to have appear before any other non-preloaded library. Instead, when an soinfo is added to its primary namespace, immediately add it to all the other namespaces, too. This ensures that the order of soinfo objects is the same across namespaces. Expand the dl.exec_with_ld_config_file_with_ld_preload and dl.exec_with_ld_config_file tests to cover the new behavior. Mark lib1.so DF_1_GLOBAL and use a "foo" symbol to mimic the behavior of a signal API interposed by (e.g.) libsigchain.so and a ASAN preload. Test: bionic unit tests Bug: http://b/143219447 Change-Id: I9fd90f6f0d14caf1aca6d414b3e9aab77deca3ff |
||
---|---|---|
.. | ||
Android.bp | ||
Android.build.dlext_testzip.mk | ||
Android.mk | ||
atexit_testlib.cpp | ||
bionic_tests_zipalign.cpp | ||
cfi_test_bad_lib.cpp | ||
cfi_test_helper.cpp | ||
cfi_test_helper2.cpp | ||
cfi_test_lib.cpp | ||
check_rtld_next_from_library.cpp | ||
dl_df_1_global.cpp | ||
dl_df_1_global_dummy.cpp | ||
dl_df_1_use_global.cpp | ||
dl_preempt_library_1.cpp | ||
dl_preempt_library_2.cpp | ||
dlext_test_library.cpp | ||
dlext_test_recursive_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 | ||
dlopen_testlib_ifunc_variable.cpp | ||
dlopen_testlib_ifunc_variable_impl.cpp | ||
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 | ||
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 | ||
elftls_dlopen_ie_error_helper.cpp | ||
elftls_dynamic.cpp | ||
elftls_dynamic_filler.cpp | ||
elftls_shared_var.cpp | ||
elftls_shared_var_ie.cpp | ||
elftls_tprel.cpp | ||
empty.cpp | ||
exec_linker_helper.cpp | ||
exec_linker_helper_lib.cpp | ||
heap_tagging_helper.cpp | ||
ld_config_test_helper.cpp | ||
ld_config_test_helper_lib1.cpp | ||
ld_config_test_helper_lib2.cpp | ||
ld_config_test_helper_lib3.cpp | ||
ld_preload_test_helper.cpp | ||
ld_preload_test_helper_lib1.cpp | ||
ld_preload_test_helper_lib2.cpp | ||
libnstest_ns_a_public1.cpp | ||
libnstest_ns_a_public1_internal.cpp | ||
libnstest_ns_b_public2.cpp | ||
libnstest_ns_b_public3.cpp | ||
libs_utils.h | ||
namespaces_dlopened.cpp | ||
namespaces_private.cpp | ||
namespaces_public.cpp | ||
namespaces_public_internal.cpp | ||
namespaces_root.cpp | ||
ns_hidden_child_app.cpp | ||
ns_hidden_child_global.cpp | ||
ns_hidden_child_helper.cpp | ||
ns_hidden_child_internal.cpp | ||
ns_hidden_child_public.cpp | ||
preinit_getauxval_test_helper.cpp | ||
preinit_syscall_test_helper.cpp | ||
pthread_atfork.cpp | ||
relocations.cpp | ||
segment_gap_inner.cpp | ||
segment_gap_outer.cpp | ||
segment_gap_outer.lds | ||
thread_exit_cb_helper.cpp | ||
thread_local_dtor.cpp | ||
thread_local_dtor2.cpp | ||
tls_properties_helper.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 |